diff options
| -rw-r--r-- | indoteknik_custom/models/account_move.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move.py b/indoteknik_custom/models/account_move.py index 85ed1d54..7760c69d 100644 --- a/indoteknik_custom/models/account_move.py +++ b/indoteknik_custom/models/account_move.py @@ -65,6 +65,13 @@ class AccountMove(models.Model): other_subtotal = fields.Float(string="Other Subtotal", compute='compute_other_subtotal') other_taxes = fields.Float(string="Other Taxes", compute='compute_other_taxes') + def _update_line_name_from_ref(self): + """Update all account.move.line name fields with ref from account.move""" + for move in self: + if move.move_type == 'entry' and move.ref and move.line_ids: + for line in move.line_ids: + line.name = move.ref + def compute_other_taxes(self): for rec in self: rec.other_taxes = rec.other_subtotal * 0.12 @@ -107,6 +114,7 @@ class AccountMove(models.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) + result._update_line_name_from_ref() return result def compute_so_shipping_paid_by(self): |
