From 5873464b3280627bfbdced56e221d43cdca6ea79 Mon Sep 17 00:00:00 2001 From: Minh Hong Date: Fri, 25 Aug 2023 03:42:35 +0000 Subject: [PATCH] [FIX] l10n_vn: auto fill communication in bank application when scanning QR Code in invoice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use the number "8" to define the header of communication in additional data. Follow the EMVCo Merchant Presented QR Specification document: "If present, the content of the data object value for IDs "01" to "08" shall be either *** or a value defined by the merchant. The presence of *** indicates that the mobile application is responsible for obtaining the necessary information. Reviewed the Napas QR Specification of VietQR document. The number "8" means Purpose of Transaction. And almost Bank Applications in Vietnam will use the number "8" to auto-fill the communication on invoices to their applications. Already checked with 4 bank applications, also 1 social application in Vietnam. Closes #132479 closes odoo/odoo#133143 X-original-commit: 20d23b1206d0c47cbfd627f85b8c0144df552f10 Signed-off-by: de Wouters de Bouchout Jean-Benoît (jbw) --- addons/l10n_vn/models/res_bank.py | 2 +- addons/l10n_vn/tests/test_l10n_vn_emv_qr.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/l10n_vn/models/res_bank.py b/addons/l10n_vn/models/res_bank.py index 6e502795eae..a0370d71fd6 100644 --- a/addons/l10n_vn/models/res_bank.py +++ b/addons/l10n_vn/models/res_bank.py @@ -47,7 +47,7 @@ class ResPartnerBank(models.Model): def _get_additional_data_field(self, comment): if self.country_code == 'VN': - return self._serialize(1, comment) + return self._serialize(8, comment) return super()._get_additional_data_field(comment) def _get_error_messages_for_qr(self, qr_method, debtor_partner, currency): diff --git a/addons/l10n_vn/tests/test_l10n_vn_emv_qr.py b/addons/l10n_vn/tests/test_l10n_vn_emv_qr.py index a2c95a06e67..cecd7fc7a21 100644 --- a/addons/l10n_vn/tests/test_l10n_vn_emv_qr.py +++ b/addons/l10n_vn/tests/test_l10n_vn_emv_qr.py @@ -81,7 +81,7 @@ class TestL10nVNEmvQrCode(AccountTestInvoicingCommon): ) # Check the whole qr code string - self.assertEqual(emv_qr_vals, '00020101021238590010A0000007270129000697042201156607040600001290208QRIBFTTA52040000530370454031005802VN5914company_1_data6007Vietnam62170113INV/TEST/00016304E801') + self.assertEqual(emv_qr_vals, '00020101021238590010A0000007270129000697042201156607040600001290208QRIBFTTA52040000530370454031005802VN5914company_1_data6007Vietnam62170813INV/TEST/00016304600B') def test_remove_vietnamese_accents(self): accent_string = "áàảãạăắằẳẵặâấầẩẫậÁÀẢÃẠĂẮẰẲẴẶÂẤẦẨẪẬéèẻẽẹêếềểễệÉÈẺẼẸÊẾỀỂỄỆóòỏõọôốồổỗộơớờởỡợÓÒỎÕỌÔỐỒỔỖỘƠỚỜỞỠỢíìỉĩịÍÌỈĨỊúùủũụưứừửữựÚÙỦŨỤƯỨỪỬỮỰýỳỷỹỵÝỲỶỸỴđĐ" @@ -102,4 +102,4 @@ class TestL10nVNEmvQrCode(AccountTestInvoicingCommon): ) # Check the whole qr code string - self.assertEqual(emv_qr_vals, '00020101021238590010A0000007270129000697042201156607040600001290208QRIBFTTA52040000530370454031005802VN5914aAeEoOiIuUyYdD6007Vietnam62170113INV/TEST/0002630492AF') + self.assertEqual(emv_qr_vals, '00020101021238590010A0000007270129000697042201156607040600001290208QRIBFTTA52040000530370454031005802VN5914aAeEoOiIuUyYdD6007Vietnam62170813INV/TEST/000263041AA5')