summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order_line.py
diff options
context:
space:
mode:
authorRafi Zadanly <zadanlyr@gmail.com>2024-02-02 14:07:43 +0700
committerRafi Zadanly <zadanlyr@gmail.com>2024-02-02 14:07:43 +0700
commitc26ea43e1d8c3c5bfffb94bc1432589a9f2815c9 (patch)
tree86b02e1b4d362617b168f4cb0a5777be483d07fb /indoteknik_custom/models/purchase_order_line.py
parent8bc43445f1d0b70d54d0a45830e04d0fcc406fbe (diff)
parentf5edc62d22c9a3973261ad289a11e189f0866f52 (diff)
Merge branch 'production' of bitbucket.org:altafixco/indoteknik-addons into production
Diffstat (limited to 'indoteknik_custom/models/purchase_order_line.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order_line.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_line.py b/indoteknik_custom/models/purchase_order_line.py
index 465944d5..f1881942 100755
--- a/indoteknik_custom/models/purchase_order_line.py
+++ b/indoteknik_custom/models/purchase_order_line.py
@@ -36,6 +36,34 @@ class PurchaseOrderLine(models.Model):
note = fields.Char(string='Note')
qty_reserved = fields.Float(string='Qty Reserved', compute='_compute_qty_reserved')
delete_line = fields.Boolean(string='Delete', default=False, help='centang ini jika anda ingin menghapus line ini')
+ is_edit_product_qty = fields.Boolean(string='Is Edit Product Qty', compute='_compute_is_edit_product_qty')
+
+ def _compute_is_edit_product_qty(self):
+ for line in self:
+
+ if line.order_id.state in ['draft']:
+ is_valid = True
+ else:
+ is_valid = False
+
+ line.is_edit_product_qty = is_valid
+
+ # @api.constrains('product_qty')
+ # def change_qty_po_and_qty_demand(self):
+ # for line in self:
+ # if line.order_id.state in ['draft', 'cancel'] and len(line.order_id.picking_ids) == 0:
+ # continue
+
+ # for stock_picking in line.order_id.picking_ids:
+ # picking = self.env['stock.move'].search([
+ # ('picking_id.purchase_id', '=', line.order_id.id),
+ # ('product_id', '=', line.product_id.id)
+ # ])
+
+ # if picking:
+ # picking.write({
+ # 'product_uom_qty': line.product_qty
+ # })
def _compute_qty_reserved(self):
for line in self: