diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2023-04-11 18:47:48 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2023-04-11 18:47:48 +0700 |
| commit | c29187f2e1be3bed90ab8f4eece5bbc087861522 (patch) | |
| tree | 420ac8bd6473e77f6ac17b303f896d45b4abb1d1 /indoteknik_custom/models | |
| parent | 4e1b9b2ab230e24e594008340690c69c35b42037 (diff) | |
add suggestion while sync so to po
Diffstat (limited to 'indoteknik_custom/models')
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 6 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 2 |
2 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 0ef6a9f2..8809d048 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -139,11 +139,17 @@ class PurchaseOrder(models.Model): self.order_line.unlink() for order_line in self.sale_order_id.order_line: if order_line.product_id.id and order_line.product_id.id not in products_exception: + qty_available = order_line.product_id.virtual_available + suggest = 'harus beli' + if order_line.product_id.virtual_available > order_line.product_qty: + suggest = 'masih cukup' values = { 'order_id': self.id, 'product_id': order_line.product_id.id, 'name': order_line.product_id.display_name, 'product_qty': order_line.product_qty, + 'qty_available_store': qty_available, + 'suggest': suggest, } self.env['purchase.order.line'].sudo().create(values) diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 8439df5d..f255095f 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -26,6 +26,8 @@ class PurchaseOrderLine(models.Model): qty_onhand = fields.Float('Qty On Hand', compute='compute_qty_stock') qty_incoming = fields.Float('Qty Incoming', compute='compute_qty_stock') qty_outgoing = fields.Float('Qty Outgoing', compute='compute_qty_stock') + qty_available_store = fields.Float(string='Available') + suggest = fields.Char(string='Suggest') def compute_qty_stock(self): for line in self: |
