Skip to Content
Menu
This question has been flagged

Hello guys,

My Odoo 8 is in multi-companies setup.

I can create differents paper formats easily. For example, I have « Point of sale receipt - AA » and « Point of sale receipt - BB ».

Now, what is the best way to attrib the AA paper format to the point of sale receipt of the company AAAAA and attrib paper BB to the company BBBBB point of sale receipts????

Idea or tip?

THANKKKKKKKKKK!

Avatar
Discard
Best Answer

at odoo 16 we can do this like here I change paper format for invoice report only for a specific company :
 

from odoo import models, fields, api


class ir_actions_report_inherit(models.Model):
_inherit = 'ir.actions.report'

# if uae company and invoices report ,get specific paper format
def get_paperformat(self):
if self and self.name in ('Invoices without Payment','Invoices') and self.env.company.country_id.code == 'AE':
return self.env.ref('invoice_report_uae_custom.paperformat_invoice_uae_format', False)
else:
return super().get_paperformat() # self.paperformat_id or self.env.company.paperformat_id


Avatar
Discard
Best Answer

In the definition of the company, you can choose the paper format for the company. In Settings/Printing/Reports you can also select the paper format for report. Or... you add the field POS_paper_format in company and override get_pdf() in report.py (if format other only for POS).

Avatar
Discard
Author

THANKS. I will analyze it soon.

Author

COuld you rephrase « you add filed POS_paper_format in company » please

Sorry, typo ..... you add field ....

Author

Ok. my override of get_pdf() works great. But now.... When I see the receipt in the point of sale, it doesn't call this method get_pdf()... Oups!

depends?

Author

In my point of sale, the receipt is in HTML/CSS. His code is defined in addons/point_of_sale/static/src/xml/pos.xml. So it is not a PDF.

hmmmm, paper_format for html???

Author

I see that in Point of sale-> Daily Operations -> orders, we can print an invoice. This one is the place you were talking about. This report use my override of get_pdf().

Author

It now means that we have to define TWO times the receipt paperformat? One paperformat for the HTML receipt via the point of sale session and one paperformat for the PDF receipt via Point of sale-> Daily Operations -> orders.... bad

pos.xml is qweb but.... it format is from css (paper_format is probably only useful for pdf)

@pascal
Can we achieve this "overriding of get_pdf" in odoo16 to set specific paper format for a specific report for a specific company? as I tried but not work

Related Posts Replies Views Activity
1
Jul 17
4915
1
Nov 24
168
1
Mar 16
4029
0
Oct 24
1317
1
Aug 23
540