diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-06-15 10:23:20 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-06-15 10:23:20 +0700 |
| commit | 080bdd7d1283509e55a0af2459c8e12b7519c0eb (patch) | |
| tree | bc0fbe2b27f67e2f1a767a8cac9a94e295a36353 /indoteknik_custom/models/uangmuka_pembelian.py | |
| parent | ac997ef851c9e1ce6d061a68951051f0b916b534 (diff) | |
change request uang muka purchase order
Diffstat (limited to 'indoteknik_custom/models/uangmuka_pembelian.py')
| -rw-r--r-- | indoteknik_custom/models/uangmuka_pembelian.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/indoteknik_custom/models/uangmuka_pembelian.py b/indoteknik_custom/models/uangmuka_pembelian.py index e3ce4a20..3ae8d3fb 100644 --- a/indoteknik_custom/models/uangmuka_pembelian.py +++ b/indoteknik_custom/models/uangmuka_pembelian.py @@ -24,8 +24,6 @@ class UangmukaPembelian(models.TransientModel): o.total_amt = o.pay_amt + o.ongkir_amt + o.selisih_amt def create_uangmukapembelian(self): - if self.pay_amt <= 0: - raise UserError('Payment Amount harus diisi') if not self.account_id: raise UserError('Bank Intransit harus diisi') if not self.env.user.is_accounting: @@ -41,6 +39,12 @@ class UangmukaPembelian(models.TransientModel): is_have_selisih = True for order in orders: + if order.is_create_uangmuka == True: + action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_purchase_order_multi_uangmuka2') + action['context'] = { + 'order_ids': [x.id for x in order] + } + return action partner_name = order.partner_id.name if order.partner_id.parent_id: partner_name = order.partner_id.parent_id.name @@ -95,7 +99,7 @@ class UangmukaPembelian(models.TransientModel): 'credit': self.pay_amt + self.ongkir_amt + self.selisih_amt, 'name': ref_label, } - if is_have_ongkir and is_have_selisih: + if is_have_ongkir and is_have_selisih: request.env['account.move.line'].create([param_debit, param_debit_ongkir, param_debit_selisih, param_credit]) elif is_have_ongkir: request.env['account.move.line'].create([param_debit, param_debit_ongkir, param_credit]) @@ -103,6 +107,7 @@ class UangmukaPembelian(models.TransientModel): request.env['account.move.line'].create([param_debit, param_debit_selisih, param_credit]) else: request.env['account.move.line'].create([param_debit, param_credit]) + order.is_create_uangmuka = True return { 'name': _('Journal Entries'), 'view_mode': 'form', |
