-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathres_config.py
More file actions
62 lines (55 loc) · 2.43 KB
/
Copy pathres_config.py
File metadata and controls
62 lines (55 loc) · 2.43 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2015 XCG Consulting (http://www.xcg-consulting.fr/)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import logging
from openerp.osv import fields, osv
from openerp.tools.translate import _
_logger = logging.getLogger(__name__)
class account_streamline_configuration(osv.TransientModel):
#_name = 'account_streamline.config.settings'
_inherit = 'account.config.settings'
_columns = {
'allow_duplicate_ref_on_account_move_same_account': fields.boolean(
"Allow duplicate (reference, account) on journals",
),
}
def get_default_allow_duplicate_ref_on_account_move_same_account(
self, cr, uid, fields, context=None
):
res = {}
user = self.pool['res.users'].browse(cr, uid, uid, context)
res['allow_duplicate_ref_on_account_move_same_account'] = \
user.company_id.allow_duplicate_ref_on_account_move_same_account
return res
def set_allow_duplicate_ref_on_account_move_same_account(
self, cr, uid, ids, context=None
):
"""Set this on the company of the user
"""
user = self.pool['res.users'].browse(cr, uid, uid, context)
company_id = user.company_id.id
company_osv = self.pool['res.company']
config_brl = self.browse(cr, uid, ids, context)
for config_br in config_brl:
val = {
'allow_duplicate_ref_on_account_move_same_account':
config_br.allow_duplicate_ref_on_account_move_same_account,
}
company_osv.write(cr, uid, company_id, val, context=context)