Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
sie 24
3492
1
kwi 24
1152
4
maj 25
2703
2
maj 25
6136
1
mar 25
1811