diff --git a/advanced_vat_invoice/__init__.py b/advanced_vat_invoice/__init__.py index 76783a441..924248fd4 100644 --- a/advanced_vat_invoice/__init__.py +++ b/advanced_vat_invoice/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Copyright (C) 2024-TODAY Cybrosys Technologies(). # Author: Athira P S (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO diff --git a/advanced_vat_invoice/__manifest__.py b/advanced_vat_invoice/__manifest__.py index 03da54716..4e1d914d9 100644 --- a/advanced_vat_invoice/__manifest__.py +++ b/advanced_vat_invoice/__manifest__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Copyright (C) 2024-TODAY Cybrosys Technologies(). # Author: Athira P S (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO diff --git a/advanced_vat_invoice/doc/RELEASE_NOTES.md b/advanced_vat_invoice/doc/RELEASE_NOTES.md index 37b849de0..27c5d48a2 100755 --- a/advanced_vat_invoice/doc/RELEASE_NOTES.md +++ b/advanced_vat_invoice/doc/RELEASE_NOTES.md @@ -1,6 +1,6 @@ ## Module -#### 25.08.2023 +#### 11.01.2024 #### Version 16.0.1.0.0 ##### ADD diff --git a/advanced_vat_invoice/models/__init__.py b/advanced_vat_invoice/models/__init__.py index c20397c13..07be8f40e 100644 --- a/advanced_vat_invoice/models/__init__.py +++ b/advanced_vat_invoice/models/__init__.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Copyright (C) 2024-TODAY Cybrosys Technologies(). # Author: Athira P S (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO diff --git a/advanced_vat_invoice/models/account_move.py b/advanced_vat_invoice/models/account_move.py index 455062b6b..63610df35 100644 --- a/advanced_vat_invoice/models/account_move.py +++ b/advanced_vat_invoice/models/account_move.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Copyright (C) 2024-TODAY Cybrosys Technologies(). # Author: Athira P S (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -43,8 +43,10 @@ class AccountMove(models.Model): qr = fields.Binary(string="QR Code", compute='generate_qrcode', store=True, help="QR code") - qr_button = fields.Boolean(struct="Qr Button", compute="_compute_qr", + qr_button = fields.Boolean(string="Qr Button", compute="_compute_qr", help="Is QR button is enable or not") + qr_page = fields.Boolean(string="Qr Page", compute="_compute_qr", + help="Is QR page is enable or not") @api.depends('qr_button') def _compute_qr(self): @@ -52,7 +54,15 @@ class AccountMove(models.Model): for record in self: qr_code = self.env['ir.config_parameter'].sudo().get_param( 'advanced_vat_invoice.is_qr') - record.qr_button = qr_code == 'True' + qr_code_generate_method = self.env[ + 'ir.config_parameter'].sudo().get_param( + 'advanced_vat_invoice.generate_qr') + record.qr_button = True if qr_code and qr_code_generate_method == 'manually' else False + record.qr_page = True if (qr_code and record.state in ['posted', + 'cancelled'] + and qr_code_generate_method == 'manually' + or qr_code_generate_method == 'automatically') \ + else False def timezone(self, userdate): """Function to convert a user's date to their timezone.""" @@ -94,10 +104,18 @@ class AccountMove(models.Model): vat_hex = self.hexa("02", "0f", seller_vat_no) or "" time_stamp = self.timezone(self.create_date) date_hex = self.hexa("03", "14", time_stamp) + amount_total = self.currency_id._convert( + self.amount_total, + self.env.ref('base.SAR'), + self.env.company, self.invoice_date or fields.Date.today()) total_with_vat_hex = self.hexa("04", "0a", - str(round(self.amount_total, 2))) + str(round(amount_total, 2))) + amount_tax = self.currency_id._convert( + self.amount_tax, + self.env.ref('base.SAR'), + self.env.company, self.invoice_date or fields.Date.today()) total_vat_hex = self.hexa("05", "09", - str(round(self.amount_tax, 2))) + str(round(amount_tax, 2))) qr_hex = (seller_hex + vat_hex + date_hex + total_with_vat_hex + total_vat_hex) encoded_base64_bytes = base64.b64encode(bytes.fromhex(qr_hex)).decode() diff --git a/advanced_vat_invoice/models/res_config_settings.py b/advanced_vat_invoice/models/res_config_settings.py index 3d44c30b5..05cf6a14c 100644 --- a/advanced_vat_invoice/models/res_config_settings.py +++ b/advanced_vat_invoice/models/res_config_settings.py @@ -3,7 +3,7 @@ # # Cybrosys Technologies Pvt. Ltd. # -# Copyright (C) 2023-TODAY Cybrosys Technologies(). +# Copyright (C) 2024-TODAY Cybrosys Technologies(). # Author: Athira P S (odoo@cybrosys.com) # # You can modify it under the terms of the GNU AFFERO @@ -36,7 +36,7 @@ class ResConfigSettings(models.TransientModel): @api.model def get_values(self): """Get the current configuration values.""" - res = super(ResConfigSettings, self).get_values() + res = super().get_values() res.update( generate_qr=self.env['ir.config_parameter'].sudo().get_param( 'advanced_vat_invoice.generate_qr'), @@ -47,7 +47,7 @@ class ResConfigSettings(models.TransientModel): def set_values(self): """Set the configuration values.""" - super(ResConfigSettings, self).set_values() + super().set_values() param = self.env['ir.config_parameter'].sudo() generate_qr = self.generate_qr and self.generate_qr or False is_qr = self.is_qr and self.is_qr or False diff --git a/advanced_vat_invoice/report/simplified_tax_report_templates.xml b/advanced_vat_invoice/report/simplified_tax_report_templates.xml index 64620ac0f..af6e5f41e 100644 --- a/advanced_vat_invoice/report/simplified_tax_report_templates.xml +++ b/advanced_vat_invoice/report/simplified_tax_report_templates.xml @@ -116,6 +116,7 @@ + @@ -142,6 +143,7 @@ + diff --git a/advanced_vat_invoice/report/vat_invoice_report_templates.xml b/advanced_vat_invoice/report/vat_invoice_report_templates.xml index ecb992cef..6f66a5626 100644 --- a/advanced_vat_invoice/report/vat_invoice_report_templates.xml +++ b/advanced_vat_invoice/report/vat_invoice_report_templates.xml @@ -69,7 +69,6 @@
- diff --git a/advanced_vat_invoice/views/account_move_views.xml b/advanced_vat_invoice/views/account_move_views.xml index b400ffd7f..1aa9f4f1a 100644 --- a/advanced_vat_invoice/views/account_move_views.xml +++ b/advanced_vat_invoice/views/account_move_views.xml @@ -10,13 +10,14 @@ + attrs="{'visible': [('qr_page', '!=', True)]}"> @@ -24,7 +25,7 @@