Merge lp:~julie-w/unifield-server/US-7251 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5681
Proposed branch: lp:~julie-w/unifield-server/US-7251
Merge into: lp:unifield-server
Diff against target: 61 lines (+35/-0)
3 files modified
bin/addons/base/res/res_company.py (+1/-0)
bin/addons/msf_audittrail/__openerp__.py (+1/-0)
bin/addons/msf_audittrail/data/audittrail_res_company.yml (+33/-0)
To merge this branch: bzr merge lp:~julie-w/unifield-server/US-7251
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+382635@code.launchpad.net
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/addons/base/res/res_company.py'
2--- bin/addons/base/res/res_company.py 2016-01-06 16:57:55 +0000
3+++ bin/addons/base/res/res_company.py 2020-04-21 07:54:44 +0000
4@@ -73,6 +73,7 @@
5 _name = "res.company"
6 _description = 'Companies'
7 _order = 'name'
8+ _trace = True
9 _columns = {
10 'name': fields.char('Company Name', size=64, required=True),
11 'parent_id': fields.many2one('res.company', 'Parent Company', select=True),
12
13=== modified file 'bin/addons/msf_audittrail/__openerp__.py'
14--- bin/addons/msf_audittrail/__openerp__.py 2020-02-04 13:51:57 +0000
15+++ bin/addons/msf_audittrail/__openerp__.py 2020-04-21 07:54:44 +0000
16@@ -56,6 +56,7 @@
17 'data/audittrail_account_journal.yml',
18 'data/audittrail_account_account.yml',
19 'data/audittrail_account_tax.yml',
20+ 'data/audittrail_res_company.yml',
21 'audittrail_report.xml',
22 'audittrail_invoice_data.yml',
23 ],
24
25=== added file 'bin/addons/msf_audittrail/data/audittrail_res_company.yml'
26--- bin/addons/msf_audittrail/data/audittrail_res_company.yml 1970-01-01 00:00:00 +0000
27+++ bin/addons/msf_audittrail/data/audittrail_res_company.yml 2020-04-21 07:54:44 +0000
28@@ -0,0 +1,33 @@
29+-
30+ For the Company (res.company), track the creation and modification
31+-
32+ !python {model: audittrail.rule}: |
33+ name = 'Company'
34+ object_ids = self.pool.get('ir.model').search(cr, uid, [('model', '=', 'res.company')], context=context)
35+ rule_id = self.search(cr, uid, [('object_id', 'in', object_ids)], context=context)
36+ if object_ids:
37+ fields = ['name', 'partner_id', 'instance_id', 'counterpart_hq_entries_default_account', 'property_reserve_and_surplus_account',
38+ 'salaries_default_account', 'import_invoice_default_account', 'intermission_default_counterpart', 'additional_allocation',
39+ 'revaluation_default_account', 'ye_pl_cp_for_bs_debit_bal_account', 'ye_pl_cp_for_bs_credit_bal_account',
40+ 'ye_pl_pos_credit_account', 'ye_pl_ne_credit_account', 'ye_pl_pos_debit_account', 'ye_pl_ne_debit_account',
41+ 'currency_date_type', 'currency_date_beginning', 'schedule_range', 'shipment_lead_time', 'preparation_lead_time',
42+ 'cheque_debit_account_id', 'cheque_credit_account_id', 'bank_debit_account_id', 'bank_credit_account_id',
43+ 'cash_debit_account_id', 'cash_credit_account_id']
44+
45+ fields_ids = self.pool.get('ir.model.fields').search(cr, uid, [('model', '=', 'res.company'), ('name', 'in', fields)], context=context)
46+
47+ vals = {
48+ 'name': name,
49+ 'object_id': object_ids[0],
50+ 'log_write': True,
51+ 'log_create': True,
52+ 'log_unlink': False,
53+ 'field_ids': [(6, 0, fields_ids)],
54+ }
55+
56+ if not rule_id:
57+ rule_id = self.create(cr, uid, vals, context=context)
58+ elif rule_id:
59+ self.write(cr, uid, rule_id, vals, context=context)
60+ # Subscribe to the rule
61+ self.subscribe(cr, uid, rule_id)

Subscribers

People subscribed via source and target branches