diff options
| -rwxr-xr-x | indoteknik_custom/models/product_template.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 3bb06eaf..25473ab8 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -375,6 +375,7 @@ class ProductProduct(models.Model): qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold') short_spesification = fields.Char(string='Short Spesification') max_qty_reorder = fields.Float(string='Max Qty Reorder', compute='_get_max_qty_reordering_rule') + qty_rpo = fields.Float(string='Qty RPO', compute='_get_qty_rpo') plafon_qty = fields.Float(string='Max Plafon', compute='_get_plafon_qty_product') def _get_clean_website_description(self): @@ -539,11 +540,22 @@ class ProductProduct(models.Model): else: product.max_qty_reorder = reordering.product_max_qty + def _get_qty_rpo(self): + for product in self: + rpo = self.env['v.requisition.match.po'].search([ + ('product_id', '=', product.id) + ], limit=1) + if not rpo: + product.qty_rpo = 0 + else: + product.qty_rpo = rpo.qty_rpo + def _get_plafon_qty_product(self): for product in self: qty_available = product.qty_available_bandengan max_qty = product.max_qty_reorder - product.plafon_qty = max_qty - qty_available + qty_rpo = product.qty_rpo + product.plafon_qty = max_qty - qty_available + qty_rpo # def write(self, vals): |
