openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #02609
lp:~akretion-team/account-financial-tools/70-reversal-fix-improve into lp:account-financial-tools
Alexis de Lattre has proposed merging lp:~akretion-team/account-financial-tools/70-reversal-fix-improve into lp:account-financial-tools.
Requested reviews:
Account Core Editors (account-core-editors)
For more details, see:
https://code.launchpad.net/~akretion-team/account-financial-tools/70-reversal-fix-improve/+merge/200378
Avoid a crash when the next period doesn't exist (for example : you are in December 2013 and FY 2014 is not created yet).
Add prefer_normal_period in period selection.
--
https://code.launchpad.net/~akretion-team/account-financial-tools/70-reversal-fix-improve/+merge/200378
Your team Account Core Editors is requested to review the proposed merge of lp:~akretion-team/account-financial-tools/70-reversal-fix-improve into lp:account-financial-tools.
=== modified file 'account_reversal/account_reversal.py'
--- account_reversal/account_reversal.py 2013-01-14 12:19:55 +0000
+++ account_reversal/account_reversal.py 2014-01-03 09:23:55 +0000
@@ -65,6 +65,7 @@
period_obj = self.pool.get('account.period')
period_ctx = context.copy()
period_ctx['company_id'] = move.company_id.id
+ period_ctx['account_period_prefer_normal'] = True
if not reversal_period_id:
reversal_period_id = period_obj.find(
=== modified file 'account_reversal/wizard/account_move_reverse.py'
--- account_reversal/wizard/account_move_reverse.py 2013-01-04 11:11:41 +0000
+++ account_reversal/wizard/account_move_reverse.py 2014-01-03 09:23:55 +0000
@@ -62,15 +62,23 @@
}
def _next_period_first_date(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ res = False
+ period_ctx = context.copy()
+ period_ctx['account_period_prefer_normal'] = True
period_obj = self.pool.get('account.period')
- current_period_id = period_obj.find(cr, uid, context=context)[0]
- current_period = period_obj.browse(
- cr, uid, current_period_id, context=context)
- next_period_id = period_obj.next(
- cr, uid, current_period, 1, context=context)
- next_period = period_obj.browse(
- cr, uid, next_period_id, context=context)
- return next_period.date_start
+ today_period_id = period_obj.find(cr, uid, context=period_ctx)
+ if today_period_id:
+ today_period = period_obj.browse(
+ cr, uid, today_period_id[0], context=context)
+ next_period_id = period_obj.next(
+ cr, uid, today_period, 1, context=context)
+ if next_period_id:
+ next_period = period_obj.browse(
+ cr, uid, next_period_id, context=context)
+ res = next_period.date_start
+ return res
_defaults = {
'date': _next_period_first_date,
Follow ups