diff --git a/addons/account/__manifest__.py b/addons/account/__manifest__.py index 77bd19a7810..c05398c9339 100644 --- a/addons/account/__manifest__.py +++ b/addons/account/__manifest__.py @@ -105,6 +105,12 @@ You could use this simplified accounting in case you work with an (external) acc 'account/static/tests/helpers/*.js', 'account/static/tests/*.js', ], + 'web.report_assets_common': [ + 'account/static/src/css/report_invoice.css', + ], + 'web.report_assets_pdf': [ + 'account/static/src/css/report_invoice.css', + ], }, 'license': 'LGPL-3', } diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 91140923a2c..cf6525f33cf 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -449,6 +449,10 @@ class AccountMove(models.Model): copy=False, tracking=True, ) + amount_total_words = fields.Char( + string="Amount total in words", + compute="_compute_amount_total_words", + ) # === Reverse feature fields === # reversed_entry_id = fields.Many2one( @@ -1425,12 +1429,17 @@ class AccountMove(models.Model): @api.depends('company_id') def _compute_display_qr_code(self): - for record in self: - record.display_qr_code = ( - record.move_type in ('out_invoice', 'out_receipt', 'in_invoice', 'in_receipt') - and record.company_id.qr_code + for move in self: + move.display_qr_code = ( + move.move_type in ('out_invoice', 'out_receipt', 'in_invoice', 'in_receipt') + and move.company_id.qr_code ) + @api.depends('amount_total', 'currency_id') + def _compute_amount_total_words(self): + for move in self: + move.amount_total_words = move.currency_id.amount_to_text(move.amount_total).replace(',', '') + # ------------------------------------------------------------------------- # INVERSE METHODS # ------------------------------------------------------------------------- diff --git a/addons/account/models/company.py b/addons/account/models/company.py index 49122b4a247..e01a5fe67d1 100644 --- a/addons/account/models/company.py +++ b/addons/account/models/company.py @@ -102,6 +102,7 @@ class ResCompany(models.Model): invoice_is_email = fields.Boolean('Email by default', default=True) invoice_is_print = fields.Boolean('Print by default', default=True) + display_invoice_amount_total_words = fields.Boolean(string='Total amount of invoice in letters') account_use_credit_limit = fields.Boolean( string='Sales Credit Limit', help='Enable the use of credit limit on partners.') diff --git a/addons/account/models/res_config_settings.py b/addons/account/models/res_config_settings.py index cbbe11a1bc4..c32636fb0bf 100644 --- a/addons/account/models/res_config_settings.py +++ b/addons/account/models/res_config_settings.py @@ -133,6 +133,11 @@ class ResConfigSettings(models.TransientModel): readonly=False) terms_type = fields.Selection( related='company_id.terms_type', readonly=False) + display_invoice_amount_total_words = fields.Boolean( + string="Total amount of invoice in letters", + related='company_id.display_invoice_amount_total_words', + readonly=False + ) preview_ready = fields.Boolean(string="Display preview button", compute='_compute_terms_preview') use_invoice_terms = fields.Boolean( diff --git a/addons/account/static/src/css/report_invoice.css b/addons/account/static/src/css/report_invoice.css new file mode 100644 index 00000000000..7abb185c986 --- /dev/null +++ b/addons/account/static/src/css/report_invoice.css @@ -0,0 +1,18 @@ +#payment_terms_note_id > p { + margin-bottom: 0 !important; +} + +.avoid-page-break-inside { + page-break-inside: avoid; +} + +.justify-text { + text-align:justify; + text-justify:inter-word; +} + +#qrcode_odoo_logo { + -webkit-transform:translate(-50%,-50%); + height:18%; + width:18%; +} diff --git a/addons/account/static/src/img/Odoo_logo_O.svg b/addons/account/static/src/img/Odoo_logo_O.svg new file mode 100644 index 00000000000..e85050776ce --- /dev/null +++ b/addons/account/static/src/img/Odoo_logo_O.svg @@ -0,0 +1,4 @@ + diff --git a/addons/account/views/report_invoice.xml b/addons/account/views/report_invoice.xml index 586b3f20229..4d6b904d8df 100644 --- a/addons/account/views/report_invoice.xml +++ b/addons/account/views/report_invoice.xml @@ -49,7 +49,7 @@
+ Total amount in words:
+
+
- Please use the following communication for your payment : -
-+ +
++ Payment Communication: +
+
+
+
+
Scan this QR Code to
pay with your mobile
- -
-- Incoterm: - -
-
- Scan me with your banking app.
-
+
+
+ Incoterm: