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 | |
| parent | 4e1b9b2ab230e24e594008340690c69c35b42037 (diff) | |
add suggestion while sync so to po
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 6 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 2 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 6 |
3 files changed, 10 insertions, 4 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: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index fb85f4c1..eb5267e0 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -46,10 +46,8 @@ <field name="line_no" attrs="{'readonly': 1}"/> </field> <field name="product_qty" position="before"> - <field name="qty_onhand"/> - <field name="qty_incoming"/> - <field name="qty_outgoing"/> - <field name="qty_available"/> + <field name="qty_available_store"/> + <field name="suggest"/> </field> <page name="purchase_delivery_invoice" position="after"> <page name="purchase_vendor_bills" string="Vendor Bills" groups="indoteknik_custom.technical_administrator"> |
