diff --git a/addons/purchase/models/product.py b/addons/purchase/models/product.py index bb5817086c9..ddd3c558950 100644 --- a/addons/purchase/models/product.py +++ b/addons/purchase/models/product.py @@ -22,7 +22,7 @@ class ProductTemplate(models.Model): ('receive', 'On received quantities'), ], string="Control Policy", help="On ordered quantities: Control bills based on ordered quantities.\n" "On received quantities: Control bills based on received quantities.", default="receive") - purchase_line_warn = fields.Selection(WARNING_MESSAGE, 'Purchase Order Line', help=WARNING_HELP, required=True, default="no-message") + purchase_line_warn = fields.Selection(WARNING_MESSAGE, 'Purchase Order Line Warning', help=WARNING_HELP, required=True, default="no-message") purchase_line_warn_msg = fields.Text('Message for Purchase Order Line') def _compute_purchased_product_qty(self): diff --git a/addons/purchase_stock/models/product.py b/addons/purchase_stock/models/product.py index f09db2e1167..66bfb199b3a 100644 --- a/addons/purchase_stock/models/product.py +++ b/addons/purchase_stock/models/product.py @@ -23,6 +23,8 @@ class ProductProduct(models.Model): _name = 'product.product' _inherit = 'product.product' + purchase_order_line_ids = fields.One2many('purchase.order.line', 'product_id', help='Technical: used to compute quantities.') + def _get_quantity_in_progress(self, location_ids=False, warehouse_ids=False): if not location_ids: location_ids = [] diff --git a/addons/purchase_stock/models/stock.py b/addons/purchase_stock/models/stock.py index 89e46abbe1f..4e690217e23 100644 --- a/addons/purchase_stock/models/stock.py +++ b/addons/purchase_stock/models/stock.py @@ -183,6 +183,11 @@ class Orderpoint(models.Model): 'product.supplierinfo', string='Vendor', check_company=True, domain="['|', ('product_id', '=', product_id), '&', ('product_id', '=', False), ('product_tmpl_id', '=', product_tmpl_id)]") + @api.depends('product_id.purchase_order_line_ids', 'product_id.purchase_order_line_ids.state') + def _compute_qty(self): + """ Extend to add more depends values """ + return super()._compute_qty() + @api.depends('route_id') def _compute_show_suppplier(self): buy_route = []