diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2024-11-11 14:38:05 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2024-11-11 14:38:05 +0700 |
| commit | ad4c738cb9a03f96cd4d7035ec13cafe4763e233 (patch) | |
| tree | 9cbb4ad9f2c70bc6ba8a7137ede1d31e48b0dd4a | |
| parent | fd6b9b5395b04135d9f0afdc0859fb4f07d280b4 (diff) | |
add qty rpo on plafon qty
| -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): |
