[PYTHON] -pdb import in pos_box
[burette/nrt_point_of_sale.git] / account_cash_statement.py
1 # -*- coding: utf-8 -*-
2 ##############################################################################
3 #
4 # Non-real time point of sale module for OpenERP, Permit user to record his
5 # sales in point of sale interface in non-real time.
6 # Copyright (C) 2016 L'Heureux Cyclage (<http://www.heureux-cyclage>)
7 # Ludovic CHEVALIER
8 #
9 # This file is a part of Non-real time point of sale
10 #
11 # Non-real time point of sale is free software: you can redistribute it
12 # and/or modify it under the terms of the GNU General Public License as
13 # published by the Free Software Foundation, either version 3 of the
14 # License, or (at your option) any later version.
15 #
16 # Non-real time point of sale is distributed in the hope that it will be
17 # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 # Public License for more details.
20 #
21 # You should have received a copy of the GNU General Public License
22 # along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #
24 ##############################################################################
25
26 from openerp.osv import osv
27 from openerp.osv import orm
28 from openerp.osv import fields
29
30
31 class account_cash_statement(orm.Model):
32 _inherit = 'account.bank.statement'
33
34 def button_confirm_cash(self, cr, uid, ids, context=None):
35 """
36 Put same closing date for account_bank_statement as pos session start_at date.
37 """
38 self.pool.get('pos.session')
39 res = super(account_cash_statement, self).button_confirm_cash(cr, uid, ids, context=context)
40 for statement in self.browse(cr, uid, ids, context=context):
41 if statement.pos_session_id:
42 return self.write(cr, uid, [statement.id], {'closing_date': statement.pos_session_id.start_at}, context=context)
43 return res
44
45 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: