I am trying to refer values from one field to another in this code, but whenever i enter a product in the product_id field , it is automatically goes into the to_close page, how to get rid of that auto invoking while entering a product in product_id?
from odoo import models, fields, api
class InventoryStock(models.Model):
_inherit = 'stock.move'
class MRPProduction(models.Model):
_inherit = 'mrp.production'
product_qty = fields.Float(compute='_compute_total_quantity',default='10', readonly=False) store_sum_product_uom_qty = fields.Float(compute='_compute_total_quantity_sum', readonly=False) product_id = fields.Many2one(compute='_compute_state_product_id')
@api.depends('store_sum_product_uom_qty')
def _compute_total_quantity(self):
for record in self:
record.product_qty = record.store_sum_product_uom_qty
@api.depends('move_raw_ids.product_uom_qty')
def _compute_total_quantity_sum(self):
for record in self:
record.store_sum_product_uom_qty =sum(record.move_raw_ids.mapped('product_uom_qty'))