So I'm trying to stop the "product_uom" field in the supplierinfo model from changing when I change the "uom_po_id" field in the product template, but I think I'm missing something.
I inherited the model and changed the "product_uom" field to not be related to "uom_po_id" anymore, and when the record is created I assign the correct uom, this way it's correct at first but doesn't change automatically.
I thought this would be enough to stop the uom from changing, but it still does. Maybe I'm missing some onchange method but I can't seem to find the correct one, if there is any.
Here's the relevant code:
from odoo import api, fields, models
class ProductSupplierInfo(models.Model):
_inherit = 'product.supplierinfo'
product_uom = fields.Many2one('uom.uom', string='Unit of Measure', help="This comes from the product form.")
@api.model
def create(self, vals_list):
self.product_uom = self.product_tmpl_id.uom_po_id
return super(ProductSupplierInfo, self).create(vals_list)