From a543063d07f251ded6fc0414d7de960248c68f12 Mon Sep 17 00:00:00 2001 From: Laurent Smet Date: Mon, 8 Oct 2018 12:22:27 +0000 Subject: [PATCH] [IMP] account_facturx: search product also using the barcode closes odoo/odoo#27533 --- addons/account_facturx/models/account_invoice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/account_facturx/models/account_invoice.py b/addons/account_facturx/models/account_invoice.py index 9be1376867e..b6a649542c5 100644 --- a/addons/account_facturx/models/account_invoice.py +++ b/addons/account_facturx/models/account_invoice.py @@ -154,6 +154,12 @@ class AccountInvoice(models.Model): product = self.env['product.product'].search([('default_code', '=', line_elements[0].text)]) if product: invoice_line_form.product_id = product + if not invoice_line_form.product_id: + line_elements = element.xpath('.//ram:SpecifiedTradeProduct/ram:GlobalID', namespaces=tree.nsmap) + if line_elements and line_elements[0].text: + product = self.env['product.product'].search([('barcode', '=', line_elements[0].text)]) + if product: + invoice_line_form.product_id = product # Price Unit. line_elements = element.xpath('.//ram:GrossPriceProductTradePrice/ram:ChargeAmount', namespaces=tree.nsmap)