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

Proposed by jftempo
Status: Merged
Merged at revision: 3703
Proposed branch: lp:~jfb-tempo-consulting/unifield-server/us-1191
Merge into: lp:unifield-server
Diff against target: 83 lines (+17/-5)
3 files modified
bin/addons/analytic_distribution/analytic_line.py (+9/-1)
bin/addons/analytic_distribution/wizard/mass_reallocation_wizard.py (+2/-1)
bin/addons/analytic_override/analytic_line.py (+6/-3)
To merge this branch: bzr merge lp:~jfb-tempo-consulting/unifield-server/us-1191
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+291644@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
=== modified file 'bin/addons/analytic_distribution/analytic_line.py'
--- bin/addons/analytic_distribution/analytic_line.py 2016-03-15 16:35:21 +0000
+++ bin/addons/analytic_distribution/analytic_line.py 2016-04-12 15:35:58 +0000
@@ -338,7 +338,7 @@
338 self.pool.get('account.move.line').corrected_upstream_marker(cr, uid, [aline.move_id.id], context=context)338 self.pool.get('account.move.line').corrected_upstream_marker(cr, uid, [aline.move_id.id], context=context)
339 return True339 return True
340340
341 def check_analytic_account(self, cr, uid, ids, account_id, context=None):341 def check_analytic_account(self, cr, uid, ids, account_id, wiz_date, context=None):
342 """342 """
343 Analytic distribution validity verification with given account for given ids.343 Analytic distribution validity verification with given account for given ids.
344 Return all valid ids.344 Return all valid ids.
@@ -372,6 +372,14 @@
372 # since US-711 date_stop is to be excluded itself as a frontier372 # since US-711 date_stop is to be excluded itself as a frontier
373 # => >= date_stop vs > date_stop373 # => >= date_stop vs > date_stop
374 # => http://jira.unifield.org/browse/US-711?focusedCommentId=45744&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-45744374 # => http://jira.unifield.org/browse/US-711?focusedCommentId=45744&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-45744
375 if account_type in ['OC', 'DEST']:
376 if aline.journal_id.type == 'hq' or aline.period_id and aline.period_id.state in ['done', 'mission-closed']:
377 aline_cmp_date = wiz_date
378 # these lines will be reverted, check if the reverted line is active
379 oc_dest_date_start = max(aline.cost_center_id.date_start, aline.destination_id.date_start)
380 oc_dest_date_stop = min(aline.cost_center_id.date or '9999-01-01', aline.destination_id.date or '9999-01-01')
381 if (oc_dest_date_start and wiz_date < oc_dest_date_start) or (oc_dest_date_stop and wiz_date >= oc_dest_date_stop):
382 expired_date_ids.append(aline.id)
375 if (date_start and aline_cmp_date < date_start) or (date_stop and aline_cmp_date >= date_stop):383 if (date_start and aline_cmp_date < date_start) or (date_stop and aline_cmp_date >= date_stop):
376 expired_date_ids.append(aline.id)384 expired_date_ids.append(aline.id)
377 # Process regarding account_type385 # Process regarding account_type
378386
=== modified file 'bin/addons/analytic_distribution/wizard/mass_reallocation_wizard.py'
--- bin/addons/analytic_distribution/wizard/mass_reallocation_wizard.py 2016-02-05 13:28:03 +0000
+++ bin/addons/analytic_distribution/wizard/mass_reallocation_wizard.py 2016-04-12 15:35:58 +0000
@@ -327,6 +327,7 @@
327 for wiz in self.browse(cr, uid, ids, context=context):327 for wiz in self.browse(cr, uid, ids, context=context):
328 to_process = [x.id for x in wiz.line_ids] or []328 to_process = [x.id for x in wiz.line_ids] or []
329 account_id = wiz.account_id.id329 account_id = wiz.account_id.id
330
330 date = wiz.date or strftime('%Y-%m-%d')331 date = wiz.date or strftime('%Y-%m-%d')
331 # Don't process lines:332 # Don't process lines:
332 # - that have same account (or cost_center_id)333 # - that have same account (or cost_center_id)
@@ -366,7 +367,7 @@
366 # Delete non_supported element from to_process and write them to tmp_process_ids367 # Delete non_supported element from to_process and write them to tmp_process_ids
367 tmp_to_process = [x for x in to_process if x not in non_supported_ids]368 tmp_to_process = [x for x in to_process if x not in non_supported_ids]
368 if tmp_to_process:369 if tmp_to_process:
369 valid_ids = self.pool.get('account.analytic.line').check_analytic_account(cr, uid, tmp_to_process, account_id, context=context)370 valid_ids = self.pool.get('account.analytic.line').check_analytic_account(cr, uid, tmp_to_process, account_id, date, context=context)
370 process_ids.extend(valid_ids)371 process_ids.extend(valid_ids)
371 error_ids.extend([x for x in tmp_to_process if x not in valid_ids])372 error_ids.extend([x for x in tmp_to_process if x not in valid_ids])
372 vals = {'account_id': account_id, 'date': date,}373 vals = {'account_id': account_id, 'date': date,}
373374
=== modified file 'bin/addons/analytic_override/analytic_line.py'
--- bin/addons/analytic_override/analytic_line.py 2016-02-24 10:22:18 +0000
+++ bin/addons/analytic_override/analytic_line.py 2016-04-12 15:35:58 +0000
@@ -135,24 +135,27 @@
135 if not 'account_id' in vals:135 if not 'account_id' in vals:
136 raise osv.except_osv(_('Error'), _('No account_id found in given values!'))136 raise osv.except_osv(_('Error'), _('No account_id found in given values!'))
137137
138 account_obj = self.pool.get('account.analytic.account')
139
138 #US-419: Use the document date and not posting date when checking the validity of analytic account140 #US-419: Use the document date and not posting date when checking the validity of analytic account
139 # tech: replaced all date by document_date141 # tech: replaced all date by document_date
140 if 'document_date' in vals and vals['document_date'] is not False:142 if 'document_date' in vals and vals['document_date'] is not False:
141 account_obj = self.pool.get('account.analytic.account')
142 document_date = vals['document_date']143 document_date = vals['document_date']
143 account = account_obj.browse(cr, uid, vals['account_id'], context=context)144 account = account_obj.browse(cr, uid, vals['account_id'], context=context)
144 # FIXME: refactoring of next code145 # FIXME: refactoring of next code
145 if document_date < account.date_start or (account.date != False and document_date >= account.date):146 if document_date < account.date_start or (account.date != False and document_date >= account.date):
146 if 'from' not in context or context.get('from') != 'mass_reallocation':147 if 'from' not in context or context.get('from') != 'mass_reallocation':
147 raise osv.except_osv(_('Error'), _("The analytic account selected '%s' is not active.") % (account.name or '',))148 raise osv.except_osv(_('Error'), _("The analytic account selected '%s' is not active.") % (account.name or '',))
149 if 'date' in vals and vals['date'] is not False:
150 date = vals['date']
148 if vals.get('cost_center_id', False):151 if vals.get('cost_center_id', False):
149 cc = account_obj.browse(cr, uid, vals['cost_center_id'], context=context)152 cc = account_obj.browse(cr, uid, vals['cost_center_id'], context=context)
150 if document_date < cc.date_start or (cc.date != False and document_date >= cc.date):153 if date < cc.date_start or (cc.date != False and date >= cc.date):
151 if 'from' not in context or context.get('from') != 'mass_reallocation':154 if 'from' not in context or context.get('from') != 'mass_reallocation':
152 raise osv.except_osv(_('Error'), _("The analytic account selected '%s' is not active.") % (cc.name or '',))155 raise osv.except_osv(_('Error'), _("The analytic account selected '%s' is not active.") % (cc.name or '',))
153 if vals.get('destination_id', False):156 if vals.get('destination_id', False):
154 dest = account_obj.browse(cr, uid, vals['destination_id'], context=context)157 dest = account_obj.browse(cr, uid, vals['destination_id'], context=context)
155 if document_date < dest.date_start or (dest.date != False and document_date >= dest.date):158 if date < dest.date_start or (dest.date != False and date >= dest.date):
156 if 'from' not in context or context.get('from') != 'mass_reallocation':159 if 'from' not in context or context.get('from') != 'mass_reallocation':
157 raise osv.except_osv(_('Error'), _("The analytic account selected '%s' is not active.") % (dest.name or '',))160 raise osv.except_osv(_('Error'), _("The analytic account selected '%s' is not active.") % (dest.name or '',))
158 return True161 return True

Subscribers

People subscribed via source and target branches