метод, который я хочу пропустить
@api.multi
def write(self, vals):
if 'uom_id' in vals:
new_uom = self.env['product.uom'].browse(vals['uom_id'])
updated = self.filtered(lambda template: template.uom_id != new_uom)
done_moves = self.env['stock.move'].search([('product_id', 'in', updated.mapped('product_variant_ids').ids)], limit=1)
if done_moves:
raise UserError(_("You can not change the unit of measure of a product that has already been used in a done stock move. If you need to change the unit of measure, you may deactivate this product."))
return super(ProductTemplate, self).write(vals)
метод, который я хочу выполнить:
@api.multi
def write(self, vals):
if 'uom_id' in vals:
new_uom = self.env['product.uom'].browse(vals['uom_id'])
updated = self.filtered(lambda template: template.uom_id != new_uom)
done_moves = self.env['stock.move'].search([('product_id', 'in', updated.mapped('product_variant_ids').ids)], limit=1)
print("@")
return super(my_product_class, self).write(vals)\
Первый метод записи находится в базовом классе product.py, поэтому я не могу его изменить, поэтому я хочу выполнить свой правильный метод. Как это сделать?