From b7dba2d8eed3c2af22dca53a916f12e9b842c2aa Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Thu, 31 Aug 2023 11:51:50 +0700 Subject: coa cost centre --- indoteknik_custom/models/account_move_line.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 indoteknik_custom/models/account_move_line.py (limited to 'indoteknik_custom/models/account_move_line.py') 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 -- cgit v1.2.3 From 41e76bb5b668473c8086ba82ea8f405315b8e5ae Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 1 Sep 2023 10:31:23 +0700 Subject: change cost_centre to analytic_account --- indoteknik_custom/models/account_move_line.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'indoteknik_custom/models/account_move_line.py') diff --git a/indoteknik_custom/models/account_move_line.py b/indoteknik_custom/models/account_move_line.py index 87e5a182..cb969855 100644 --- a/indoteknik_custom/models/account_move_line.py +++ b/indoteknik_custom/models/account_move_line.py @@ -6,6 +6,13 @@ class AccountMoveLine(models.Model): 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_analytic_account_ids(self): + for account in self: + analytic_account = account.account_id.analytic_account_ids + account.analytic_account_ids = analytic_account @api.onchange('account_id') def _compute_is_required(self): @@ -14,9 +21,4 @@ class AccountMoveLine(models.Model): 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 + -- cgit v1.2.3 From 513bce9e13dee0453ce24b41a54d3b408e58c7f0 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 5 Sep 2023 14:45:18 +0700 Subject: Fix bug solr product variants, add analytic tags to jurnal entries line, remove validation edit di purchase pricelist --- indoteknik_custom/models/account_move_line.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'indoteknik_custom/models/account_move_line.py') diff --git a/indoteknik_custom/models/account_move_line.py b/indoteknik_custom/models/account_move_line.py index cb969855..c230b956 100644 --- a/indoteknik_custom/models/account_move_line.py +++ b/indoteknik_custom/models/account_move_line.py @@ -6,13 +6,12 @@ class AccountMoveLine(models.Model): 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_analytic_account_ids(self): for account in self: - analytic_account = account.account_id.analytic_account_ids - account.analytic_account_ids = analytic_account + analytic_account = account.account_id.analytic_tag_ids + account.analytic_tag_ids = analytic_account @api.onchange('account_id') def _compute_is_required(self): -- cgit v1.2.3 From e07379886024a313695a56ebdd072bfd87b6626a Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Tue, 5 Sep 2023 16:19:20 +0700 Subject: try to fix bug on odoo --- indoteknik_custom/models/account_move_line.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indoteknik_custom/models/account_move_line.py') diff --git a/indoteknik_custom/models/account_move_line.py b/indoteknik_custom/models/account_move_line.py index c230b956..a4b25109 100644 --- a/indoteknik_custom/models/account_move_line.py +++ b/indoteknik_custom/models/account_move_line.py @@ -6,9 +6,10 @@ class AccountMoveLine(models.Model): 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_analytic_account_ids(self): + def _onchange_account_id(self): for account in self: analytic_account = account.account_id.analytic_tag_ids account.analytic_tag_ids = analytic_account -- cgit v1.2.3