Merge lp:~jfb-tempo-consulting/unifield-server/us-7620 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 5748
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/us-7620
Merge into: lp:unifield-server
Diff against target: 80 lines (+22/-15)
2 files modified
bin/addons/account_reconciliation/account_move_line.py (+12/-1)
bin/osv/fields.py (+10/-14)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/us-7620
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+386604@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/account_reconciliation/account_move_line.py'
2--- bin/addons/account_reconciliation/account_move_line.py 2020-01-06 17:20:47 +0000
3+++ bin/addons/account_reconciliation/account_move_line.py 2020-06-30 15:41:33 +0000
4@@ -605,7 +605,7 @@
5 if p or t:
6 sql_params = [name, tuple(p+t)]
7 new_field = ""
8- if prev is not None and not context.get('sync_update_execution'):
9+ if prev is not None:
10 self.pool.get('account.move.line').log_reconcile(cr, uid, r, previous=prev, rec_name=name, context=context)
11 if context.get('sync_update_execution') and t:
12 if action_date:
13@@ -634,6 +634,7 @@
14 prev = {}
15 aml_ids = []
16
17+ new_vals = {}
18 # use one2many codification (x,values) to get account.move.line tied to this new rec
19 # x=5 to delete existing links is ignored as we are in create mode
20 for rec_type in ['line_id', 'line_partial_ids']:
21@@ -641,8 +642,15 @@
22 for x in vals.get(rec_type):
23 if x[0] in (1, 2, 3, 4):
24 aml_ids.append(x[1])
25+ if context.get('sync_update_execution'):
26+ new_vals.setdefault(rec_type, []).append(x)
27 elif x[0] == 6:
28 aml_ids += x[2]
29+ if context.get('sync_update_execution') and x[2]:
30+ new_vals.setdefault(rec_type, []).append((7, x[2]))
31+
32+ if new_vals:
33+ vals.update(new_vals)
34
35 # get previous reconcile from _txt
36 already_reconciled = []
37@@ -663,6 +671,9 @@
38 if isinstance(res, (int, long)):
39 tmp_res = [tmp_res]
40 self.common_create_write(cr, uid, tmp_res, vals.get('action_date'), prev=prev, context=context)
41+
42+ if context.get('sync_update_execution'):
43+ self.pool.get('account.move.line').reconciliation_update(cr, uid, [res], context=context)
44 return res
45
46 def write(self, cr, uid, ids, vals, context=None):
47
48=== modified file 'bin/osv/fields.py'
49--- bin/osv/fields.py 2020-05-04 08:13:23 +0000
50+++ bin/osv/fields.py 2020-06-30 15:41:33 +0000
51@@ -554,20 +554,16 @@
52 elif act[0] == 5:
53 cr.execute('update '+_table+' set '+self._fields_id+'=null where '+self._fields_id+'=%s', (id,)) # not_a_user_entry
54 elif act[0] == 6:
55- if self._obj == 'account.move.line' and self._fields_id == 'reconcile_id':
56- # FXA may be created during write on account.move.line
57- # but reconcile_id on the FXA must not be deleted by the last line ({self._fields_id:False})
58- ids2 = act[2] or [0]
59- cr.execute('select id from '+_table+' where '+self._fields_id+'=%s and id <> ALL (%s)', (id,ids2)) # not_a_user_entry
60- ids3 = map(lambda x:x[0], cr.fetchall())
61- obj.write(cr, user, act[2], {self._fields_id:id}, context=context or {})
62- obj.write(cr, user, ids3, {self._fields_id:False}, context=context or {})
63- else:
64- obj.write(cr, user, act[2], {self._fields_id:id}, context=context or {})
65- ids2 = act[2] or [0]
66- cr.execute('select id from '+_table+' where '+self._fields_id+'=%s and id <> ALL (%s)', (id,ids2)) # not_a_user_entry
67- ids3 = map(lambda x:x[0], cr.fetchall())
68- obj.write(cr, user, ids3, {self._fields_id:False}, context=context or {})
69+ obj.write(cr, user, act[2], {self._fields_id:id}, context=context or {})
70+ ids2 = act[2] or [0]
71+ cr.execute('select id from '+_table+' where '+self._fields_id+'=%s and id <> ALL (%s)', (id,ids2)) # not_a_user_entry
72+ ids3 = map(lambda x:x[0], cr.fetchall())
73+ obj.write(cr, user, ids3, {self._fields_id:False}, context=context or {})
74+ elif act[0] == 7:
75+ # same a (4, id1), (4, id2), (4, id3) ... but with a single SQL query
76+ if isinstance(act[1], (int, long)):
77+ act[1] = [act[1]]
78+ cr.execute('update '+_table+' set '+self._fields_id+'=%s where id in %s', (id, tuple(act[1]))) # not_a_user_entry
79
80 return result
81

Subscribers

People subscribed via source and target branches