Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Products & Pricelists
Entity: product.product
Compute Method: _compute_product_code
| Inputs | Method | Outputs |
|---|---|---|
|
read_access = self.env['ir.model.access'].check('product.supplierinfo', 'read', False)
for product in self:
product.code = product.default_code
if read_access:
- for supplier_info in product.seller_ids:
- if supplier_info.partner_id.id == product._context.get('partner_id'):
+ allowed_sellers = product.sudo().seller_ids.filtered(
+ lambda s: not s.company_id or s.company_id in self.env.companies
+ )
+ for supplier_info in allowed_sellers:
+ if supplier_info.partner_id.id == product.env.context.get('partner_id'):
if supplier_info.product_id and supplier_info.product_id != product:
# Supplier info specific for another variant.
continue
product.code = supplier_info.product_code or product.default_code
if product == supplier_info.product_id:
# Supplier info specific for this variant.
break
|
|
