2010-08-09 11:14:53 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2010-01-18 08:38:26 +00:00
|
|
|
##############################################################################
|
2010-10-26 05:37:43 +00:00
|
|
|
#
|
2010-01-18 08:38:26 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
# Copyright (C) 2004-2008 PC Solutions (<http://pcsol.be>). All Rights Reserved
|
2010-08-09 11:14:53 +00:00
|
|
|
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
2010-01-18 08:38:26 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2010-08-09 11:14:53 +00:00
|
|
|
# it under the terms of the GNU Affero General Public License as
|
|
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
|
|
# License, or (at your option) any later version.
|
2010-01-18 08:38:26 +00:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-08-09 11:14:53 +00:00
|
|
|
# GNU Affero General Public License for more details.
|
2010-01-18 08:38:26 +00:00
|
|
|
#
|
2010-08-09 11:14:53 +00:00
|
|
|
# You should have received a copy of the GNU Affero General Public License
|
2010-10-26 05:37:43 +00:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-01-18 08:38:26 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
2010-10-26 05:37:43 +00:00
|
|
|
from osv import fields, osv
|
2010-01-18 08:38:26 +00:00
|
|
|
|
|
|
|
class account_journal(osv.osv):
|
|
|
|
_inherit = 'account.journal'
|
|
|
|
_columns = {
|
2011-09-25 21:00:20 +00:00
|
|
|
'journal_user': fields.boolean('PoS Payment Method', help="Check this box if this journal define a payment method that can be used in point of sales."),
|
2012-04-16 09:01:22 +00:00
|
|
|
|
2012-05-04 12:51:58 +00:00
|
|
|
'opening_control': fields.boolean('Opening Control', help="If you want the journal should be control at opening, check this option"),
|
|
|
|
'closing_control': fields.boolean('Closing Control', help="If you want the journal should be control at closing, check this option"),
|
2012-04-16 09:01:22 +00:00
|
|
|
|
2010-06-28 14:37:54 +00:00
|
|
|
}
|
2010-01-18 08:38:26 +00:00
|
|
|
_defaults = {
|
2012-04-16 09:01:22 +00:00
|
|
|
'opening_control' : True,
|
|
|
|
'closing_control' : True,
|
2010-06-28 14:37:54 +00:00
|
|
|
}
|
2010-10-27 04:29:13 +00:00
|
|
|
|
2010-01-18 08:38:26 +00:00
|
|
|
account_journal()
|
|
|
|
|
2010-06-28 14:37:54 +00:00
|
|
|
class account_cash_statement(osv.osv):
|
2010-01-18 08:38:26 +00:00
|
|
|
_inherit = 'account.bank.statement'
|
2010-04-06 11:30:21 +00:00
|
|
|
|
2012-04-16 09:01:22 +00:00
|
|
|
#def _equal_balance(self, cr, uid, cash_id, context=None):
|
|
|
|
# statement = self.browse(cr, uid, cash_id, context=context)
|
|
|
|
# if not statement.journal_id.check_dtls:
|
|
|
|
# return True
|
|
|
|
# if statement.journal_id.check_dtls and (statement.balance_end != statement.balance_end_cash):
|
|
|
|
# return False
|
|
|
|
# else:
|
|
|
|
# return True
|
2010-10-26 05:37:43 +00:00
|
|
|
|
2010-10-21 07:08:55 +00:00
|
|
|
def _get_cash_open_box_lines(self, cr, uid, context=None):
|
2010-10-13 08:59:44 +00:00
|
|
|
res = super(account_cash_statement,self)._get_cash_open_box_lines(cr, uid, context)
|
|
|
|
curr = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50]
|
|
|
|
for rs in curr:
|
|
|
|
dct = {
|
2010-10-21 07:08:55 +00:00
|
|
|
'pieces': rs,
|
|
|
|
'number': 0
|
2010-10-13 08:59:44 +00:00
|
|
|
}
|
|
|
|
res.append(dct)
|
|
|
|
res.sort()
|
|
|
|
return res
|
2010-10-26 05:37:43 +00:00
|
|
|
|
2010-10-21 07:08:55 +00:00
|
|
|
def _get_default_cash_close_box_lines(self, cr, uid, context=None):
|
2010-10-27 04:29:13 +00:00
|
|
|
res = super(account_cash_statement,self)._get_default_cash_close_box_lines(cr, uid, context=context)
|
2010-10-13 08:59:44 +00:00
|
|
|
curr = [0.01, 0.02, 0.05, 0.10, 0.20, 0.50]
|
|
|
|
for rs in curr:
|
|
|
|
dct = {
|
2010-10-21 07:08:55 +00:00
|
|
|
'pieces': rs,
|
|
|
|
'number': 0
|
2010-10-13 08:59:44 +00:00
|
|
|
}
|
|
|
|
res.append(dct)
|
|
|
|
res.sort()
|
|
|
|
return res
|
2010-10-26 05:37:43 +00:00
|
|
|
|
2012-05-07 13:09:46 +00:00
|
|
|
def search(self, cr, uid, domain, offset=0, limit=None, order=None, context=None, count=False):
|
|
|
|
if not context:
|
|
|
|
context = {}
|
|
|
|
pos_session_id = context.pop('pos_session_id', False) or False
|
|
|
|
if pos_session_id and isinstance(pos_session_id, (int, long)):
|
|
|
|
session = self.pool.get('pos.session').browse(cr, uid, pos_session_id, context=context)
|
|
|
|
return [
|
|
|
|
statement.id
|
|
|
|
for order in session.order_ids
|
|
|
|
for statement in order.statement_ids
|
|
|
|
]
|
|
|
|
return super(account_cash_statement, self).search(cr, uid, domain, offset=offset, limit=limit, order=order, context=context, count=count)
|
|
|
|
|
2010-06-28 14:37:54 +00:00
|
|
|
account_cash_statement()
|
2010-06-28 18:01:49 +00:00
|
|
|
|
2010-10-28 07:18:27 +00:00
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|