Skip to Content
Menú
This question has been flagged

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'))  

Avatar
Descartar
Related Posts Respostes Vistes Activitat
2
d’ag. 24
3452
1
d’abr. 24
1109
4
de maig 25
2639
2
de maig 25
6050
1
de març 25
1757