2010-01-18 08:38:26 +00:00
|
|
|
|
# encoding: utf-8
|
|
|
|
|
##############################################################################
|
|
|
|
|
#
|
|
|
|
|
# OpenERP, Open Source Management Solution
|
|
|
|
|
# Copyright (C) 2004-2008 PC Solutions (<http://pcsol.be>). All Rights Reserved
|
|
|
|
|
# $Id$
|
|
|
|
|
#
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
# (at your option) any later version.
|
|
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
|
#
|
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
#
|
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
|
|
import time
|
2010-06-28 14:37:54 +00:00
|
|
|
|
from osv import osv
|
|
|
|
|
from osv import fields
|
2010-01-18 08:38:26 +00:00
|
|
|
|
from mx import DateTime
|
|
|
|
|
from decimal import Decimal
|
|
|
|
|
from tools.translate import _
|
|
|
|
|
|
|
|
|
|
class account_journal(osv.osv):
|
2010-04-06 11:30:21 +00:00
|
|
|
|
|
2010-01-18 08:38:26 +00:00
|
|
|
|
_inherit = 'account.journal'
|
|
|
|
|
_columns = {
|
|
|
|
|
'auto_cash': fields.boolean('Automatic Opening', help="This field authorize the automatic creation of the cashbox"),
|
|
|
|
|
'special_journal':fields.boolean('Special Journal', help="Will put all the orders in waiting status till being accepted"),
|
|
|
|
|
'check_dtls': fields.boolean('Check Details', help="This field authorize Validation of Cashbox without checking ending details"),
|
2010-06-24 05:17:49 +00:00
|
|
|
|
'journal_users': fields.many2many('res.users','pos_journal_users','journal_id','user_id','Users'),
|
2010-06-28 14:37:54 +00:00
|
|
|
|
}
|
2010-01-18 08:38:26 +00:00
|
|
|
|
_defaults = {
|
|
|
|
|
'check_dtls': lambda *a:True,
|
|
|
|
|
'auto_cash': lambda *a:True,
|
2010-06-28 14:37:54 +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-04-06 11:30:21 +00:00
|
|
|
|
|
2010-01-18 08:38:26 +00:00
|
|
|
|
_inherit = 'account.bank.statement'
|
2010-04-06 11:30:21 +00:00
|
|
|
|
|
2010-06-28 15:06:31 +00:00
|
|
|
|
def _equal_balance(self, cr, uid, ids, statement, context={}):
|
2010-01-18 08:38:26 +00:00
|
|
|
|
|
2010-06-28 15:06:31 +00:00
|
|
|
|
if not statement.journal_id.check_dtls:
|
2010-06-28 14:37:54 +00:00
|
|
|
|
return True
|
2010-03-12 08:28:03 +00:00
|
|
|
|
|
2010-06-28 15:06:31 +00:00
|
|
|
|
if statement.journal_id.check_dtls and (statement.balance_end != statement.balance_end_cash):
|
2010-06-28 14:37:54 +00:00
|
|
|
|
return False
|
2010-01-18 08:38:26 +00:00
|
|
|
|
else:
|
2010-06-28 14:37:54 +00:00
|
|
|
|
return True
|
2010-06-15 12:50:36 +00:00
|
|
|
|
|
2010-06-28 14:37:54 +00:00
|
|
|
|
def _user_allow(self, cr, uid, ids, statement, context={}):
|
|
|
|
|
res = False
|
2010-06-28 15:06:31 +00:00
|
|
|
|
uids = []
|
|
|
|
|
for user in statement.journal_id.journal_users:
|
|
|
|
|
uids.append(user.id)
|
|
|
|
|
|
|
|
|
|
if uid in uids:
|
|
|
|
|
res = True
|
|
|
|
|
|
2010-06-28 14:37:54 +00:00
|
|
|
|
return res
|
|
|
|
|
|
|
|
|
|
account_cash_statement()
|
2010-06-28 18:01:49 +00:00
|
|
|
|
|
|
|
|
|
class account_bank_statement_line(osv.osv):
|
|
|
|
|
|
|
|
|
|
def _default_company(self, cr, uid, context={}):
|
|
|
|
|
""" To get default company for the object"
|
|
|
|
|
@param self: The object pointer
|
|
|
|
|
@param cr: the current row, from the database cursor,
|
|
|
|
|
@param uid: the current user’s ID for security checks,
|
|
|
|
|
@param ids: List of bank statement ids
|
|
|
|
|
@param context: A standard dictionary for contextual values
|
|
|
|
|
@return: company
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
|
|
|
|
if user.company_id:
|
|
|
|
|
return user.company_id.id
|
2010-06-28 18:05:36 +00:00
|
|
|
|
|
2010-06-28 18:01:49 +00:00
|
|
|
|
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
|
|
|
|
|
|
|
|
|
_inherit = 'account.bank.statement.line'
|
|
|
|
|
_columns = {
|
|
|
|
|
'company_id':fields.many2one('res.company', 'Company', required=True),
|
|
|
|
|
}
|
|
|
|
|
_defaults = {
|
2010-06-28 18:05:36 +00:00
|
|
|
|
'company_id': _default_company,
|
2010-06-28 18:01:49 +00:00
|
|
|
|
}
|
|
|
|
|
account_bank_statement_line()
|
|
|
|
|
|
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|