summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorFIN-IT_AndriFP <it@fixcomart.co.id>2025-09-25 09:04:32 +0700
committerFIN-IT_AndriFP <it@fixcomart.co.id>2025-09-25 09:04:32 +0700
commit65c0ccd8b6befa65e912e9a0126cf2ef8bdd78d7 (patch)
tree3ce6d9106c644f84f2a908f1642846a689075fe1 /indoteknik_custom/models/purchase_order.py
parent8b179c22149366ecf4dd9de6e5e7b5be612e355b (diff)
parentcd0592f7b7248d25d1b7de728af87117ae0b5876 (diff)
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into closing-apt
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 0304b5e2..b34ec926 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -1057,8 +1057,19 @@ class PurchaseOrder(models.Model):
message="Produk "+line.product_id.name+" memiliki vendor berbeda dengan SO (Vendor PO: "+str(self.partner_id.name)+", Vendor SO: "+str(line.so_line_id.vendor_id.name)+")",
sticky=True
)
+
+ def _check_assets_note(self):
+ for order in self:
+ # Cari apakah ada line dengan produk ID 614469 ('Assets Mesin & Peralatan')
+ asset_line = order.order_line.filtered(lambda l: l.product_id.id == 595346)
+ if asset_line and not order.notes:
+ raise UserError(_(
+ "%s berisi produk 'Assets Mesin & Peralatan'. "
+ "Harap isi Notes untuk menjelaskan kebutuhan dan divisi terkait."
+ ) % order.name)
def button_confirm(self):
+ self._check_assets_note()
# self._check_payment_term() # check payment term
res = super(PurchaseOrder, self).button_confirm()
current_time = datetime.now()