On Friday, September 21, 2018 at 8:20:13 AM UTC, Cédric Krier wrote: > On 2018-09-17 01:21, Markus Bala wrote: > > Actually I have 3 questions, below is my case: > > > > I will doing barcode label for some warehouse operation. > > > > Case Study: > > At the receiving area, during receiving & storage, it will need to print 2 > > labels. One label is product label. One label is storage label. The > > different between 2 labels are in the label's size. > > Product label using 5cm x 10cm. Storage label using 15cm x 10cm. > > > > Because of this, I will have 2 labels printer. Printer (A) for product > > label. Printer (B) for storage Label. > > > > Question 1: for "Direct Print", how can set when I click on print "Product > > Label" it choose Printer (A) and vice versa. > > On windows, the client use the command 'print' which let the OS decide. > So maybe you can use different file extension and configure the OS to > choose the right printer. > On MacOS, the client uses the 'open' command which just open the file. > Maybe it is possible to configure the "opener" to select the right > printer when requesting to print. > On UNIX, it uses the 'xdg-open' command. In this case, I guess you can > also customize xdg to select the right printer from the mime-type.
Reply: Thank, I never thought of this method. I will try this solution. > > > Or alternative solution: > > Making the printer module. Like the link below: > > > > https://groups.google.com/forum/#!searchin/tryton-dev/printer|sort:date/tryton-dev/1Hu0AE5bjd8/0zCHyxkPq3EJ > > Not sure it is the best option because it requires a connection between > the server and the printer. Usually they are not in the same physical > area. Reply: This will be alternative. I will try on the solution no 1. > > > Question 2: How to get "Tryton Client" IP from "Trytond"? the purpose to > > fixed the IP/PC for the label printers so other PC do not have label printer > > Since 4.8, the Transaction.context has an attribute '_request' which is > the werkzeug request object and contain the IP address of the client. > But there is no guarantee that this attribute will always be set (for > example from proteus request or cron job). Nice. I have been looking this. Missed to check the transaction.context. Thank you > > > Question 3: How to get report in byte in trytond so I can print direct to > > printer through network. Like the link below > > > > https://www.zebra.com/us/en/support-downloads/knowledge-articles/ait/Network-Printing-Python-Example.html > > You can get the Report class from the pool and call execute on it. This > will return the bytes as second element of the response. Could you give me example on this? Iam litte bit confuse. Currently, I am using Relatio. It should be a dirty hack. I hope can use the method directly from Trytond instead. Below is my code: from relatorio import Report class BarcodeLabel(Workflow, ModelSQL, ModelView): @classmethod def print_lpn(cls, records): report = Report(abspath(join(dirname(__file__), 'lpn.odt')), ODT_MIME) data = report(records=records).render().getvalue() file_name = join(dirname(__file__), 'output_basic.odt') open(file_name, 'wb').write(data) > > -- > Cédric Krier - B2CK SPRL > Email/Jabber: cedric.kr...@b2ck.com > Tel: +32 472 54 46 59 > Website: http://www.b2ck.com/ -- You received this message because you are subscribed to the Google Groups "tryton-dev" group. To view this discussion on the web visit https://groups.google.com/d/msgid/tryton-dev/8faf1a69-436e-4d66-bbfe-5af30390fe4a%40googlegroups.com.