summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2025-09-22 22:18:29 +0000
committerIT Fixcomart <it@fixcomart.co.id>2025-09-22 22:18:29 +0000
commit56e5d790d3eb1b8668c7669266c2fa0c4d98fff6 (patch)
treeca8b53a0c07c9d2dd42918a8112c58dfcfc97059
parent3ca958274d357d5e76d4bca7b141ffa2acc5b228 (diff)
parentb73575cc51ec58c02bccb711689d52e99e915c4e (diff)
Merged in stj-po (pull request #426)
Stj po
-rwxr-xr-xindoteknik_custom/models/purchase_order.py11
-rw-r--r--indoteknik_custom/models/stock_picking.py13
-rw-r--r--indoteknik_custom/views/unpaid_invoice_view.xml12
3 files changed, 32 insertions, 4 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()
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 35d408a1..67106073 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -1352,6 +1352,19 @@ class StockPicking(models.Model):
if self.picking_type_code == 'outgoing' and 'BU/OUT/' in self.name:
self.check_koli()
res = super(StockPicking, self).button_validate()
+
+ # Penambahan link PO di Stock Journal untuk Picking BD
+ for picking in self:
+ if picking.name and 'BD/' in picking.name and picking.purchase_id:
+ stock_journal = self.env['account.move'].search([
+ ('ref', 'ilike', picking.name + '%'),
+ ('journal_id', '=', 3) # Stock Journal ID
+ ], limit = 1)
+ if stock_journal:
+ stock_journal.write({
+ 'purchase_order_id': picking.purchase_id.id
+ })
+
self.date_done = datetime.datetime.utcnow()
self.state_reserve = 'done'
self.final_seq = 0
diff --git a/indoteknik_custom/views/unpaid_invoice_view.xml b/indoteknik_custom/views/unpaid_invoice_view.xml
index e56bbee7..ec6c749d 100644
--- a/indoteknik_custom/views/unpaid_invoice_view.xml
+++ b/indoteknik_custom/views/unpaid_invoice_view.xml
@@ -46,6 +46,10 @@
<field name="date_kirim_tukar_faktur"/>
<field name="date_terima_tukar_faktur"/>
<field name="payment_term_id"/>
+ <button name="action_create_surat_piutang"
+ type="object"
+ string="Create Surat Piutang"
+ class="oe_highlight"/>
</group>
<group>
<field name="sale_id"/>
@@ -57,10 +61,10 @@
decoration-warning="payment_state == 'partial'"/>
<field name="amount_total"/>
<field name="amount_residual"/>
- <button name="action_create_surat_piutang"
- type="object"
- string="Create Surat Piutang"
- class="oe_highlight"/>
+ <field name="payment_difficulty" widget="badge"
+ decoration-info="payment_difficulty == 'normal'"
+ decoration-warning="payment_difficulty in ('agak_sulit', 'sulit')"
+ decoration-danger="payment_difficulty == 'bermasalah'"/>
</group>
</group>
</sheet>