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

Proposed by jftempo
Status: Merged
Merged at revision: 3743
Proposed branch: lp:~unifield-team/unifield-server/us-1251
Merge into: lp:unifield-server
Diff against target: 68 lines (+17/-10)
2 files modified
bin/addons/msf_currency_revaluation/account.py (+12/-7)
bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py (+5/-3)
To merge this branch: bzr merge lp:~unifield-team/unifield-server/us-1251
Reviewer Review Type Date Requested Status
UniField Reviewer Team Pending
Review via email: mp+293279@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/msf_currency_revaluation/account.py'
--- bin/addons/msf_currency_revaluation/account.py 2014-11-12 14:31:29 +0000
+++ bin/addons/msf_currency_revaluation/account.py 2016-04-28 14:54:24 +0000
@@ -66,17 +66,22 @@
66 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance",66 'balance': "COALESCE(SUM(l.debit),0) - COALESCE(SUM(l.credit), 0) as balance",
67 'debit': "COALESCE(SUM(l.debit), 0) as debit",67 'debit': "COALESCE(SUM(l.debit), 0) as debit",
68 'credit': "COALESCE(SUM(l.credit), 0) as credit",68 'credit': "COALESCE(SUM(l.credit), 0) as credit",
69 'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance"}69 # US-1251: booking balance mapping: use directly booking balance vs JI amount_currency as we have discrepedencies
70 'foreign_balance': "COALESCE(SUM(l.debit_currency),0) - COALESCE(SUM(l.credit_currency), 0) as foreign_balance"
71 #'foreign_balance': "COALESCE(SUM(l.amount_currency), 0) as foreign_balance"
72 }
7073
71 def _revaluation_query(self, cr, uid, ids, revaluation_date, context=None):74 def _revaluation_query(self, cr, uid, ids, revaluation_date, context=None):
72 query = ("SELECT l.account_id as id, l.currency_id, " +75 query = ("SELECT l.account_id as id, l.currency_id, " +
73 ', '.join(self._sql_mapping.values()) +76 ', '.join(self._sql_mapping.values()) +
74 " FROM account_move_line l "77 " FROM account_move_line l"
75 " WHERE l.account_id IN %(account_ids)s AND "78 " inner join account_period p on p.id = l.period_id"
76 " l.date <= %(revaluation_date)s AND "79 " WHERE l.account_id IN %(account_ids)s AND"
77 " l.currency_id IS NOT NULL AND "80 " l.date <= %(revaluation_date)s AND"
78 " l.reconcile_id IS NULL AND "81 " l.currency_id IS NOT NULL AND"
79 " l.state <> 'draft' "82 " l.reconcile_id IS NULL AND"
83 " l.state <> 'draft' AND"
84 " p.number != 0" # US-1251 exclude IB entries period 0 for monthly and yearly
80 " GROUP BY l.account_id, l.currency_id")85 " GROUP BY l.account_id, l.currency_id")
81 params = {'revaluation_date': revaluation_date,86 params = {'revaluation_date': revaluation_date,
82 'account_ids': tuple(ids)}87 'account_ids': tuple(ids)}
8388
=== modified file 'bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py'
--- bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2016-02-25 10:12:25 +0000
+++ bin/addons/msf_currency_revaluation/wizard/wizard_currency_revaluation.py 2016-04-28 14:54:24 +0000
@@ -635,7 +635,8 @@
635 "Please check 'Included in revaluation' "635 "Please check 'Included in revaluation' "
636 "for at least one account in account form."))636 "for at least one account in account form."))
637637
638 special_period_ids = [p.id for p in form.fiscalyear_id.period_ids if p.special == True]638 special_period_ids = [ p.id for p in form.fiscalyear_id.period_ids \
639 if p.special == True and p.number != 0 ]
639 if not special_period_ids:640 if not special_period_ids:
640 raise osv.except_osv(_('Error!'),641 raise osv.except_osv(_('Error!'),
641 _('No special period found for the fiscalyear %s') %642 _('No special period found for the fiscalyear %s') %
@@ -651,9 +652,10 @@
651 )652 )
652 period_ids = [form.period_id.id]653 period_ids = [form.period_id.id]
653 else:654 else:
655 # NOTE: US-1251 exclude IB entries period 0 for monthly and yearly
654 period_ids = []656 period_ids = []
655 for period in form.fiscalyear_id.period_ids:657 for period in form.fiscalyear_id.period_ids:
656 if period.number < 13:658 if 0 < period.number < 13:
657 period_ids.append(period.id)659 period_ids.append(period.id)
658 if not period_ids:660 if not period_ids:
659 raise osv.except_osv(661 raise osv.except_osv(
@@ -663,7 +665,7 @@
663 # Check periods state665 # Check periods state
664 periods_not_field_closed = []666 periods_not_field_closed = []
665 for period in period_obj.browse(cr, uid, period_ids, context=context):667 for period in period_obj.browse(cr, uid, period_ids, context=context):
666 if period.state in ['created', 'draft']:668 if period.number != 0 and period.state in ['created', 'draft']:
667 periods_not_field_closed.append(period.name)669 periods_not_field_closed.append(period.name)
668670
669 # check if revaluation has already been run for this period671 # check if revaluation has already been run for this period

Subscribers

People subscribed via source and target branches

to all changes: