diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-09-06 13:59:28 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-09-06 13:59:28 +0700 |
| commit | 4986c63d2a6bd8e2feadbd2403a211b0b0cf405f (patch) | |
| tree | b80d2d415b887a7ab66c9d55d5a4857d34142bea /indoteknik_custom/models/account_move_line.py | |
| parent | ea48748650d1abe7b9c09f961eaa3762750e21be (diff) | |
| parent | e07379886024a313695a56ebdd072bfd87b6626a (diff) | |
Merge branch 'production' into feature/voucher-group
Diffstat (limited to 'indoteknik_custom/models/account_move_line.py')
| -rw-r--r-- | indoteknik_custom/models/account_move_line.py | 24 |
1 files changed, 24 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..a4b25109 --- /dev/null +++ b/indoteknik_custom/models/account_move_line.py @@ -0,0 +1,24 @@ +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') + analytic_account_ids = fields.Many2many('account.analytic.account', string='Analytic Account') + + @api.onchange('account_id') + def _onchange_account_id(self): + for account in self: + analytic_account = account.account_id.analytic_tag_ids + account.analytic_tag_ids = analytic_account + + @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 + |
