diff --git a/beesdoo_product/models/beesdoo_product.py b/beesdoo_product/models/beesdoo_product.py index 1682bffba..97bcd71f4 100644 --- a/beesdoo_product/models/beesdoo_product.py +++ b/beesdoo_product/models/beesdoo_product.py @@ -64,16 +64,19 @@ class BeesdooProduct(models.Model): translate=True, ) - main_seller_id = fields.Many2one( - "res.partner", - string="Main Seller", + top_supplierinfo_id = fields.Many2one( + comodel_name="product.supplierinfo", compute="_compute_main_seller_id", store=True, ) + main_seller_id = fields.Many2one( + string="Main Seller", + comodel_name="res.partner", + related="top_supplierinfo_id.name", + ) main_seller_id_product_code = fields.Char( string="Main Seller Product Code", - compute="_compute_main_seller_id", - store=True, + related="top_supplierinfo_id.product_code", ) display_unit = fields.Many2one("uom.uom") @@ -215,9 +218,7 @@ def generate_barcode(self): self.barcode = bc @api.multi - @api.depends( - "seller_ids", "seller_ids.date_start", "seller_ids.product_code" - ) + @api.depends("seller_ids", "seller_ids.date_start") def _compute_main_seller_id(self): for product in self: # todo english code Calcule le vendeur associé qui a la date de @@ -226,11 +227,8 @@ def _compute_main_seller_id(self): # “seller” and “supplier” are used interchangeably in this # class. is this on purpose? sellers_ids = product._get_main_supplier_info() - product.main_seller_id = ( - sellers_ids and sellers_ids[0].name or False - ) - product.main_seller_id_product_code = ( - sellers_ids and sellers_ids[0].product_code or False + product.top_supplierinfo_id = ( + sellers_ids and sellers_ids[0] or False ) @api.multi diff --git a/beesdoo_product/static/description/index.html b/beesdoo_product/static/description/index.html index 0b44320e5..d5a924a67 100644 --- a/beesdoo_product/static/description/index.html +++ b/beesdoo_product/static/description/index.html @@ -367,7 +367,7 @@

beesdoo_product

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 beescoop/addons

+

Beta License: AGPL-3 beescoop/obeesdoo

Modification of product module for the needs of beescoop