You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
853 B

from odoo import models, fields, api
class BeesdooProduct(models.Model):
_inherit = "product.template"
main_supplierinfo = fields.Many2one(
'product.supplierinfo',
string='Main Supplier Information',
compute='_compute_main_supplierinfo'
)
main_price = fields.Float(
string='Price',
compute='_compute_main_supplierinfo',
)
main_minimum_qty = fields.Float(
string='Minimum Quantity',
compute='_compute_main_supplierinfo',
)
@api.multi
@api.depends('seller_ids')
def _compute_main_supplierinfo(self):
for product in self:
supplierinfo = product._get_main_supplier_info()
product.main_supplierinfo = supplierinfo
product.main_price = supplierinfo.price
product.main_minimum_qty = supplierinfo.min_qty