From 901ab091308ec3d575014a7c0540a0cf544702b7 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 23 Apr 2024 15:04:57 +0700 Subject: add new ir_sequence for account move --- indoteknik_custom/models/account_move.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 94a1ab19..22b637e9 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -57,6 +57,33 @@ class AccountMove(models.Model): is_efaktur_uploaded = fields.Boolean(string="Is eFaktur Uploaded", default=False) already_paid = fields.Boolean(string="Sudah Dibayar?", default=False) delivery_amt_text = fields.Char(string="Delivery Amt Terbilang", compute='compute_delivery_amt_text') + so_shipping_paid_by = fields.Char(string="SO Shipping Paid By", compute='compute_so_shipping_paid_by') + so_shipping_covered_by = fields.Char(string="SO Shipping Covered By", compute='compute_so_shipping_paid_by') + 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") + + @api.model + def create(self, vals): + if vals['flag_delivery_amt'] == True: + vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' + else: + vals['nomor_kwitansi'] = None + result = super(AccountMove, self).create(vals) + return result + + def compute_so_shipping_paid_by(self): + for record in self: + record.so_shipping_paid_by = record.sale_id.shipping_paid_by + record.so_shipping_covered_by = record.sale_id.shipping_cost_covered + record.so_delivery_amt = record.sale_id.delivery_amt + + def compute_flag_delivery_amt(self): + for record in self: + if record.sale_id.delivery_amt > 0: + record.flag_delivery_amt = True + else: + record.flag_delivery_amt = False def compute_delivery_amt_text(self): tb = Terbilang() -- cgit v1.2.3 From a88d0c0fb126813e97f6e9bb7c51afee61e3dae2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 23 Apr 2024 15:12:05 +0700 Subject: fix bug account move --- indoteknik_custom/models/account_move.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 22b637e9..5afd174f 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -65,7 +65,7 @@ class AccountMove(models.Model): @api.model def create(self, vals): - if vals['flag_delivery_amt'] == True: + if 'flag_delivery_amt' in vals and vals['flag_delivery_amt']: vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' else: vals['nomor_kwitansi'] = None -- cgit v1.2.3 From 68c7f85b0bf7b8eb85f5bbffcfe2bbc8a38b7e4e Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 24 Apr 2024 13:45:43 +0700 Subject: update purchasing job --- indoteknik_custom/models/account_move.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'indoteknik_custom/models/account_move.py') diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 5afd174f..b306b6af 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -65,10 +65,7 @@ class AccountMove(models.Model): @api.model def create(self, vals): - if 'flag_delivery_amt' in vals and vals['flag_delivery_amt']: - vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' - else: - vals['nomor_kwitansi'] = None + vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' result = super(AccountMove, self).create(vals) return result -- cgit v1.2.3