summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-09-16 21:48:17 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-09-16 21:48:17 +0700
commit0a117ae984dafdb9c160e3fea4d1aac0ddfd164e (patch)
tree6223cbfa6e270321a23b6be18d5a6ea22138671b /indoteknik_custom/models/purchase_order.py
parent1f63169f38675adf23a1e4a66b31711f90721f39 (diff)
parent6791235591714e4ac45a6729409716bcba9e8fea (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into cbd-apt
merge
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 18811b85..e7e5c382 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -6,6 +6,7 @@ import logging
from pytz import timezone, utc
import io
import base64
+from odoo.tools import lazy_property
try:
from odoo.tools.misc import xlsxwriter
except ImportError:
@@ -115,6 +116,19 @@ class PurchaseOrder(models.Model):
compute='_compute_complete_bu_in_count'
)
+ show_description = fields.Boolean(
+ string='Show Description'
+ )
+
+ @api.onchange('show_description')
+ def onchange_show_description(self):
+ if self.show_description == True:
+ for line in self.order_line:
+ line.show_description = True
+ else:
+ for line in self.order_line:
+ line.show_description = False
+
def _compute_complete_bu_in_count(self):
for order in self:
if order.state not in ['done', 'cancel']:
@@ -137,7 +151,7 @@ class PurchaseOrder(models.Model):
def _compute_date_planned(self):
""" date_planned = the earliest date_planned across all order lines. """
for order in self:
- order.date_planned = False
+ order.date_planned = order.date_planned
@api.constrains('date_planned')
def constrains_date_planned(self):
@@ -1066,8 +1080,11 @@ class PurchaseOrder(models.Model):
# sticky=True
# )
+ has_bom = self.product_bom_id.id
+ has_manufacturing = self.manufacturing_id.id
+
if not self.from_apo:
- if not self.matches_so and not self.env.user.is_purchasing_manager and not self.env.user.is_leader:
+ if not self.matches_so and not self.env.user.is_purchasing_manager and not self.env.user.is_leader and not has_bom and not has_manufacturing:
raise UserError("Tidak ada link dengan SO, harus di confirm oleh Purchasing Manager")
send_email = False