summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-08-31 11:51:50 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-08-31 11:51:50 +0700
commitb7dba2d8eed3c2af22dca53a916f12e9b842c2aa (patch)
tree3ca984df1c729378f463cedef6f6e7c95ec591da /indoteknik_custom/models
parent403b86d1a3cc168680069b0d8fc499048583da8f (diff)
coa cost centre
Diffstat (limited to 'indoteknik_custom/models')
-rwxr-xr-xindoteknik_custom/models/__init__.py3
-rw-r--r--indoteknik_custom/models/account_account.py6
-rw-r--r--indoteknik_custom/models/account_move_line.py22
-rw-r--r--indoteknik_custom/models/cost_centre.py11
4 files changed, 42 insertions, 0 deletions
diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py
index cf2597b0..b8be14ba 100755
--- a/indoteknik_custom/models/__init__.py
+++ b/indoteknik_custom/models/__init__.py
@@ -85,3 +85,6 @@ from . import base_import_import
from . import product_attribute
from . import mrp_production
from . import solr
+from . import cost_centre
+from . import account_account
+from . import account_move_line
diff --git a/indoteknik_custom/models/account_account.py b/indoteknik_custom/models/account_account.py
new file mode 100644
index 00000000..584c38f8
--- /dev/null
+++ b/indoteknik_custom/models/account_account.py
@@ -0,0 +1,6 @@
+from odoo import fields, models, api, _
+
+class AccountAccount(models.Model):
+ _inherit = 'account.account'
+
+ cost_centre_id = fields.Many2one('cost.centre', string='Cost Centre') \ No newline at end of file
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
diff --git a/indoteknik_custom/models/cost_centre.py b/indoteknik_custom/models/cost_centre.py
new file mode 100644
index 00000000..eaf518d5
--- /dev/null
+++ b/indoteknik_custom/models/cost_centre.py
@@ -0,0 +1,11 @@
+from odoo import fields, models, api
+from datetime import datetime, timedelta
+import logging
+
+_logger = logging.getLogger(__name__)
+
+
+class CostCentre(models.Model):
+ _name = 'cost.centre'
+ name = fields.Char(string="Name")
+ description = fields.Text(string="Description")