banking-addons-team team mailing list archive
-
banking-addons-team team
-
Mailing list archive
-
Message #00467
lp:~camptocamp/banking-addons/bank-statement-reconcile-70-restore_default_value into lp:banking-addons/bank-statement-reconcile-70
Nicolas Bessi - Camptocamp has proposed merging lp:~camptocamp/banking-addons/bank-statement-reconcile-70-restore_default_value into lp:banking-addons/bank-statement-reconcile-70.
Requested reviews:
Banking Addons Team (banking-addons-team)
For more details, see:
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-restore_default_value/+merge/154650
Restore default period in bank statement by taking context in account
--
https://code.launchpad.net/~camptocamp/banking-addons/bank-statement-reconcile-70-restore_default_value/+merge/154650
Your team Banking Addons Team is requested to review the proposed merge of lp:~camptocamp/banking-addons/bank-statement-reconcile-70-restore_default_value into lp:banking-addons/bank-statement-reconcile-70.
=== modified file 'account_statement_ext/statement.py'
--- account_statement_ext/statement.py 2013-03-01 14:33:32 +0000
+++ account_statement_ext/statement.py 2013-03-21 10:07:55 +0000
@@ -104,6 +104,14 @@
_inherit = "account.bank.statement"
+ def _default_period(self, cr, uid, context=None):
+ """
+ Statement default period
+ """
+ period_obj = self.pool.get('account.period')
+ periods = period_obj.find(cr, uid, dt=context.get('date'), context=context)
+ return periods and periods[0] or False
+
_columns = {
'profile_id': fields.many2one(
'account.statement.profile',
@@ -139,7 +147,7 @@
}
_defaults = {
- 'period_id': False,
+ 'period_id': _default_period,
}
def create(self, cr, uid, vals, context=None):
Follow ups