diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-12-18 14:06:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-12-18 14:06:16 +0700 |
| commit | 955f0eff6fb1917c3cf0fde8ee6994ee43148732 (patch) | |
| tree | e29ed9a9ee3a1a6a91fac4661778adad74069736 | |
| parent | 8fc9eddc57f76f62c3efaa70c9a3aee8be1911fa (diff) | |
change field suggest po
| -rwxr-xr-x | indoteknik_custom/models/purchase_order.py | 4 | ||||
| -rwxr-xr-x | indoteknik_custom/models/purchase_order_line.py | 5 | ||||
| -rwxr-xr-x | indoteknik_custom/views/purchase_order.xml | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index 177a4744..285c5a95 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -214,6 +214,7 @@ class PurchaseOrder(models.Model): # suggest = 'harus beli' # if qty_available > order_line.product_qty: # suggest = 'masih cukup' + values = { 'order_id': self.id, 'product_id': order_line.product_id.id, @@ -224,6 +225,9 @@ class PurchaseOrder(models.Model): 'so_line_id': order_line.id, } self.order_line.create(values) + for order_line in self.order_line: + order_line.suggest_purchasing() + def compute_count_line_product(self): for order in self: diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py index 5e1c7b5f..f1c20106 100755 --- a/indoteknik_custom/models/purchase_order_line.py +++ b/indoteknik_custom/models/purchase_order_line.py @@ -27,15 +27,14 @@ class PurchaseOrderLine(models.Model): 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', compute='_compute_suggest_purchasing') + suggest = fields.Char(string='Suggest') price_vendor = fields.Float(string='Price Vendor', compute='compute_price_vendor') so_line_id = fields.Many2one('sale.order.line', string='ID SO Line') indent = fields.Boolean(string='Indent', help='centang ini jika barang indent') is_ltc = fields.Boolean(string='Sudah di LTC', default=False, help='centang ini jika barang sudah di LTC') note = fields.Char(string='Note') - def _compute_suggest_purchasing(self): - print(1) + def suggest_purchasing(self): for line in self: if line.qty_available < 0: line.suggest = 'harus beli' diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index 4cf83dd4..8e74df4a 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -55,7 +55,7 @@ <field name="qty_incoming" readonly="1" optional="hide"/> <field name="qty_outgoing" readonly="1" optional="hide"/> <field name="qty_available" readonly="1" optional="hide"/> - <field name="suggest" readonly="1" optional="hide"/> + <field name="suggest" readonly="1"/> </field> <field name="price_unit" position="after"> <field name="price_vendor" attrs="{'readonly': 1}" optional="hide"/> |
