diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index fe3f93b492c..d3a58272b89 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -21,7 +21,6 @@ { "name" : "Accounting and Financial Management", "version" : "1.1", - "depends" : ["product", "analytic", "process","board"], "author" : "Tiny", "category": 'Generic Modules/Accounting', "description": """Financial and accounting module that covers: @@ -42,6 +41,7 @@ The processes like maintaining of general ledger is done through the defined fin grouping is maintained through journal) for a particular financial year and for preparation of vouchers there is a module named account_vouchers """, + "depends" : ["product", "analytic", "process","board"], 'website': 'http://www.openerp.com', 'init_xml': [], 'update_xml': [ @@ -119,7 +119,6 @@ module named account_vouchers "wizard/account_bs_report_view.xml" ], 'demo_xml': [ - #'demo/price_accuracy00.yml', 'account_demo.xml', 'project/project_demo.xml', 'project/analytic_account_demo.xml', diff --git a/addons/account/account.py b/addons/account/account.py index 0abdd2af7e0..4ed3b0d46c6 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -81,7 +81,7 @@ class account_payment_term(osv.osv): if amt: next_date = datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days) if line.days2 < 0: - next_date += relativedelta(day=line.days2) + next_date += relativedelta(day=31) if line.days2 > 0: next_date += relativedelta(day=line.days2, months=1) result.append( (next_date.strftime('%Y-%m-%d'), amt) ) @@ -136,7 +136,6 @@ class account_account_type(osv.osv): 'name': fields.char('Acc. Type Name', size=64, required=True, translate=True), 'code': fields.char('Code', size=32, required=True), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of account types."), - 'partner_account': fields.boolean('Partner account'), 'close_method': fields.selection([('none', 'None'), ('balance', 'Balance'), ('detail', 'Detail'), ('unreconciled', 'Unreconciled')], 'Deferral Method', required=True), 'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'), 'report_type':fields.selection([ @@ -366,11 +365,11 @@ class account_account(osv.osv): 'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."), 'code': fields.char('Code', size=64, required=True), 'type': fields.selection([ + ('view', 'View'), + ('other', 'Regular'), ('receivable', 'Receivable'), ('payable', 'Payable'), - ('view', 'View'), ('consolidation', 'Consolidation'), - ('other', 'Others'), ('closed', 'Closed'), ], 'Internal Type', required=True, help="This type is used to differentiate types with "\ "special effects in Open ERP: view can not have entries, consolidation are accounts that "\ @@ -586,7 +585,6 @@ class account_journal_column(osv.osv): for col in cols: if col in ('period_id', 'journal_id'): continue - result.append( (col, cols[col].string) ) result.sort() return result @@ -624,7 +622,7 @@ class account_journal(osv.osv): 'centralisation': fields.boolean('Centralised counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."), 'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"), 'group_invoice_lines': fields.boolean('Group invoice lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."), - 'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="The sequence gives the display order for a list of journals", required=True), + 'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="The sequence gives the display order for a list of journals", required=False), 'user_id': fields.many2one('res.users', 'User', help="The user responsible for this journal"), 'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'), 'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'), @@ -639,6 +637,7 @@ class account_journal(osv.osv): 'user_id': lambda self,cr,uid,context: uid, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } + def write(self, cr, uid, ids, vals, context=None): obj=[] if 'company_id' in vals: @@ -647,8 +646,58 @@ class account_journal(osv.osv): raise osv.except_osv(_('Warning !'), _('You cannot modify company of this journal as its related record exist in Entry Lines')) return super(account_journal, self).write(cr, uid, ids, vals, context=context) + def create_sequence(self, cr, uid, ids, context={}): + """ + Create new entry sequence for every new Joural + @param cr: cursor to database + @param user: id of current user + @param ids: list of record ids to be process + @param context: context arguments, like lang, time zone + @return: return a result + """ + + seq_pool = self.pool.get('ir.sequence') + seq_typ_pool = self.pool.get('ir.sequence.type') + + result = True + + journal = self.browse(cr, uid, ids[0], context) + code = journal.code.lower() + types = { + 'name':journal.name, + 'code':code + } + type_id = seq_typ_pool.create(cr, uid, types) + + seq = { + 'name':journal.name, + 'code':code, + 'active':True, + 'prefix':journal.code + "/%(year)s/", + 'padding':4, + 'number_increment':1 + } + seq_id = seq_pool.create(cr, uid, seq) + + res = {} + if not journal.sequence_id: + res.update({ + 'sequence_id':seq_id + }) + + if not journal.invoice_sequence_id: + res.update({ + 'invoice_sequence_id':seq_id + }) + + result = self.write(cr, uid, [journal.id], res) + + return result + def create(self, cr, uid, vals, context={}): journal_id = super(account_journal, self).create(cr, uid, vals, context) + self.create_sequence(cr, uid, [journal_id], context) + # journal_name = self.browse(cr, uid, [journal_id])[0].code # periods = self.pool.get('account.period') # ids = periods.search(cr, uid, [('date_stop','>=',time.strftime('%Y-%m-%d'))]) @@ -670,14 +719,41 @@ class account_journal(osv.osv): ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context) return self.name_get(cr, user, ids, context=context) - def onchange_type(self, cr, uid, ids, type): - res={} - for line in self.browse(cr, uid, ids): - if type == 'situation': - res= {'value':{'centralisation': True}} - else: - res= {'value':{'centralisation': False}} - return res + def onchange_type(self, cr, uid, ids, type, currency): + data_pool = self.pool.get('ir.model.data') + user_pool = self.pool.get('res.users') + + type_map = { + 'sale':'account_sp_journal_view', + 'sale_refund':'account_sp_refund_journal_view', + 'purchase':'account_sp_journal_view', + 'purchase_refund':'account_sp_refund_journal_view', + 'expense':'account_sp_journal_view', + 'cash':'account_journal_bank_view', + 'bank':'account_journal_bank_view', + 'general':'account_journal_view', + 'situation':'account_journal_view' + } + + res = {} + + view_id = type_map.get(type, 'general') + + user = user_pool.browse(cr, uid, uid) + if type in ('cash', 'bank') and currency and user.company_id.currency_id.id != currency: + view_id = 'account_journal_bank_view_multi' + + data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=',view_id)]) + data = data_pool.browse(cr, uid, data_id[0]) + + res.update({ + 'centralisation':type == 'situation', + 'view_id':data.res_id, + }) + + return { + 'value':res + } account_journal() @@ -687,8 +763,7 @@ class account_fiscalyear(osv.osv): _columns = { 'name': fields.char('Fiscal Year', size=64, required=True), 'code': fields.char('Code', size=6, required=True), - 'company_id': fields.many2one('res.company', 'Company', - help="Keep empty if the fiscal year belongs to several companies.", required=True), + 'company_id': fields.many2one('res.company', 'Company', required=True), 'date_start': fields.date('Start Date', required=True), 'date_stop': fields.date('End Date', required=True), 'period_ids': fields.one2many('account.period', 'fiscalyear_id', 'Periods'), @@ -772,7 +847,7 @@ class account_period(osv.osv): 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True), 'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', readonly=True, help='When monthly periods are created. The state is \'Draft\'. At the end of monthly period it is in \'Done\' state.'), - 'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True) + 'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company'), } _defaults = { 'state': lambda *a: 'draft', @@ -1144,7 +1219,7 @@ class account_move(osv.osv): return amount def _centralise(self, cr, uid, move, mode, context=None): - assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection + assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection if context is None: context = {} @@ -1200,12 +1275,15 @@ class account_move(osv.osv): # # Validate a balanced move. If it is a centralised journal, create a move. # + def validate(self, cr, uid, ids, context={}): if context and ('__last_update' in context): del context['__last_update'] - ok = True + + valid_moves = [] #Maintains a list of moves which can be responsible to create analytic entries + for move in self.browse(cr, uid, ids, context): - #unlink analytic lines on move_lines + # Unlink old analytic lines on move_lines for obj_line in move.line_id: for obj in obj_line.analytic_lines: self.pool.get('account.analytic.line').unlink(cr,uid,obj.id) @@ -1214,7 +1292,7 @@ class account_move(osv.osv): amount = 0 line_ids = [] line_draft_ids = [] - company_id=None + company_id = None for line in move.line_id: amount += line.debit - line.credit line_ids.append(line.id) @@ -1230,52 +1308,60 @@ class account_move(osv.osv): if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id): raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name))) - # Check that the move balances, the tolerance for debit/credit must - # be smaller than the smallest value according to price accuracy - # (hence the +1 below) - # Example: - # difference == 0.01 is OK iff price_accuracy <= 1! - # difference == 0.0001 is OK iff price_accuracy <= 3! - if abs(amount) < 10 ** -(int(config['price_accuracy'])+1): + if abs(amount) < 10 ** -4: + # If the move is balanced + # Add to the list of valid moves + # (analytic lines will be created later for valid moves) + valid_moves.append(move) + + # Check whether the move lines are confirmed + if not len(line_draft_ids): continue + # Update the move lines (set them as valid) + self.pool.get('account.move.line').write(cr, uid, line_draft_ids, { 'journal_id': move.journal_id.id, 'period_id': move.period_id.id, 'state': 'valid' }, context, check=False) - todo = [] + account = {} account2 = {} - if journal.type not in ('purchase','sale'): - continue - for line in move.line_id: - code = amount = 0 - key = (line.account_id.id, line.tax_code_id.id) - if key in account2: - code = account2[key][0] - amount = account2[key][1] * (line.debit + line.credit) - elif line.account_id.id in account: - code = account[line.account_id.id][0] - amount = account[line.account_id.id][1] * (line.debit + line.credit) - if (code or amount) and not (line.tax_code_id or line.tax_amount): - self.pool.get('account.move.line').write(cr, uid, [line.id], { - 'tax_code_id': code, - 'tax_amount': amount - }, context, check=False) + if journal.type in ('purchase','sale'): + for line in move.line_id: + code = amount = 0 + key = (line.account_id.id, line.tax_code_id.id) + if key in account2: + code = account2[key][0] + amount = account2[key][1] * (line.debit + line.credit) + elif line.account_id.id in account: + code = account[line.account_id.id][0] + amount = account[line.account_id.id][1] * (line.debit + line.credit) + if (code or amount) and not (line.tax_code_id or line.tax_amount): + self.pool.get('account.move.line').write(cr, uid, [line.id], { + 'tax_code_id': code, + 'tax_amount': amount + }, context, check=False) + elif journal.centralisation: + # If the move is not balanced, it must be centralised... + + # Add to the list of valid moves + # (analytic lines will be created later for valid moves) + valid_moves.append(move) + # - # Compute VAT + # Update the move lines (set them as valid) # - continue - if journal.centralisation: self._centralise(cr, uid, move, 'debit', context=context) self._centralise(cr, uid, move, 'credit', context=context) self.pool.get('account.move.line').write(cr, uid, line_draft_ids, { 'state': 'valid' }, context, check=False) - continue else: + # We can't validate it (it's unbalanced) + # Setting the lines as draft self.pool.get('account.move.line').write(cr, uid, line_ids, { 'journal_id': move.journal_id.id, 'period_id': move.period_id.id, @@ -1283,13 +1369,12 @@ class account_move(osv.osv): #'tax_amount': False, 'state': 'draft' }, context, check=False) - ok = False - if ok: - list_ids = [] - for tmp in move.line_id: - list_ids.append(tmp.id) - self.pool.get('account.move.line').create_analytic_lines(cr, uid, list_ids, context) - return ok + # Create analytic lines for the valid moves + for record in valid_moves: + self.pool.get('account.move.line').create_analytic_lines(cr, uid, [line.id for line in record.line_id], context) + + return len(valid_moves) > 0 + account_move() class account_move_reconcile(osv.osv): @@ -2057,7 +2142,6 @@ class account_add_tmpl_wizard(osv.osv_memory): def _get_def_cparent(self, cr, uid, context): acc_obj=self.pool.get('account.account') tmpl_obj=self.pool.get('account.account.template') - #print "Searching for ",context tids=tmpl_obj.read(cr, uid, [context['tmpl_ids']], ['parent_id']) if not tids or not tids[0]['parent_id']: return False @@ -2099,7 +2183,6 @@ class account_add_tmpl_wizard(osv.osv_memory): # 'tax_ids': [(6,0,tax_ids)], todo!! 'company_id': company_id, } - # print "Creating:", vals new_account = acc_obj.create(cr, uid, vals) return {'type':'state', 'state': 'end' } @@ -2120,7 +2203,7 @@ class account_tax_code_template(osv.osv): 'info': fields.text('Description'), 'parent_id': fields.many2one('account.tax.code.template', 'Parent Code', select=True), 'child_ids': fields.one2many('account.tax.code.template', 'parent_id', 'Child Codes'), - 'sign': fields.float('Sign for parent', required=True), + 'sign': fields.float('Sign for parent', required=True, help="Choose 1.00 to add the total to the parent account or -1.00 to subtract it"), 'notprintable':fields.boolean("Not Printable in Invoice", help="Check this box if you don't want any VAT related to this Tax Code to appear on invoices"), } @@ -2152,7 +2235,7 @@ class account_chart_template(osv.osv): _columns={ 'name': fields.char('Name', size=64, required=True), - 'account_root_id': fields.many2one('account.account.template','Root Account',required=True,domain=[('parent_id','=',False)]), + 'account_root_id': fields.many2one('account.account.template','Root Account',required=True,domain=[('parent_id','=',False)], help=""), 'tax_code_root_id': fields.many2one('account.tax.code.template','Root Tax Code',required=True,domain=[('parent_id','=',False)]), 'tax_template_ids': fields.one2many('account.tax.template', 'chart_template_id', 'Tax Template List', help='List of all the taxes that have to be installed by the wizard'), 'bank_account_view_id': fields.many2one('account.account.template','Bank Account',required=True), @@ -2329,6 +2412,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): obj_acc_template = self.pool.get('account.account.template') obj_fiscal_position_template = self.pool.get('account.fiscal.position.template') obj_fiscal_position = self.pool.get('account.fiscal.position') + data_pool = self.pool.get('ir.model.data') # Creating Account obj_acc_root = obj_multi.chart_template_id.account_root_id @@ -2439,7 +2523,10 @@ class wizard_multi_charts_accounts(osv.osv_memory): # Creating Journals vals_journal={} - view_id = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Journal View')])[0] + data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_view')]) + data = data_pool.browse(cr, uid, data_id[0]) + view_id = data.res_id + seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0] if obj_multi.seq_journal: @@ -2476,8 +2563,15 @@ class wizard_multi_charts_accounts(osv.osv_memory): obj_journal.create(cr,uid,vals_journal) # Bank Journals - view_id_cash = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Cash Journal View')])[0] - view_id_cur = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Multi-Currency Cash Journal View')])[0] + data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')]) + data = data_pool.browse(cr, uid, data_id[0]) + view_id_cash = data.res_id + #view_id_cash = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Bank/Cash Journal View')])[0] #TOFIX: why put fix name + + data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view_multi')]) + data = data_pool.browse(cr, uid, data_id[0]) + ref_acc_bank = data.res_id + #ref_acc_bank = self.pool.get('account.journal.view').search(cr, uid, [('name','=','Bank/Cash Journal (Multi-Currency) View')])[0] #TOFIX: why put fix name ref_acc_bank = obj_multi.chart_template_id.bank_account_view_id current_num = 1 diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 572cb9d04fd..e0d31b9cf18 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -159,7 +159,7 @@ class account_bank_statement(osv.osv): 'period_id': _get_period, } - def button_confirm(self, cr, uid, ids, context={}): + def button_confirm_bank(self, cr, uid, ids, context={}): done = [] res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 2a7922c13b2..1a0727e626f 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -67,19 +67,25 @@ class account_cash_statement(osv.osv): _inherit = 'account.bank.statement' - def _get_starting_balance(self, cr, uid, ids, name, arg, context=None): + def _get_starting_balance(self, cr, uid, ids, context=None): - """ Find starting balance " + """ Find starting balance @param name: Names of fields. @param arg: User defined arguments @return: Dictionary of values. - """ + """ res ={} for statement in self.browse(cr, uid, ids): amount_total=0.0 + + if statement.journal_id.type not in('cash'): + continue + for line in statement.starting_details_ids: amount_total+= line.pieces * line.number - res[statement.id]=amount_total + res[statement.id] = { + 'balance_start':amount_total + } return res def _balance_end_cash(self, cr, uid, ids, name, arg, context=None): @@ -116,7 +122,7 @@ class account_cash_statement(osv.osv): """ To get default journal for the object" @param name: Names of fields. @return: journal - """ + """ company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)]) if journal: @@ -166,11 +172,10 @@ class account_cash_statement(osv.osv): company_id = company_pool.search(cr, uid, [])[0] return company_id - + _columns = { 'company_id':fields.many2one('res.company', 'Company', required=False), 'journal_id': fields.many2one('account.journal', 'Journal', required=True), - 'balance_start': fields.function(_get_starting_balance, store=True, method=True, string='Opening Balance', type='float',digits=(16,2), help="Opening balance based on cashBox"), 'balance_end_real': fields.float('Closing Balance', digits=(16,2), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"), 'state': fields.selection( [('draft', 'Draft'), @@ -178,7 +183,7 @@ class account_cash_statement(osv.osv): ('open','Open')], 'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"), 'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, store=True, string="Cash Transaction", help="Total cash transactions"), 'closing_date':fields.datetime("Closed On"), - 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on transactions"), + 'balance_end': fields.function(_end_balance, method=True, store=True, string='Balance', help="Closing balance based on Starting Balance and Cash Transactions"), 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"), 'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'), 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'), @@ -205,8 +210,31 @@ class account_cash_statement(osv.osv): for i in starting_details_ids: if i and i[0] and i[1]: i[0], i[1] = 0, 0 - res = super(account_cash_statement, self).create(cr, uid, vals, context=context) - return res + res_id = super(account_cash_statement, self).create(cr, uid, vals, context=context) + res = self._get_starting_balance(cr, uid, [res_id]) + for rs in res: + super(account_cash_statement, self).write(cr, uid, rs, res.get(rs)) + return res_id + + def write(self, cr, uid, ids, vals, context=None): + """ + Update redord(s) comes in {ids}, with new value comes as {vals} + return True on success, False otherwise + + @param cr: cursor to database + @param user: id of current user + @param ids: list of record ids to be update + @param vals: dict of new values to be set + @param context: context arguments, like lang, time zone + + @return: True on success, False otherwise + """ + + super(account_cash_statement, self).write(cr, uid, ids, vals) + res = self._get_starting_balance(cr, uid, ids) + for rs in res: + super(account_cash_statement, self).write(cr, uid, rs, res.get(rs)) + return True def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}): """ Changes balance start and starting details if journal_id changes" @@ -251,8 +279,8 @@ class account_cash_statement(osv.osv): statement = statement_pool.browse(cr, uid, ids[0]) if not self._user_allow(cr, uid, ids, statement, context={}): - raise osv.except_osv(_('Error !'), _('User %s have no rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name))) - + raise osv.except_osv(_('Error !'), _('User %s does not have rights to access %s journal !' % (statement.user_id.name, statement.journal_id.name))) + number = self.pool.get('ir.sequence').get(cr, uid, statement.journal_id.sequence_id.code) if len(statement.starting_details_ids) > 0: @@ -285,7 +313,7 @@ class account_cash_statement(osv.osv): self.write(cr, uid, ids, vals) return True - def button_confirm(self, cr, uid, ids, context={}): + def button_confirm_cash(self, cr, uid, ids, context={}): """ Check the starting and ending detail of statement @return: True @@ -296,20 +324,24 @@ class account_cash_statement(osv.osv): account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') - + company_currency_id = res_users_obj.browse(cr, uid, uid, context=context).company_id.currency_id.id for st in self.browse(cr, uid, ids, context): + + self.write(cr, uid, [st.id], {'balance_end_real':st.balance_end}) + st.balance_end_real = st.balance_end + if not st.state == 'open': continue if not self._equal_balance(cr, uid, ids, st, context): - raise osv.except_osv(_('Error !'), _('Cash balance is not matching with closing balance !')) - - if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001): - raise osv.except_osv(_('Error !'), - _('The statement balance is incorrect !\n') + - _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end)) + raise osv.except_osv(_('Error !'), _('CashBox Balance is not matching with Calculated Balance !')) + +# if not (abs((st.balance_end or 0.0) - st.balance_end_real) < 0.0001): +# raise osv.except_osv(_('Error !'), +# _('The statement balance is incorrect !\n') + +# _('The expected balance (%.2f) is different than the computed one. (%.2f)') % (st.balance_end_real, st.balance_end)) if (not st.journal_id.default_credit_account_id) \ or (not st.journal_id.default_debit_account_id): raise osv.except_osv(_('Configuration Error !'), @@ -435,7 +467,7 @@ class account_cash_statement(osv.osv): if move.reconcile_id and move.reconcile_id.line_ids: torec += map(lambda x: x.id, move.reconcile_id.line_ids) - #try: + if abs(move.reconcile_amount-move.amount)<0.0001: writeoff_acc_id = False @@ -447,13 +479,16 @@ class account_cash_statement(osv.osv): account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) else: account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) - #except: - # raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount)) if st.journal_id.entry_posted: account_move_obj.write(cr, uid, [move_id], {'state':'posted'}) done.append(st.id) - self.write(cr, uid, done, {'state':'confirm'}, context=context) + + vals = { + 'state':'confirm', + 'closing_date':time.strftime("%Y-%m-%d %H:%M:%S") + } + self.write(cr, uid, done, vals, context=context) return True def button_cancel(self, cr, uid, ids, context={}): diff --git a/addons/account/account_demo.xml b/addons/account/account_demo.xml index 0b4ee8f097d..a8a1d1405cd 100644 --- a/addons/account/account_demo.xml +++ b/addons/account/account_demo.xml @@ -3,8 +3,8 @@ + Fiscal year + --> @@ -15,8 +15,8 @@ + Fiscal Periods + --> diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index fc10c58cc8f..99d1181fb7b 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -205,7 +205,7 @@ + + diff --git a/addons/account_voucher_payment/account_voucher_payment_wizard.xml b/addons/account_voucher_payment/account_voucher_payment_wizard.xml deleted file mode 100644 index 0551b1bbcb5..00000000000 --- a/addons/account_voucher_payment/account_voucher_payment_wizard.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - diff --git a/addons/account_voucher_payment/account_voucher_unreconcile.py b/addons/account_voucher_payment/account_voucher_unreconcile.py deleted file mode 100644 index f36af98dc1c..00000000000 --- a/addons/account_voucher_payment/account_voucher_unreconcile.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# 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. -# -# 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import wizard -import pooler - -_info_form = ''' -
- - -