From 5b4905a3ad9082eae3c34e2308c3293ecdfb2daa Mon Sep 17 00:00:00 2001 From: Jared Kipe Date: Wed, 11 Aug 2021 17:00:29 -0700 Subject: [PATCH] [FIX] connector_opencart: fix write on existing product changing type --- connector_opencart/models/product/importer.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/connector_opencart/models/product/importer.py b/connector_opencart/models/product/importer.py index 0b7a134e..6618cf11 100644 --- a/connector_opencart/models/product/importer.py +++ b/connector_opencart/models/product/importer.py @@ -20,6 +20,11 @@ class ProductImportMapper(Component): @only_create @mapping def product_type(self, record): + # why this check if @only_create? + # well because we would turn the binding create into a very real product.template.write + existing_product = self.existing_product(record) + if existing_product and existing_product.get('odoo_id'): + return {'type': self.env['product.template'].browse(existing_product['odoo_id']).type} return {'type': 'product' if record.get('shipping') else 'service'} @mapping