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-25 09:34:22 +0000 @@ -18,7 +18,6 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## - from openerp.osv.orm import Model from openerp.osv import fields, osv from openerp.tools.translate import _ @@ -104,6 +103,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', @@ -135,11 +142,15 @@ store=True, readonly=True), 'period_id': fields.many2one( - 'account.period', 'Period', required=False, readonly=True), + 'account.period', + 'Period', + required=False, + readonly=False, + invisible="True"), } _defaults = { - 'period_id': False, + 'period_id': _default_period, } def create(self, cr, uid, vals, context=None):
-- Mailing list: https://launchpad.net/~banking-addons-team Post to : [email protected] Unsubscribe : https://launchpad.net/~banking-addons-team More help : https://help.launchpad.net/ListHelp

