diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2024-04-29 09:24:25 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2024-04-29 09:24:25 +0700 |
| commit | 074b99031f5123976bb67aab1cf1a6286464e724 (patch) | |
| tree | 2809d42a13b35c42ec00d93a40a414e7713a1bc2 /indoteknik_custom/models/account_move.py | |
| parent | b5a42eda62ae2b3536a072b9cb21a61e91a7b49a (diff) | |
| parent | ca03f0119e33dd62adbf998106378d8e0f4096b6 (diff) | |
Merge branch 'production' into feature/request-by-abl
Diffstat (limited to 'indoteknik_custom/models/account_move.py')
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 94a1ab19..b306b6af 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -57,6 +57,30 @@ 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): + vals['nomor_kwitansi'] = self.env['ir.sequence'].next_by_code('nomor.kwitansi') or '0' + 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() |
