diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-31 11:51:50 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-08-31 11:51:50 +0700 |
| commit | b7dba2d8eed3c2af22dca53a916f12e9b842c2aa (patch) | |
| tree | 3ca984df1c729378f463cedef6f6e7c95ec591da /indoteknik_custom/models/account_move_line.py | |
| parent | 403b86d1a3cc168680069b0d8fc499048583da8f (diff) | |
coa cost centre
Diffstat (limited to 'indoteknik_custom/models/account_move_line.py')
| -rw-r--r-- | indoteknik_custom/models/account_move_line.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/indoteknik_custom/models/account_move_line.py b/indoteknik_custom/models/account_move_line.py new file mode 100644 index 00000000..87e5a182 --- /dev/null +++ b/indoteknik_custom/models/account_move_line.py @@ -0,0 +1,22 @@ +from odoo import models, api, fields + + +class AccountMoveLine(models.Model): + _inherit = "account.move.line" + + cost_centre_id = fields.Many2one('cost.centre', string='Cost Centre') + is_required = fields.Boolean(string='Is Required', compute='_compute_is_required') + + @api.onchange('account_id') + def _compute_is_required(self): + for account in self: + if account.account_id.code and account.account_id.code[0] in ['6', '7']: + account.is_required = True + else: + account.is_required = False + + @api.onchange('account_id') + def _onchange_cost_centre_id(self): + for account in self: + cost_centre = account.account_id.cost_centre_id + account.cost_centre_id = cost_centre |
