Merge lp:~unifield-team/unifield-wm/us-348-reset-copy-data into lp:unifield-wm

Proposed by jftempo
Status: Merged
Merged at revision: 2541
Proposed branch: lp:~unifield-team/unifield-wm/us-348-reset-copy-data
Merge into: lp:unifield-wm
Diff against target: 70 lines (+27/-4)
3 files modified
analytic_distribution/analytic_account.py (+18/-0)
financing_contract/contract.py (+4/-1)
register_accounting/account_bank_statement.py (+5/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/us-348-reset-copy-data
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+261739@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 'analytic_distribution/analytic_account.py'
2--- analytic_distribution/analytic_account.py 2014-03-14 09:40:12 +0000
3+++ analytic_distribution/analytic_account.py 2015-06-11 15:09:01 +0000
4@@ -31,6 +31,24 @@
5 _name = "account.analytic.account"
6 _inherit = "account.analytic.account"
7
8+
9+ def copy_data(self, cr, uid, a_id, default=None, context=None):
10+ """
11+ Copy global distribution and give it to new invoice line
12+ """
13+ # Some verifications
14+ if not context:
15+ context = {}
16+ if not default:
17+ default = {}
18+
19+ #US-348: Reset some values when duplicating an analytic account
20+ default['tuple_destination_account_ids'] = []
21+ default['destination_ids'] = []
22+
23+ # Copy analytic distribution
24+ return super(analytic_account, self).copy_data(cr, uid, a_id, default, context)
25+
26 def _get_active(self, cr, uid, ids, field_name, args, context=None):
27 '''
28 If date out of date_start/date of given analytic account, then account is inactive.
29
30=== modified file 'financing_contract/contract.py'
31--- financing_contract/contract.py 2015-06-03 12:42:43 +0000
32+++ financing_contract/contract.py 2015-06-11 15:09:01 +0000
33@@ -69,7 +69,10 @@
34 result = super(financing_contract_funding_pool_line, self).create(cr, uid, vals, context=context)
35 # when a new funding pool is added to contract, then add all of the cost centers to the cost center tab, unless
36 # the cost center is already there. No action is taken when a cost center is deleted
37- if 'contract_id' in vals and 'funding_pool_id' in vals:
38+
39+ #US-345: the following block cannot be executed in the sync context, because it would then reset all costcenters from the funding pools!
40+ # making that the deleted costcenters from the sender were not taken into account
41+ if not context.get('sync_update_execution') and 'contract_id' in vals and 'funding_pool_id' in vals:
42 # get the cc ids from for this funding pool
43 quad_obj = self.pool.get('financing.contract.account.quadruplet')
44 quad_ids = quad_obj.search(cr, uid, [('funding_pool_id','=',vals['funding_pool_id'])],context=context)
45
46=== modified file 'register_accounting/account_bank_statement.py'
47--- register_accounting/account_bank_statement.py 2015-06-04 16:46:25 +0000
48+++ register_accounting/account_bank_statement.py 2015-06-11 15:09:01 +0000
49@@ -1906,7 +1906,8 @@
50 # Then update analytic distribution
51 res = []
52 must_return = False
53- if 'employee_id' or 'partner_type' in values:
54+ # US-351: fixed the wrong condition
55+ if 'employee_id' in values or 'partner_type' in values:
56 must_return = True
57 for line in self.read(cr, uid, ids, ['analytic_distribution_id', 'account_id', 'statement_id', 'first_move_line_id', 'move_ids']):
58 account_id = line.get('account_id')[0]
59@@ -1922,8 +1923,9 @@
60 tmp = super(account_bank_statement_line, self).write(cr, uid, line.get('id'), values, context=context)
61 res.append(tmp)
62
63- new_distrib = values.get('analytic_distribution_id', False)
64- if old_distrib != new_distrib and line.get('first_move_line_id', False) and line.get('move_ids', False):
65+ new_distrib = values.get('analytic_distribution_id', False)
66+ # US-351: Fixed the wrong condition
67+ if new_distrib and old_distrib != new_distrib and line.get('first_move_line_id', False) and line.get('move_ids', False):
68 first_move_line_id = line.get('first_move_line_id')[0]
69 move_ids = line.get('move_ids')[0]
70 if isinstance(move_ids, (int, long)):

Subscribers

People subscribed via source and target branches