/
company.py
32 lines (27 loc) · 1.4 KB
/
company.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-
# © 2016 Eficent Business and IT Consulting Services S.L.
# - Jordi Ballester Alomar
# © 2016 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from openerp import api, fields, models
from openerp.tools.translate import _
from openerp.exceptions import UserError
class ResCompany(models.Model):
_inherit = 'res.company'
inter_ou_clearing_account_id = fields.Many2one('account.account',
'Inter-operating unit\
clearing account')
ou_is_self_balanced = fields.Boolean('Operating Units are self-balanced',
help="Activate if your company is "
"required to generate a balanced"
" balance sheet for each "
"operating unit.",
default=False)
@api.multi
@api.constrains('ou_is_self_balanced')
def _inter_ou_clearing_acc_required(self):
for rec in self:
if rec.ou_is_self_balanced and not \
rec.inter_ou_clearing_account_id:
raise UserError(_('Configuration error!\nPlease indicate an\
Inter-operating unit clearing account.'))