Merge lp:~unifield-team/unifield-server/us-533 into lp:unifield-server
- us-533
- Merge into trunk
Proposed by
jftempo
Status: | Merged |
---|---|
Merged at revision: | 3912 |
Proposed branch: | lp:~unifield-team/unifield-server/us-533 |
Merge into: | lp:unifield-server |
Diff against target: |
540 lines (+201/-28) 16 files modified
bin/addons/account/account_move_line.py (+3/-0) bin/addons/account/report/account_general_ledger.py (+41/-11) bin/addons/account/wizard/account_report_account_balance.py (+10/-1) bin/addons/account/wizard/account_report_account_balance_view.xml (+3/-0) bin/addons/account/wizard/account_report_general_ledger.py (+10/-4) bin/addons/account/wizard/account_report_general_ledger_view.xml (+3/-1) bin/addons/account_mcdb/account_mcdb.py (+10/-2) bin/addons/account_mcdb/account_mcdb_view.xml (+4/-2) bin/addons/account_mcdb/account_view.xml (+4/-1) bin/addons/account_mcdb/report/account_mcdb_export.py (+3/-1) bin/addons/account_mcdb/report/report_account_move_line.rml (+6/-0) bin/addons/account_mcdb/report/report_account_move_line_xls.mako (+10/-1) bin/addons/account_reconciliation/account.py (+4/-2) bin/addons/account_reconciliation/account_move_line.py (+59/-0) bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv (+2/-2) bin/addons/msf_tools/msf_tools.py (+29/-0) |
To merge this branch: | bzr merge lp:~unifield-team/unifield-server/us-533 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
UniField Reviewer Team | Pending | ||
Review via email: mp+302438@code.launchpad.net |
Commit message
Description of the change
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/account_move_line.py' |
2 | --- bin/addons/account/account_move_line.py 2016-06-08 09:08:11 +0000 |
3 | +++ bin/addons/account/account_move_line.py 2016-08-09 15:43:17 +0000 |
4 | @@ -1135,6 +1135,9 @@ |
5 | unlink_ids += part_rec_ids |
6 | if unlink_ids: |
7 | obj_move_rec.unlink(cr, uid, unlink_ids) |
8 | + obj_move_line.write(cr, uid, move_ids, { |
9 | + 'reconcile_date': False, # US-533 reset reconcilation date |
10 | + }, context=context) |
11 | return True |
12 | |
13 | def check_unlink(self, cr, uid, ids, context=None): |
14 | |
15 | === modified file 'bin/addons/account/report/account_general_ledger.py' |
16 | --- bin/addons/account/report/account_general_ledger.py 2016-05-26 15:01:18 +0000 |
17 | +++ bin/addons/account/report/account_general_ledger.py 2016-08-09 15:43:17 +0000 |
18 | @@ -107,11 +107,33 @@ |
19 | self.title = _('Trial Balance') |
20 | |
21 | self.account_ids = self._get_data_form(data, 'account_ids') or [] |
22 | - # unreconciled: not reconciled or partial reconciled |
23 | - # (partial: reconcile_partia_id set vs reconcile_id) |
24 | - self.unreconciled_filter = \ |
25 | - self._get_data_form(data, 'unreconciled', False) \ |
26 | - and " AND reconcile_id is null AND a.reconcile='t'" or '' |
27 | + |
28 | + # US-533 reconciled filter: |
29 | + # decision matrix |
30 | + # http://jira.unifield.org/browse/US-533?focusedCommentId=50246&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50246 |
31 | + reconcile_date = self._get_data_form(data, 'reconcile_date', False) |
32 | + reconciled = self._get_data_form(data, 'reconciled', 'empty') |
33 | + self.reconciled_filter = '' |
34 | + if reconciled == 'empty': |
35 | + # no reconcile criteria: get rid of reconcile date filter |
36 | + if reconcile_date: |
37 | + del data['form']['reconcile_date'] |
38 | + reconcile_date = False |
39 | + elif reconciled == 'no': |
40 | + # reconcile 'No' filter: become reconciled since (day+1) |
41 | + # or not reconciled (cases 6/9 of Jira comment matrix) |
42 | + not_reconciled = "l.reconcile_id is null AND a.reconcile='t'" |
43 | + if reconcile_date: |
44 | + self.reconciled_filter = \ |
45 | + " AND (l.reconcile_date > '%s' or (%s))" % ( |
46 | + reconcile_date, not_reconciled, ) |
47 | + else: |
48 | + self.reconciled_filter = " AND %s" % (not_reconciled, ) |
49 | + elif reconciled == 'yes': |
50 | + self.reconciled_filter = " AND l.reconcile_id is not null" |
51 | + if reconcile_date: |
52 | + self.reconciled_filter += " AND l.reconcile_date <= '%s'" % ( |
53 | + reconcile_date, ) |
54 | |
55 | self.context['state'] = data['form']['target_move'] |
56 | |
57 | @@ -161,8 +183,8 @@ |
58 | self.cr, self.uid, self.account_ids) |
59 | |
60 | query = self.query |
61 | - if self.unreconciled_filter: |
62 | - query += self.unreconciled_filter |
63 | + if self.reconciled_filter: |
64 | + query += self.reconciled_filter |
65 | |
66 | move_states = [ 'posted', ] if self.target_move == 'posted' \ |
67 | else [ 'draft', 'posted', ] |
68 | @@ -171,7 +193,7 @@ |
69 | include_accounts=self.account_ids, |
70 | account_report_types=self.account_report_types, |
71 | with_balance_only=self.display_account == 'bal_solde', |
72 | - reconcile_filter=self.unreconciled_filter, |
73 | + reconcile_filter=self.reconciled_filter, |
74 | context=used_context) |
75 | |
76 | return res |
77 | @@ -248,7 +270,7 @@ |
78 | if node.is_zero \ |
79 | and (self.account_ids |
80 | or self.account_report_types |
81 | - or self.unreconciled_filter |
82 | + or self.reconciled_filter |
83 | or self.display_account == 'bal_movement'): |
84 | # hide zero amounts for above filters on |
85 | # no movements <=> no amount |
86 | @@ -332,7 +354,7 @@ |
87 | JOIN account_account a on (a.id=l.account_id) |
88 | WHERE %s AND m.state IN %s AND l.account_id = %%s{{reconcile}} ORDER by %s |
89 | """ %(self.query, move_state_in, sql_sort) |
90 | - sql = sql.replace('{{reconcile}}', self.unreconciled_filter) |
91 | + sql = sql.replace('{{reconcile}}', self.reconciled_filter) |
92 | self.cr.execute(sql, (account.id, )) |
93 | res = self.cr.dictfetchall() |
94 | else: |
95 | @@ -417,6 +439,14 @@ |
96 | if line: |
97 | infos.append(line) |
98 | |
99 | + # reconcile / reconcile date |
100 | + reconciled = self._get_data_form(data, 'reconciled') |
101 | + if reconciled and reconciled != 'empty': |
102 | + dt = self._get_data_form(data, 'reconcile_date') |
103 | + if dt: |
104 | + dt = ' ' + self.formatLang(dt, date=True) |
105 | + infos.append(_("Reconcile %s%s") % (reconciled.title(), dt or '', )) |
106 | + |
107 | return infos and ", \n".join(infos) or _('No Filter') |
108 | |
109 | def _get_line_debit(self, line, booking=False): |
110 | @@ -489,7 +519,7 @@ |
111 | |
112 | # reconciled account |
113 | info_data.append((_('Unreconciled'), |
114 | - self.unreconciled_filter and yes_str or no_str, )) |
115 | + self.reconciled_filter and yes_str or no_str, )) |
116 | |
117 | display_account = all_str |
118 | if 'display_account' in data['form']: |
119 | |
120 | === modified file 'bin/addons/account/wizard/account_report_account_balance.py' |
121 | --- bin/addons/account/wizard/account_report_account_balance.py 2016-05-23 13:52:38 +0000 |
122 | +++ bin/addons/account/wizard/account_report_account_balance.py 2016-08-09 15:43:17 +0000 |
123 | @@ -39,6 +39,14 @@ |
124 | ('bl','Balance Sheet'), |
125 | ], 'B/S / P&L account', required=True), |
126 | |
127 | + 'reconciled': fields.selection([ |
128 | + ('empty', ''), |
129 | + ('yes', 'Yes'), |
130 | + ('no', 'No'), |
131 | + ], "Reconciled", |
132 | + help="filter will apply only on the B/S accounts except for the non reconciliable account like 10100 and 10200 which will never be displayed per details"), |
133 | + 'reconcile_date': fields.date("At"), |
134 | + |
135 | 'account_ids': fields.many2many('account.account', |
136 | 'account_report_general_ledger_account_account_rel', |
137 | 'report_id', 'account_id', 'Accounts'), |
138 | @@ -58,6 +66,7 @@ |
139 | 'initial_balance': False, |
140 | 'export_format': 'pdf', |
141 | 'account_type': 'all', |
142 | + 'reconciled': 'empty', |
143 | 'journal_ids': _get_journals, |
144 | 'display_account': 'bal_movement', # by default only result with JIs |
145 | } |
146 | @@ -86,7 +95,7 @@ |
147 | |
148 | data['form']['initial_balance'] = False |
149 | form_fields = [ 'initial_balance', 'instance_ids', 'export_format', |
150 | - 'account_type', 'account_ids', ] |
151 | + 'account_type', 'account_ids', 'reconciled', 'reconcile_date', ] |
152 | data['form'].update(self.read(cr, uid, ids, form_fields)[0]) |
153 | |
154 | if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record |
155 | |
156 | === modified file 'bin/addons/account/wizard/account_report_account_balance_view.xml' |
157 | --- bin/addons/account/wizard/account_report_account_balance_view.xml 2016-03-23 14:52:23 +0000 |
158 | +++ bin/addons/account/wizard/account_report_account_balance_view.xml 2016-08-09 15:43:17 +0000 |
159 | @@ -24,6 +24,9 @@ |
160 | <newline/> |
161 | <field name="account_type" /> |
162 | <newline/> |
163 | + <field name="reconciled" /> |
164 | + <field name="reconcile_date" /> |
165 | + <newline/> |
166 | <field name="instance_ids" domain="[('instance_to_display_ids','=',True)]"> |
167 | <tree noteditable="1" editable="top" string="Proprietary Instances"> |
168 | <field name="code" /> |
169 | |
170 | === modified file 'bin/addons/account/wizard/account_report_general_ledger.py' |
171 | --- bin/addons/account/wizard/account_report_general_ledger.py 2016-05-26 15:01:18 +0000 |
172 | +++ bin/addons/account/wizard/account_report_general_ledger.py 2016-08-09 15:43:17 +0000 |
173 | @@ -54,8 +54,13 @@ |
174 | ('bl','Balance Sheet'), |
175 | ], 'B/S / P&L account', required=True), |
176 | |
177 | - 'unreconciled': fields.boolean("Unreconciled", |
178 | - help="filter will apply only on the B/S accounts except for the non reconciliable account like 10100 and 10200 which will never be displayed per details"), |
179 | + 'reconciled': fields.selection([ |
180 | + ('empty', ''), |
181 | + ('yes', 'Yes'), |
182 | + ('no', 'No'), |
183 | + ], "Reconciled", |
184 | + help="filter will apply only on the B/S accounts except for the non reconciliable account like 10100 and 10200 which will never be displayed per details"), |
185 | + 'reconcile_date': fields.date("At"), |
186 | |
187 | 'account_ids': fields.many2many('account.account', |
188 | 'account_report_general_ledger_account_account_rel', |
189 | @@ -79,7 +84,7 @@ |
190 | 'export_format': 'pdf', |
191 | 'journal_ids': _get_journals, # exclude extra-accounting journals from this report (IKD, ODX) |
192 | 'account_type': 'all', |
193 | - 'unreconciled': False, |
194 | + 'reconciled': 'empty', |
195 | 'is_initial_balance_available': False, # as no FY selection, not available by default US-926 point 7) |
196 | 'display_account': 'bal_movement', # by default only result with JIs |
197 | } |
198 | @@ -163,7 +168,8 @@ |
199 | |
200 | form_fields = [ 'initial_balance', 'amount_currency', 'sortby', |
201 | 'output_currency', 'instance_ids', 'export_format', |
202 | - 'account_type', 'unreconciled', 'account_ids', ] |
203 | + 'account_type', 'reconciled', 'reconcile_date', |
204 | + 'account_ids', ] |
205 | data['form'].update(self.read(cr, uid, ids, form_fields)[0]) |
206 | |
207 | # US-822: safe initial balance check box |
208 | |
209 | === modified file 'bin/addons/account/wizard/account_report_general_ledger_view.xml' |
210 | --- bin/addons/account/wizard/account_report_general_ledger_view.xml 2016-03-23 14:52:23 +0000 |
211 | +++ bin/addons/account/wizard/account_report_general_ledger_view.xml 2016-08-09 15:43:17 +0000 |
212 | @@ -24,7 +24,9 @@ |
213 | <field name="amount_currency" invisible="1" /> |
214 | <newline/> |
215 | <field name="account_type" /> |
216 | - <field name="unreconciled" /> |
217 | + <newline/> |
218 | + <field name="reconciled" /> |
219 | + <field name="reconcile_date" /> |
220 | <newline/> |
221 | <field name="instance_ids" domain="[('instance_to_display_ids','=',True)]"> |
222 | <tree noteditable="1" editable="top" string="Proprietary Instances"> |
223 | |
224 | === modified file 'bin/addons/account_mcdb/account_mcdb.py' |
225 | --- bin/addons/account_mcdb/account_mcdb.py 2016-06-28 12:02:56 +0000 |
226 | +++ bin/addons/account_mcdb/account_mcdb.py 2016-08-09 15:43:17 +0000 |
227 | @@ -60,6 +60,7 @@ |
228 | 'account_type_ids': fields.many2many(obj='account.account.type', rel='account_account_type_mcdb', id1='mcdb_id', id2='account_type_id', |
229 | string="Account type"), |
230 | 'reconcile_id': fields.many2one('account.move.reconcile', string="Reconcile Reference"), |
231 | + 'reconcile_date': fields.date("Reconciled at"), |
232 | 'ref': fields.char(string='Reference', size=255), |
233 | 'name': fields.char(string='Description', size=255), |
234 | 'rev_account_ids': fields.boolean('Exclude account selection'), |
235 | @@ -335,10 +336,17 @@ |
236 | # total or partial and override reconciled status |
237 | domain.append(('reconcile_total_partial_id', '=', wiz.reconcile_id.id)) |
238 | elif wiz.reconciled: |
239 | + # US-533: new search matrix |
240 | + # http://jira.unifield.org/browse/US-533?focusedCommentId=50218&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50218 |
241 | + # search always regarding FULL reconcile (is_reconciled do that) |
242 | if wiz.reconciled == 'reconciled': |
243 | - domain.append(('reconcile_id', '!=', False)) # only full reconcile |
244 | + domain.append(('is_reconciled', '=', True)) |
245 | elif wiz.reconciled == 'unreconciled': |
246 | - domain.append(('reconcile_id', '=', False)) # partial or not reconcile (dont take care of reconcile_partial_id state) |
247 | + domain.append(('is_reconciled', '=', False)) |
248 | + if wiz.reconcile_date: |
249 | + domain.append(('reconcile_date', '<=', wiz.reconcile_date)) |
250 | + # note that for US-533 JI search is overrided in |
251 | + # account_reconcile/account_move_line.py |
252 | |
253 | # REALLOCATION field |
254 | if wiz.reallocated: |
255 | |
256 | === modified file 'bin/addons/account_mcdb/account_mcdb_view.xml' |
257 | --- bin/addons/account_mcdb/account_mcdb_view.xml 2016-05-30 07:12:04 +0000 |
258 | +++ bin/addons/account_mcdb/account_mcdb_view.xml 2016-08-09 15:43:17 +0000 |
259 | @@ -67,7 +67,9 @@ |
260 | &account; |
261 | <separator string="Reconciliation" colspan="4"/> |
262 | <field name="reconciled"/> |
263 | + <field name="reconcile_date" string="At"/> |
264 | <field name="reconcile_id"/> |
265 | + |
266 | ¤cy; |
267 | <group colspan="4" col="6"> |
268 | <separator string="Third Party" colspan="6"/> |
269 | @@ -342,7 +344,7 @@ |
270 | <field name="view_id" ref="account_mcdb_tree"/> |
271 | <field name="search_view_id" ref="account_mcdb_search"/> |
272 | <field name="domain">[('description', '!=', False), ('model', '=', 'account.move.line')]</field> |
273 | - <field name="context">{'search_default_user': uid}</field> |
274 | + <field name="context">{'search_default_user': uid, 'from_web_menu': True}</field> |
275 | </record> |
276 | |
277 | <record id="action_account_mcdb_analytic" model="ir.actions.act_window"> |
278 | @@ -365,7 +367,7 @@ |
279 | <field name="view_id" ref="account_mcdb_form"/> |
280 | <field name="search_view_id" ref="account_mcdb_search"/> |
281 | <field name="domain">[('description', '!=', False), ('model', '=', 'account.move.line')]</field> |
282 | - <field name="context">{'search_default_user': uid}</field> |
283 | + <field name="context">{'search_default_user': uid, 'from_web_menu': True}</field> |
284 | </record> |
285 | |
286 | <record id="action_account_mcdb_analytic_form" model="ir.actions.act_window"> |
287 | |
288 | === modified file 'bin/addons/account_mcdb/account_view.xml' |
289 | --- bin/addons/account_mcdb/account_view.xml 2016-05-26 13:18:50 +0000 |
290 | +++ bin/addons/account_mcdb/account_view.xml 2016-08-09 15:43:17 +0000 |
291 | @@ -161,9 +161,12 @@ |
292 | <field name="partner_id" select='1' string="3RD Party Partner"/> |
293 | <field name="employee_id" select='1' string="3RD Party Employee"/> |
294 | <field name="transfer_journal_id" select='1' string="3RD Party Journal" context="{'exclude_journals': ['IB']}"/> |
295 | + </group> |
296 | + <newline/> |
297 | + <group> |
298 | <field name="is_reconciled" select='1'/> |
299 | <field name="reconcile_total_partial_id" select='1'/> |
300 | - <newline/> |
301 | + <field name="reconcile_date" select='1' string="At"/> |
302 | </group> |
303 | <newline/> |
304 | <group> |
305 | |
306 | === modified file 'bin/addons/account_mcdb/report/account_mcdb_export.py' |
307 | --- bin/addons/account_mcdb/report/account_mcdb_export.py 2016-05-20 09:42:27 +0000 |
308 | +++ bin/addons/account_mcdb/report/account_mcdb_export.py 2016-08-09 15:43:17 +0000 |
309 | @@ -66,7 +66,7 @@ |
310 | head += [_('Func. Debit'), _('Func. Credit'), _('Func. Currency')] |
311 | else: |
312 | head += [_('Output Debit'), _('Output Credit'), _('Output Currency')] |
313 | - head += [_('Reconcile'), _('State')] |
314 | + head += [_('Reconcile'), _('Reconcile Date'), _('State')] |
315 | writer.writerow(map(lambda x: x.encode('utf-8'), head)) |
316 | # Sort items |
317 | ids.sort() |
318 | @@ -138,6 +138,8 @@ |
319 | csv_line.append(currency_name.encode('utf-8') or '') |
320 | #reconcile |
321 | csv_line.append(ml.reconcile_txt and ml.reconcile_txt.encode('utf-8') or '') |
322 | + #reconcile date US-533 |
323 | + csv_line.append(ml.reconcile_date or '') |
324 | #state |
325 | csv_line.append(field_sel(cr, uid, ml, 'move_state', context).encode('utf-8')) |
326 | # Write line |
327 | |
328 | === modified file 'bin/addons/account_mcdb/report/report_account_move_line.rml' |
329 | --- bin/addons/account_mcdb/report/report_account_move_line.rml 2016-05-20 09:42:27 +0000 |
330 | +++ bin/addons/account_mcdb/report/report_account_move_line.rml 2016-08-09 15:43:17 +0000 |
331 | @@ -116,6 +116,9 @@ |
332 | <para style="P3">Reconcile</para> |
333 | </td> |
334 | <td> |
335 | + <para style="P3">Reconcile Date</para> |
336 | + </td> |
337 | + <td> |
338 | <para style="P3">State</para> |
339 | </td> |
340 | </tr> |
341 | @@ -173,6 +176,9 @@ |
342 | <para style="P3">[[ o.reconcile_txt and o.reconcile_txt or '' ]]</para> |
343 | </td> |
344 | <td> |
345 | + <para style="P3">[[ formatLang(o.reconcile_date, date=True) or '']]</para> |
346 | + </td> |
347 | + <td> |
348 | <para style="P3">[[ o.move_state and getSel(o, 'move_state') or '' ]]</para> |
349 | </td> |
350 | </tr> |
351 | |
352 | === modified file 'bin/addons/account_mcdb/report/report_account_move_line_xls.mako' |
353 | --- bin/addons/account_mcdb/report/report_account_move_line_xls.mako 2016-05-20 09:42:27 +0000 |
354 | +++ bin/addons/account_mcdb/report/report_account_move_line_xls.mako 2016-08-09 15:43:17 +0000 |
355 | @@ -55,7 +55,7 @@ |
356 | <Column ss:AutoFitWidth="1" ss:Width="70" /> |
357 | % endfor |
358 | <Row> |
359 | -% for header in [_('Proprietary Instance'), _('Journal Code'), _('Entry Sequence'), _('Description'), _('Ref.'), _('Document Date'), _('Posting Date'), _('Period'), _('Account'), _('Third Party'), _('Book. Debit'), _('Book. Credit'), _('Book. Currency'), _('Output Debit'), _('Output Credit'), _('Output Currency'), _('Reconcile'), _('State')]: |
360 | +% for header in [_('Proprietary Instance'), _('Journal Code'), _('Entry Sequence'), _('Description'), _('Ref.'), _('Document Date'), _('Posting Date'), _('Period'), _('Account'), _('Third Party'), _('Book. Debit'), _('Book. Credit'), _('Book. Currency'), _('Output Debit'), _('Output Credit'), _('Output Currency'), _('Reconcile'), _('Reconcile Date'), _('State')]: |
361 | <Cell ss:StyleID="ssH"><Data ss:Type="String">${header}</Data></Cell> |
362 | % endfor |
363 | </Row> |
364 | @@ -124,6 +124,15 @@ |
365 | <Cell ss:StyleID="ssBorder"> |
366 | <Data ss:Type="String">${(o.reconcile_txt or '')|x}</Data> |
367 | </Cell> |
368 | +% if o.reconcile_date and o.reconcile_date != 'False': |
369 | +<Cell ss:StyleID="ssBorderDate"> |
370 | + <Data ss:Type="DateTime">${o.reconcile_date|n}T00:00:00</Data> |
371 | +</Cell> |
372 | +% else: |
373 | +<Cell ss:StyleID="ssBorder"> |
374 | + <Data ss:Type="String"> </Data> |
375 | +</Cell> |
376 | +% endif |
377 | <Cell ss:StyleID="ssBorder"> |
378 | <Data ss:Type="String">${(o.move_state and getSel(o,'move_state') or '')|x}</Data> |
379 | </Cell> |
380 | |
381 | === modified file 'bin/addons/account_reconciliation/account.py' |
382 | --- bin/addons/account_reconciliation/account.py 2011-11-28 09:29:51 +0000 |
383 | +++ bin/addons/account_reconciliation/account.py 2016-08-09 15:43:17 +0000 |
384 | @@ -38,8 +38,10 @@ |
385 | total += (line.debit_currency or 0.0) - (line.credit_currency or 0.0) |
386 | if not total: |
387 | self.pool.get('account.move.line').write(cr, uid, |
388 | - map(lambda x: x.id, rec.line_partial_ids), |
389 | - {'reconcile_id': rec.id } |
390 | + map(lambda x: x.id, rec.line_partial_ids), { |
391 | + 'reconcile_id': rec.id, |
392 | + 'reconcile_date': time.strftime('%Y-%m-%d'), # US-533 date of JI reconciliation |
393 | + } |
394 | ) |
395 | # @@@end |
396 | return True |
397 | |
398 | === modified file 'bin/addons/account_reconciliation/account_move_line.py' |
399 | --- bin/addons/account_reconciliation/account_move_line.py 2014-10-27 13:40:35 +0000 |
400 | +++ bin/addons/account_reconciliation/account_move_line.py 2016-08-09 15:43:17 +0000 |
401 | @@ -31,6 +31,54 @@ |
402 | class account_move_line(osv.osv): |
403 | _inherit = 'account.move.line' |
404 | _name = 'account.move.line' |
405 | + |
406 | + _columns = { |
407 | + 'reconcile_date': fields.date('Reconcile date', |
408 | + help="Date of reconciliation"), |
409 | + } |
410 | + |
411 | + def search(self, cr, uid, args, offset=0, limit=None, order=None, |
412 | + context=None, count=False): |
413 | + if context is None: |
414 | + context = {} |
415 | + |
416 | + # US-533: to answer http://jira.unifield.org/browse/US-533?focusedCommentId=50218&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-50218 |
417 | + # always consider: |
418 | + # 1) reconcile empty to cancel the reconcile date criteria |
419 | + # 2) reconcile 'No' filter: become reconciled since (day+1) |
420 | + # or not reconciled (cases 6/9 of Jira comment matrix) |
421 | + if context.get('from_web_menu', True): |
422 | + ft_obj = self.pool.get('fields.tools') |
423 | + if ft_obj.domain_get_field_index(args, 'reconcile_date') >= 0: |
424 | + is_reconciled_index = ft_obj.domain_get_field_index(args, |
425 | + 'is_reconciled') |
426 | + if is_reconciled_index < 0: |
427 | + # 1) |
428 | + args = ft_obj.domain_remove_field(args, 'reconcile_date') |
429 | + else: |
430 | + reconciled_date_index = ft_obj.domain_get_field_index(args, |
431 | + 'reconcile_date') |
432 | + if reconciled_date_index >= 0 \ |
433 | + and args[is_reconciled_index][1] == '=' \ |
434 | + and not args[is_reconciled_index][2]: |
435 | + # 2) |
436 | + reconcile_date = args[reconciled_date_index][2] |
437 | + args = ft_obj.domain_remove_field(args, [ |
438 | + 'is_reconciled', |
439 | + 'reconcile_id', |
440 | + 'reconcile_date', |
441 | + ]) |
442 | + domain = [ |
443 | + '|', |
444 | + ('reconcile_date', '>', reconcile_date), |
445 | + ('reconcile_id', '=', False), |
446 | + ('account_id.reconcile', '=', True), |
447 | + ] |
448 | + args = domain + args |
449 | + |
450 | + return super(account_move_line, self).search(cr, uid, args, |
451 | + offset=offset, limit=limit, order=order, context=context, |
452 | + count=count) |
453 | |
454 | def check_imported_invoice(self, cr, uid, ids, context=None): |
455 | """ |
456 | @@ -119,6 +167,11 @@ |
457 | 'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge), |
458 | 'is_multi_instance': different_level, |
459 | }) |
460 | + # US-533: date of JI reconciliation for line_partial_ids linked with |
461 | + # above (4, 0) |
462 | + self.pool.get('account.move.line').write(cr, uid, merges+unmerge, { |
463 | + 'reconcile_date': time.strftime('%Y-%m-%d'), |
464 | + }) |
465 | |
466 | # UF-2011: synchronize move lines (not "marked" after reconcile creation) |
467 | if self.pool.get('sync.client.orm_extended'): |
468 | @@ -227,6 +280,12 @@ |
469 | 'multi_instance_level_creation': multi_instance_level_creation, |
470 | }) |
471 | |
472 | + # US-533: date of JI reconciliation for total reconciliation linked |
473 | + # with above (4, 0) |
474 | + self.pool.get('account.move.line').write(cr, uid, ids, { |
475 | + 'reconcile_date': time.strftime('%Y-%m-%d'), |
476 | + }) |
477 | + |
478 | # UF-2011: synchronize move lines (not "marked" after reconcile creation) |
479 | if self.pool.get('sync.client.orm_extended'): |
480 | self.pool.get('account.move.line').synchronize(cr, uid, ids, context=context) |
481 | |
482 | === modified file 'bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv' |
483 | --- bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2016-07-12 09:57:48 +0000 |
484 | +++ bin/addons/msf_sync_data_server/data/sync_server.sync_rule.csv 2016-08-09 15:43:17 +0000 |
485 | @@ -70,7 +70,7 @@ |
486 | msf_sync_data_server.account_move_reconcile,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional,[],"['name', 'type', 'is_multi_instance', 'multi_instance_level_creation', 'instance_id']",OC,account.move.reconcile,,Account Move Reconcile,Valid,,410 |
487 | msf_sync_data_server.register_line_deleted,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,"[('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')]))]","['statement_id/id', 'sequence','instance_id/id']",MISSION,account.bank.statement.line.deleted,instance_id,Register Deleted Line,Valid,,405 |
488 | msf_sync_data_server.account_move,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,[],"['date', 'document_date', 'imported', 'journal_id/id', 'name', 'narration', 'period_id/id', 'ref', 'statement_line_ids/id', 'to_check','instance_id/id','status','employee_id/id','transfer_journal_id/id','manual_currency_id/id','block_manual_currency_id','partner_id2/id','analytic_distribution_id/id', 'register_line_id/id']",OC,account.move,instance_id,Account Move,Valid,,411 |
489 | -msf_sync_data_server.account_move_line,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,[],"['account_id/id', 'accrual', 'analytic_account_id/id', 'analytic_distribution_id/id', 'blocked', 'cheque_number','corrected', 'credit', 'credit_currency', 'currency_id/id', 'date_created', 'date_maturity', 'debit', 'debit_currency', 'document_date', 'employee_id/id', 'have_an_historic', 'instance_id/id', 'is_addendum_line', 'is_counterpart', 'is_transfer_with_change', 'is_write_off', 'journal_id/id', 'last_cor_was_only_analytic', 'move_id/id', 'name', 'partner_id/id','partner_txt','period_id/id', 'reconcile_id/id', 'reconcile_partial_id/id', 'ref', 'reversal', 'source_date', 'statement_id/id', 'reference', 'state','transfer_journal_id/id', 'transfer_amount', 'is_downpayment']",OC,account.move.line,instance_id,Account Move Line,Valid,,412 |
490 | +msf_sync_data_server.account_move_line,TRUE,TRUE,TRUE,FALSE,bidirectional,Bidirectional-Private,[],"['account_id/id', 'accrual', 'analytic_account_id/id', 'analytic_distribution_id/id', 'blocked', 'cheque_number','corrected', 'credit', 'credit_currency', 'currency_id/id', 'date_created', 'date_maturity', 'debit', 'debit_currency', 'document_date', 'employee_id/id', 'have_an_historic', 'instance_id/id', 'is_addendum_line', 'is_counterpart', 'is_transfer_with_change', 'is_write_off', 'journal_id/id', 'last_cor_was_only_analytic', 'move_id/id', 'name', 'partner_id/id','partner_txt','period_id/id', 'reconcile_id/id', 'reconcile_partial_id/id', 'ref', 'reversal', 'source_date', 'statement_id/id', 'reference', 'state','transfer_journal_id/id', 'transfer_amount', 'is_downpayment', 'reconcile_date']",OC,account.move.line,instance_id,Account Move Line,Valid,,412 |
491 | msf_sync_data_server.account_move_line_correction,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,"[('move_id','in',('account.move','id',[('state','=','posted')]))]","['corrected_line_id/id', 'instance_id/id', 'reversal_line_id/id']",OC,account.move.line,instance_id,Account Move Line Correction,Valid,,413 |
492 | msf_sync_data_server.account_move_line_register_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,[],"['corrected_st_line_id/id', 'instance_id/id']",MISSION,account.move.line,instance_id,Account Move Line / Register Line,Valid,,414 |
493 | msf_sync_data_server.register_line_account_move_line,TRUE,TRUE,FALSE,FALSE,bidirectional,Bidirectional-Private,"[('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')])),('statement_id','in',('account.bank.statement','id',[('state','!=','draft')])),'!',('state','=','draft')]","['direct_invoice_move_id/id', 'first_move_line_id/id', 'from_import_cheque_id/id', 'imported_invoice_line_ids/id','instance_id/id', 'cash_return_move_line_id/id']",MISSION,account.bank.statement.line,instance_id,Register Line / Account Move Line,Valid,,415 |
494 | @@ -177,7 +177,7 @@ |
495 | msf_usb_sync_data_server.cp_gl_journals_registers,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,"['|',('type', '=', 'cash'),('type', '=', 'cheque')]","['bank_journal_id/id','analytic_journal_id/id', 'code', 'currency/id', 'default_credit_account_id/id', 'default_debit_account_id/id', 'name', 'type','instance_id/id']",USB,account.journal,,[MASTER] GL Journals - Registers,Valid,,1507 |
496 | msf_usb_sync_data_server.cp_account_move_reconcile,TRUE,TRUE,TRUE,TRUE,cp_to_rw,Bidirectional,[],"['name', 'type']",USB,account.move.reconcile,,[MASTER] Account Move Reconcile,Valid,,1510 |
497 | msf_usb_sync_data_server.cp_account_move,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,[],"['date', 'document_date', 'imported', 'journal_id/id', 'name', 'narration', 'period_id/id', 'ref', 'statement_line_ids/id', 'to_check','instance_id/id','status','employee_id/id','transfer_journal_id/id','manual_currency_id/id','block_manual_currency_id','partner_id2/id','analytic_distribution_id/id']",USB,account.move,,[MASTER] Account Move,Valid,,1520 |
498 | -msf_usb_sync_data_server.cp_account_move_line,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,[],"['account_id/id', 'accrual', 'analytic_account_id/id', 'analytic_distribution_id/id', 'blocked', 'cheque_number','corrected', 'credit', 'credit_currency', 'currency_id/id', 'date', 'date_created', 'date_maturity', 'debit', 'debit_currency', 'document_date', 'employee_id/id', 'have_an_historic', 'instance_id/id', 'is_addendum_line', 'is_counterpart', 'is_transfer_with_change', 'is_write_off', 'journal_id/id', 'last_cor_was_only_analytic', 'move_id/id', 'move_state', 'name', 'partner_id/id','partner_txt','period_id/id', 'reconcile_id/id', 'ref', 'reversal', 'source_date', 'statement_id/id', 'reference', 'state','transfer_journal_id/id', 'transfer_amount', 'is_downpayment']",USB,account.move.line,,[MASTER] Account Move Line,Valid,,1521 |
499 | +msf_usb_sync_data_server.cp_account_move_line,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,[],"['account_id/id', 'accrual', 'analytic_account_id/id', 'analytic_distribution_id/id', 'blocked', 'cheque_number','corrected', 'credit', 'credit_currency', 'currency_id/id', 'date', 'date_created', 'date_maturity', 'debit', 'debit_currency', 'document_date', 'employee_id/id', 'have_an_historic', 'instance_id/id', 'is_addendum_line', 'is_counterpart', 'is_transfer_with_change', 'is_write_off', 'journal_id/id', 'last_cor_was_only_analytic', 'move_id/id', 'move_state', 'name', 'partner_id/id','partner_txt','period_id/id', 'reconcile_id/id', 'ref', 'reversal', 'source_date', 'statement_id/id', 'reference', 'state','transfer_journal_id/id', 'transfer_amount', 'is_downpayment', 'reconcile_date']",USB,account.move.line,,[MASTER] Account Move Line,Valid,,1521 |
500 | msf_usb_sync_data_server.cp_account_move_line_correction,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,"[('move_id','in',('account.move','id',[('state','=','posted')]))]","['corrected_line_id/id', 'instance_id/id', 'reversal_line_id/id']",USB,account.move.line,,[MASTER] Account Move Line Correction,Valid,,1522 |
501 | msf_usb_sync_data_server.cp_account_move_line_register_line,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,[],"['corrected_st_line_id/id', 'instance_id/id']",USB,account.move.line,,[MASTER] Account Move Line / Register Line,Valid,,1523 |
502 | msf_usb_sync_data_server.cp_register_line_account_move_line,TRUE,TRUE,FALSE,TRUE,cp_to_rw,Bidirectional,"[('instance_id' , 'in' , ('msf.instance' , 'id' , [('level' , '=' , 'project')])),('statement_id','in',('account.bank.statement','id',[('state','!=','draft')])),'!',('state','=','draft')]","['first_move_line_id/id', 'instance_id/id']",USB,account.bank.statement.line,,[MASTER] Register Line / Account Move Line,Valid,,1530 |
503 | |
504 | === modified file 'bin/addons/msf_tools/msf_tools.py' |
505 | --- bin/addons/msf_tools/msf_tools.py 2016-07-05 14:43:42 +0000 |
506 | +++ bin/addons/msf_tools/msf_tools.py 2016-08-09 15:43:17 +0000 |
507 | @@ -226,6 +226,35 @@ |
508 | tpl_drop_const = "alter table %s drop constraint %s" % sql_params |
509 | cr.execute(tpl_drop_const) |
510 | |
511 | + def domain_get_field_index(self, domain, field_name): |
512 | + """ |
513 | + get field tuple index in domain |
514 | + :return: index or < 0 if not found |
515 | + :rtype: int |
516 | + """ |
517 | + index = 0 |
518 | + if domain: |
519 | + for t in domain: |
520 | + if t[0] == field_name: |
521 | + return index |
522 | + index += 1 |
523 | + return -1 |
524 | + |
525 | + def domain_remove_field(self, domain, field_names): |
526 | + """ |
527 | + remove field(s) tuple(s) in domain |
528 | + :param field_names: field(s) to remove |
529 | + :type field_names: str/list/tuple |
530 | + :return: new domain |
531 | + """ |
532 | + if not isinstance(field_names, (list, tuple, )): |
533 | + field_names = [ field_names, ] |
534 | + res = [] |
535 | + for t in domain: |
536 | + if t[0] not in field_names: |
537 | + res.append(t) |
538 | + return res |
539 | + |
540 | fields_tools() |
541 | |
542 |