summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-06-18 11:41:53 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-06-18 11:41:53 +0700
commit001aa772a6ff8f7eb1cf1688480f32a7d82ec45d (patch)
treed54143a1e420e7ef62b98e14434203051264480e
parentb5b115176d5f69f4732c0ad64f24d19c82c7bbdb (diff)
change request multi create uangmuka pembelian
-rw-r--r--indoteknik_custom/models/account_move.py10
-rw-r--r--indoteknik_custom/models/purchase_order_multi_uangmuka.py1
-rw-r--r--indoteknik_custom/models/uangmuka_pembelian.py1
3 files changed, 12 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py
index 45d54209..3df6d888 100644
--- a/indoteknik_custom/models/account_move.py
+++ b/indoteknik_custom/models/account_move.py
@@ -62,6 +62,7 @@ class AccountMove(models.Model):
so_delivery_amt = fields.Char(string="SO Delivery Amount", compute='compute_so_shipping_paid_by')
flag_delivery_amt = fields.Boolean(string="Flag Delivery Amount", compute='compute_flag_delivery_amt')
nomor_kwitansi = fields.Char(string="Nomor Kwitansi")
+ po_id = fields.Many2one('purchase.order', string='purchase Order')
@api.model
def create(self, vals):
@@ -165,6 +166,15 @@ class AccountMove(models.Model):
def button_cancel(self):
res = super(AccountMove, self).button_cancel()
+ if self.move_type == 'entry':
+ po = self.env['purchase.order'].search([
+ ('invoice_ids', 'in', [self.id])
+ ])
+
+ for order in po:
+ if order:
+ order.is_create_uangmuka = False
+
if self.id and not self.env.user.is_accounting:
raise UserError('Hanya Accounting yang bisa Cancel')
return res
diff --git a/indoteknik_custom/models/purchase_order_multi_uangmuka.py b/indoteknik_custom/models/purchase_order_multi_uangmuka.py
index 3ab3a050..e0f80b1a 100644
--- a/indoteknik_custom/models/purchase_order_multi_uangmuka.py
+++ b/indoteknik_custom/models/purchase_order_multi_uangmuka.py
@@ -115,6 +115,7 @@ class PurchaseOrderMultiUangmuka(models.TransientModel):
order.is_create_uangmuka = True
+ order.invoice_ids = [account_move.id]
param_credit = {
'move_id': account_move.id,
'account_id': self.account_id.id, # bank in transit
diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py
index 3ae8d3fb..4d44e9f6 100644
--- a/indoteknik_custom/models/uangmuka_pembelian.py
+++ b/indoteknik_custom/models/uangmuka_pembelian.py
@@ -108,6 +108,7 @@ class UangmukaPembelian(models.TransientModel):
else:
request.env['account.move.line'].create([param_debit, param_credit])
order.is_create_uangmuka = True
+ order.invoice_ids = [account_move.id]
return {
'name': _('Journal Entries'),
'view_mode': 'form',