summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order_line.py
diff options
context:
space:
mode:
authortrisusilo48 <tri.susilo@altama.co.id>2025-01-14 09:31:44 +0700
committertrisusilo48 <tri.susilo@altama.co.id>2025-01-14 09:31:44 +0700
commit183cd9e68ea05e31c63000aeb992eb618edb02b5 (patch)
tree45d710db372c2a0eba437a0137cbb74d9935a7f2 /indoteknik_custom/models/sale_order_line.py
parent63878bd84a6eb9094e702963d7c78fcd8dfa1808 (diff)
parent6dda865a1b3262ce78ed2db024fd03efb091d6a6 (diff)
Merge branch 'odoo-production' into feature/integrasi_biteship
# Conflicts: # indoteknik_custom/__manifest__.py # indoteknik_custom/models/__init__.py # indoteknik_custom/security/ir.model.access.csv
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