summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order_line.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/sale_order_line.py')
-rw-r--r--indoteknik_custom/models/sale_order_line.py24
1 files changed, 23 insertions, 1 deletions
diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py
index a31ff569..29a046fa 100644
--- a/indoteknik_custom/models/sale_order_line.py
+++ b/indoteknik_custom/models/sale_order_line.py
@@ -38,6 +38,14 @@ class SaleOrderLine(models.Model):
md_vendor_id = fields.Many2one('res.partner', string='MD Vendor', readonly=True)
margin_md = fields.Float(string='Margin MD')
qty_free_bu = fields.Float(string='Free BU', compute='_get_qty_free_bandengan')
+ desc_updatable = fields.Boolean(string='desc boolean', default=False, compute='_get_desc_updatable')
+
+ def _get_desc_updatable(self):
+ for line in self:
+ if line.product_id.id != 417724:
+ line.desc_updatable = False
+ else:
+ line.desc_updatable = True
def _get_qty_free_bandengan(self):
for line in self:
@@ -272,6 +280,10 @@ class SaleOrderLine(models.Model):
(line.product_id.short_spesification if line.product_id.short_spesification else '')
line.name = line_name
line.weight = line.product_id.weight
+ if line.product_id.id != 417724:
+ line.desc_updatable = False
+ else:
+ line.desc_updatable = True
@api.constrains('vendor_id')
def _check_vendor_id(self):
@@ -378,4 +390,14 @@ class SaleOrderLine(models.Model):
if not line.product_id.product_tmpl_id.sale_ok:
raise UserError('Product %s belum bisa dijual, harap hubungi finance' % line.product_id.display_name)
if not line.vendor_id or not line.purchase_price and not line.display_type == 'line_note':
- raise UserError(_('Isi Vendor dan Harga Beli sebelum Request Approval')) \ No newline at end of file
+ raise UserError(_('Isi Vendor dan Harga Beli sebelum Request Approval'))
+
+ @api.depends('state')
+ def _compute_product_updatable(self):
+ for line in self:
+ if line.state == 'draft':
+ line.product_updatable = True
+ # line.desc_updatable = True
+ else:
+ line.product_updatable = False
+ # line.desc_updatable = False