Merge lp:~unifield-team/unifield-server/us-1361 into lp:unifield-server

Proposed by jftempo
Status: Merged
Merged at revision: 3877
Proposed branch: lp:~unifield-team/unifield-server/us-1361
Merge into: lp:unifield-server
Diff against target: 73 lines (+10/-7)
2 files modified
bin/addons/account_hq_entries/wizard/hq_entries_split.py (+3/-2)
bin/addons/account_hq_entries/wizard/hq_entries_validation.py (+7/-5)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1361
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+300705@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_hq_entries/wizard/hq_entries_split.py'
2--- bin/addons/account_hq_entries/wizard/hq_entries_split.py 2016-03-23 09:07:28 +0000
3+++ bin/addons/account_hq_entries/wizard/hq_entries_split.py 2016-07-21 08:17:08 +0000
4@@ -291,8 +291,9 @@
5 total = 0.00
6 for line in wiz.line_ids:
7 total += line.amount
8- if abs(wiz.original_amount - total) > 10**-2:
9- raise osv.except_osv(_('Error'), _('Wrong total: %.2f, instead of: %.2f') % (total or 0.00, wiz.original_amount or 0.00,))
10+ if abs(abs(wiz.original_amount) - abs(total)) > 0.000000000001:
11+ # US-1361 tolerate minimal python rounding gap
12+ raise osv.except_osv(_('Error'), _('Wrong total: %f, instead of: %.2f') % (total or 0.00, wiz.original_amount or 0.00,))
13
14 self.write(cr, uid, [wiz.id], {'running': True})
15 # If all is OK, do process of lines
16
17=== modified file 'bin/addons/account_hq_entries/wizard/hq_entries_validation.py'
18--- bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2016-05-27 10:19:09 +0000
19+++ bin/addons/account_hq_entries/wizard/hq_entries_validation.py 2016-07-21 08:17:08 +0000
20@@ -89,7 +89,8 @@
21 self.pool.get('free.2.distribution.line').create(cr, uid, common_vals)
22 return distrib_id
23
24- def create_move(self, cr, uid, ids, period_id=False, currency_id=False, date=None, journal=None, orig_acct=None, context=None):
25+ def create_move(self, cr, uid, ids, period_id=False, currency_id=False,
26+ date=None, journal=None, orig_acct=None, doc_date=None, context=None):
27 """
28 Create a move with given hq entries lines
29 Return created lines (except counterpart lines)
30@@ -125,7 +126,7 @@
31 # create move
32 move_id = self.pool.get('account.move').create(cr, uid, {
33 'date': date,
34- 'document_date': date,
35+ 'document_date': doc_date or date,
36 'journal_id': journal_id,
37 'period_id': period_id,
38 })
39@@ -181,7 +182,7 @@
40 'move_id': move_id,
41 'date': date,
42 'date_maturity': date,
43- 'document_date': date,
44+ 'document_date': doc_date or date,
45 'name': 'HQ Entry Counterpart',
46 'currency_id': currency_id,
47 })
48@@ -234,7 +235,7 @@
49 # Create the original line as it is (and its reverse)
50 for line in original_lines:
51 # PROCESS ORIGINAL LINES
52- res_move = self.create_move(cr, uid, line.id, line.period_id.id, line.currency_id.id, date=line.date, context=context)
53+ res_move = self.create_move(cr, uid, line.id, line.period_id.id, line.currency_id.id, date=line.date, doc_date=line.document_date, context=context)
54 original_move = aml_obj.browse(cr, uid, res_move[line.id])
55
56 move_id = original_move.move_id.id
57@@ -248,7 +249,7 @@
58 aml_obj.write(cr, uid, original_move.id, {'corrected': True, 'have_an_historic': True} , context=context)
59 original_account_id = original_move.account_id.id
60
61- new_res_move = self.create_move(cr, uid, [x.id for x in line.split_ids], line.period_id.id, line.currency_id.id, date=line.date, journal=od_journal_id, orig_acct=original_account_id)
62+ new_res_move = self.create_move(cr, uid, [x.id for x in line.split_ids], line.period_id.id, line.currency_id.id, date=line.date, doc_date=line.document_date, journal=od_journal_id, orig_acct=original_account_id)
63 # original move line
64 original_ml_result = res_move[line.id]
65 # Mark new journal items as corrections for the first one
66@@ -277,6 +278,7 @@
67 'reversal_line_id': original_move.id,
68 'partner_txt': original_move.partner_txt or '',
69 'reference': line.ref or ' ', # UFTP-342: if HQ entry reference is empty, do not display anything. As a field function exists for account_move_line object, so we add a blank char to avoid this problem
70+ 'document_date': line.document_date, # US-1361
71 }, context=context, check=False, update_check=False)
72
73 # create the analytic lines as a reversed copy of the original

Subscribers

People subscribed via source and target branches

to all changes: