diff --git a/addons/account/account.py b/addons/account/account.py index 208bf1d6f68..3dc5c36c889 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1162,32 +1162,36 @@ class account_move(osv.osv): ] def post(self, cr, uid, ids, context=None): + if context is None: + context = {} invoice = context.get('invoice', False) valid_moves = self.validate(cr, uid, ids, context) - if valid_moves: - for move in self.browse(cr, uid, valid_moves): - if move.name =='/': - new_name = False - journal = move.journal_id + + if not valid_moves: + raise osv.except_osv(_('Integrity Error !'), _('You cannot validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + + for move in self.browse(cr, uid, valid_moves): + if move.name =='/': + new_name = False + journal = move.journal_id - if invoice and invoice.internal_number: - new_name = invoice.internal_number + if invoice and invoice.internal_number: + new_name = invoice.internal_number + else: + if journal.sequence_id: + c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} + new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) else: - if journal.sequence_id: - c = {'fiscalyear_id': move.period_id.fiscalyear_id.id} - new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id, context=c) - else: - raise osv.except_osv(_('Error'), _('No sequence defined in the journal !')) + raise osv.except_osv(_('Error'), _('No sequence defined on the journal !')) - if new_name: - self.write(cr, uid, [move.id], {'name':new_name}) + if new_name: + self.write(cr, uid, [move.id], {'name':new_name}) - cr.execute('UPDATE account_move '\ - 'SET state=%s '\ - 'WHERE id IN %s', - ('posted', tuple(valid_moves),)) - else: - raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non-balanced entry !\nMake sure you have configured Payment Term properly !\nIt should contain atleast one Payment Term Line with type "Balance" !')) + cr.execute('UPDATE account_move '\ + 'SET state=%s '\ + 'WHERE id IN %s', + ('posted', tuple(valid_moves),)) + return True def button_validate(self, cursor, user, ids, context=None): diff --git a/addons/account/account_unit_test.xml b/addons/account/account_unit_test.xml index 97fba380214..e4178517361 100644 --- a/addons/account/account_unit_test.xml +++ b/addons/account/account_unit_test.xml @@ -14,6 +14,13 @@ Test invoice 1 + + Test Tax + 5.00 + 100.00 + + + Basic computer with Dvorak keyboard and left-handed mouse @@ -27,7 +34,7 @@ 800 2 - + EUR diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 8fca640bdf7..fd818786e33 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -236,6 +236,17 @@ + + account.treasory.graph + account.account + graph + + + + + + + Accounts account.account diff --git a/addons/account/board_account_view.xml b/addons/account/board_account_view.xml index 5ae2890fd20..190479f63a7 100644 --- a/addons/account/board_account_view.xml +++ b/addons/account/board_account_view.xml @@ -20,7 +20,22 @@ graph,tree [('type','=','income')] - + + Company Analysis + account.entries.report + form + tree,graph + {'group_by':['user_type'], 'group_by_no_leaf':1} + + + + Treasory + account.account + form + graph,tree + [('type','=','liquidity')] + + board.account.form board.board @@ -30,10 +45,12 @@ + + - + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 1aa4e30d95d..2e81c7b054f 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -650,18 +650,19 @@ class account_invoice(osv.osv): return ok def button_reset_taxes(self, cr, uid, ids, context=None): - if not context: + if context is None: context = {} + ctx = context.copy() ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) - partner = self.browse(cr, uid, id, context=context).partner_id + partner = self.browse(cr, uid, id, context=ctx).partner_id if partner.lang: - context.update({'lang': partner.lang}) - for taxe in ait_obj.compute(cr, uid, id, context=context).values(): + ctx.update({'lang': partner.lang}) + for taxe in ait_obj.compute(cr, uid, id, context=ctx).values(): ait_obj.create(cr, uid, taxe) # Update the stored value (fields.function), so we write to trigger recompute - self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=context) + self.pool.get('account.invoice').write(cr, uid, ids, {'invoice_line':[]}, context=ctx) return True def button_compute(self, cr, uid, ids, context=None, set_total=False): @@ -1621,6 +1622,7 @@ class account_invoice_tax(osv.osv): tax_grouped[key]['tax_amount'] += val['tax_amount'] for t in tax_grouped.values(): + t['base'] = cur_obj.round(cr, uid, cur, t['base']) t['amount'] = cur_obj.round(cr, uid, cur, t['amount']) t['base_amount'] = cur_obj.round(cr, uid, cur, t['base_amount']) t['tax_amount'] = cur_obj.round(cr, uid, cur, t['tax_amount']) diff --git a/addons/account/report/account_aged_partner_balance.rml b/addons/account/report/account_aged_partner_balance.rml index 7f90ae0983b..ab57db23a27 100644 --- a/addons/account/report/account_aged_partner_balance.rml +++ b/addons/account/report/account_aged_partner_balance.rml @@ -168,22 +168,22 @@ Partners - [[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]]([[ company.currency_id.code ]]) + [[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]] - [[ data['form']['4']['name'] ]]([[ company.currency_id.code ]]) + [[ data['form']['4']['name'] ]] - [[ data['form']['3']['name'] ]]([[ company.currency_id.code ]]) + [[ data['form']['3']['name'] ]] - [[ data['form']['2']['name'] ]]([[ company.currency_id.code ]]) + [[ data['form']['2']['name'] ]] - [[ data['form']['1']['name'] ]]([[ company.currency_id.code ]]) + [[ data['form']['1']['name'] ]] - [[ data['form']['0']['name'] ]]([[ company.currency_id.code ]]) + [[ data['form']['0']['name'] ]] Total diff --git a/addons/account/report/account_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml index a1f7b25d379..5edd2ffe021 100644 --- a/addons/account/report/account_balance_sheet_horizontal.rml +++ b/addons/account/report/account_balance_sheet_horizontal.rml @@ -233,7 +233,7 @@ [[ '. '*(a['level']-1) ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]] - [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance'])) ]] [[ company.currency_id.symbol ]] + [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code'] and a['name']) and formatLang(abs(a['balance'])) or removeParentNode('font')]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/account_central_journal.rml b/addons/account/report/account_central_journal.rml index 4bf23b3d4b6..d6e53c4f3c7 100644 --- a/addons/account/report/account_central_journal.rml +++ b/addons/account/report/account_central_journal.rml @@ -295,7 +295,7 @@ [[ display_currency(data) == False or removeParentNode('blockTable') ]] - Total([[ company.currency_id.code]]): + Total: [[ formatLang( sum_debit(o.period_id.id, o.journal_id.id)) ]] [[ formatLang( sum_credit(o.period_id.id, o.journal_id.id)) ]] diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index 081328d89fb..45131718db9 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -48,6 +48,19 @@ + + account.company.analysis.tree + account.entries.report + tree + + + + + + + + + account.entries.report.search account.entries.report diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml index 84a9ee6a780..61113212c2d 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -270,7 +270,7 @@ Balance - Total:([[ company.currency_id.code]]) + Total: [[ formatLang(sum_debit()) ]] [[ formatLang( sum_credit()) ]] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 1321bdea750..9d23454fcbb 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -263,13 +263,13 @@ - + [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] - [[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]] + [[ formatLang(sum_debit_account(o), dp='Account') ]] + [[ formatLang(sum_credit_account(o), dp='Account') ]] + [[ formatLang(sum_balance_account(o), dp='Account') ]] [[ company.currency_id.symbol ]] + [[ o.currency_id and formatLang(sum_currency_amount_account(o), dp='Account') + o.currency_id.code or '' ]] @@ -292,9 +292,9 @@ [[ line['move'] ]] [[ line['lname'] ]] [[ strip_name(line['line_corresp'].replace(', ',','),40) ]] - [[ formatLang(line['debit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['credit'], digits=get_digits(dp='Account')) ]] - [[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(line['debit'], dp='Account') ]] + [[ formatLang(line['credit'], dp='Account') ]] + [[ formatLang(line['progress'], dp='Account') ]] [[ company.currency_id.symbol ]] [[ formatLang(line['amount_currency'] or '')]] [[ line['currency_code'] or '' ]] @@ -327,9 +327,9 @@ [[ '..'*(o.level-1) ]][[ o.code ]] [[ o.name ]] - [[ formatLang(sum_debit_account(o), digits=get_digits(dp='Account')) ]] - [[ formatLang(sum_credit_account(o), digits=get_digits(dp=Account)) ]] - [[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]] + [[ formatLang(sum_debit_account(o), dp='Account') ]] + [[ formatLang(sum_credit_account(o), dp='Account') ]] + [[ formatLang(sum_balance_account(o), dp='Account') ]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 7de67780056..ec0adbdc400 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -289,7 +289,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -359,7 +359,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ line['ref'] ]] - [[ line['name'] ]] @@ -391,7 +391,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -472,7 +472,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ (line['ref'] or '') + ' ' + line['name'] ]] diff --git a/addons/account/report/account_partner_ledger_other.rml b/addons/account/report/account_partner_ledger_other.rml index 53cb0d46d83..a49616e4427 100644 --- a/addons/account/report/account_partner_ledger_other.rml +++ b/addons/account/report/account_partner_ledger_other.rml @@ -443,7 +443,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -506,7 +506,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ (line['ref'] or '') + ' ' + line['name'] ]] @@ -536,7 +536,7 @@ Ref. - A/c No.- Name + Account Entry Label @@ -611,7 +611,7 @@ [[ line['move_name'] ]] - [[ line['a_code'] ]] - [[ line['a_name'] ]] + [[ line['a_code'] ]] [[ (line['ref'] or '') + ' ' + line['name'] ]] diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml index d55b2e93a43..203c6c9f02c 100644 --- a/addons/account/report/account_profit_horizontal.rml +++ b/addons/account/report/account_profit_horizontal.rml @@ -240,7 +240,7 @@ - [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance1'])) ]] [[ company.currency_id.symbol ]] + [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code1'] and a['name1']) and formatLang(abs(a['balance1'])) or removeParentNode('font') ]] [[ company.currency_id.symbol ]] diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml index a0748e281ac..d3d2c77e47a 100644 --- a/addons/account/report/overdue.rml +++ b/addons/account/report/overdue.rml @@ -46,11 +46,13 @@ - - - - - + + + + + + + @@ -116,7 +118,7 @@ Document: Customer account statement Date: [[ formatLang(time.strftime('%Y-%m-%d'),date=True) ]] - Customer Ref: [[ o.ref or '' ]] + Customer Ref: [[ o.ref or ' ']] @@ -181,10 +183,10 @@ [[ line['date_maturity'] and formatLang(line['date_maturity'],date=True) or '' ]] - [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]] + [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]] - [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] + [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]] [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and formatLang(line['debit'] - line['credit']) ]] [[ company.currency_id.symbol ]] @@ -195,7 +197,7 @@ - + @@ -206,7 +208,7 @@ Sub-Total : - [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] + [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]] [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]] @@ -220,6 +222,8 @@ + + @@ -230,25 +234,21 @@ Balance : - [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] + [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]] - - - - - - - - - - - + + + + + + + Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.symbol ]]. diff --git a/addons/account/report/tax_report.rml b/addons/account/report/tax_report.rml index 9ad4ff56112..2434437e803 100644 --- a/addons/account/report/tax_report.rml +++ b/addons/account/report/tax_report.rml @@ -104,7 +104,7 @@ - Taxes + Tax Statement Tax Name diff --git a/addons/account/test/account_report.yml b/addons/account/test/account_report.yml index 7e4295da45b..4bc3b807d28 100644 --- a/addons/account/test/account_report.yml +++ b/addons/account/test/account_report.yml @@ -1,6 +1,6 @@ - In order to test the PDF reports defined on an invoice, we will print an Invoice Report -- +- !python {model: account.invoice}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.test_invoice_1')], {}, {}) @@ -9,7 +9,7 @@ - In order to test the PDF reports defined on a partner, we will print the Overdue Report -- +- !python {model: res.partner}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.overdue').create(cr, uid, [ref('base.res_partner_asus'),ref('base.res_partner_agrolait'),ref('base.res_partner_c2c')], {}, {}) @@ -18,7 +18,7 @@ - In order to test the PDF reports defined on Account Move, we will print the Voucher Report -- +- !python {model: account.move}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.move.voucher').create(cr, uid, [ref('account.account_move_0')], {}, {}) @@ -30,28 +30,30 @@ - !record {model: account.tax.code, id: account_tax_code_0}: name : Tax Code Test + sign : 10.00 - Print Tax Code entries report -- +- !python {model: account.tax.code}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.tax.code.entries').create(cr, uid, [ref('account_tax_code_0')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-tax-code-entries.'+format), 'wb+').write(data) + - Print Vat Declaration Report - !python {model: account.tax.code}: | import netsvc, tools, os data_dict = {'model': 'ir.ui.menu', 'form': {'based_on': 'invoices','company_id':ref('base.main_company'),'periods':[]}} - (data, format) = netsvc.LocalService('report.account.vat.declaration').create(cr, uid, [ref("account_tax_code_0")], data_dict, {}) + (data, format) = netsvc.LocalService('report.account.vat.declaration').create(cr, uid, [ref("account_move_0")], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-vat-declaration.'+format), 'wb+').write(data) - In order to test the PDF reports defined on an invoice, we will print an invoice -- +- !python {model: account.invoice}: | import netsvc, tools, os (data, format) = netsvc.LocalService('report.account.invoice').create(cr, uid, [ref('account.test_invoice_1')], {}, {}) @@ -84,9 +86,9 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'ir.ui.menu', 'form': {'chart_account_id':ref('account.chart0'),'initial_balance': 1, 'periods': period_list,'journal_ids':journal_ids, 'page_split': 0, 'date_from': time.strftime('%Y-%m-%d'), 'period_length': 30, 'amount_currency': 0,'query_line' : query_line, 'result_selection': 'customer','direction_selection': 'past','fiscalyear_id':fy_id}} data_dict['form'].update(res) (data, format) = netsvc.LocalService('report.account.aged_trial_balance').create(cr, uid, [], data_dict, {}) @@ -122,10 +124,10 @@ (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [ref('account.bal'),ref('account.gpf')], data_dict, {'periods': []}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal.'+format), 'wb+').write(data) - + data_dict.update({'model': 'ir.ui.menu'}) data_dict['form'].update({'active_ids':[ref('account.bal'),ref('account.gpf')]}) - + (data, format) = netsvc.LocalService('report.account.account.balance').create(cr, uid, [], data_dict, {'periods': []}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-account_balance-normal-menu.'+format), 'wb+').write(data) @@ -145,16 +147,16 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, journal_period_ids, data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-central_journal.'+format), 'wb+').write(data) - + data_dict.update({'model': 'ir.ui.menu'}) data_dict['form'].update({'active_ids':journal_period_ids}) - + (data, format) = netsvc.LocalService('report.account.central.journal').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-central_journal-menu.'+format), 'wb+').write(data) @@ -167,13 +169,13 @@ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context) - + obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) data_dict = {'model': 'ir.ui.menu','id':journal_period_ids[0], 'form': {'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids, 'active_ids':journal_period_ids}} (data, format) = netsvc.LocalService('report.account.general.journal').create(cr, uid, journal_period_ids, data_dict, {}) @@ -189,15 +191,15 @@ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] acc_ids = [ref('account.bal'),ref('account.gpf')] - + obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query': query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.general.ledger').create(cr, uid, acc_ids, data_dict, {}) if tools.config['test_report_directory']: @@ -217,15 +219,15 @@ period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] acc_ids = [ref('account.bal'),ref('account.gpf')] - + obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'account.account', 'form': {'initial_balance': 1,'initial_bal_query':query_line,'chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','sortby': 'sort_date','amount_currency': 0,'landscape':1,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.general.ledger_landscape').create(cr, uid, acc_ids, data_dict, {}) if tools.config['test_report_directory']: @@ -252,17 +254,17 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'account.journal.period', 'id':journal_period_ids[0], 'form': {'sort_selection': 'date','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','amount_currency': 0,'compare_pattern': 'none','account_choice': 'moves','landscape':0,'period_manner': 'actual','fiscalyear_id': fy_id ,'query_line':query_line,'target_move': 'all','periods': period_list,'journal_ids':journal_ids,'id':ref('account.bal') }} (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, journal_period_ids, data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-print_journal.'+format), 'wb+').write(data) - + data_dict.update({'model': 'ir.ui.menu'}) data_dict['form'].update({'active_ids':journal_period_ids}) - + (data, format) = netsvc.LocalService('report.account.journal.period.print').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-print_journal-menu.'+format), 'wb+').write(data) @@ -275,16 +277,17 @@ fy_id = ref('account.data_fiscalyear') period_list = self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', [fy_id])], context=context) journal_ids = [ref('account.sales_journal'),ref('account.refund_sales_journal'),ref('account.expenses_journal'),ref('account.refund_expenses_journal'),ref('account.bank_journal'),ref('account.check_journal'),ref('account.cash_journal')] - + journal_period_ids = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', journal_ids), ('period_id', 'in', period_list)], context=context) obj_move = self.pool.get('account.move.line') ctx = {} ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - data_dict = {'model': 'ir.ui.menu', 'form': {'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} - (data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, [], data_dict, {}) + + data_dict = {'model': 'ir.ui.menu', 'form': {'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'active_ids':journal_period_ids,'display_partner': 'all','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} + (data, format) = netsvc.LocalService('report.account.partner.balance').create(cr, uid, journal_period_ids, data_dict, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'account-partner_balance.'+format), 'wb+').write(data) @@ -302,9 +305,9 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) - + data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': True,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} (data, format) = netsvc.LocalService('report.account.third_party_ledger').create(cr, uid, [], data_dict, {}) if tools.config['test_report_directory']: @@ -324,7 +327,7 @@ ctx['fiscalyear'] = fy_id ctx['journal_ids'] = journal_ids ctx['chart_account_id'] = ref('account.chart0') - + query_line = obj_move._query_get(cr, uid, obj='l', context=ctx) data_dict = {'model': 'ir.ui.menu', 'form': {'initial_bal_query':query_line,'amount_currency': 0,'reconcil': True,'initial_balance':1,'page_split': False,'result_selection': 'customer','chart_account_id':ref('account.chart0'),'display_account':'bal_all','filter': 'filter_no','display_type': 0,'journal_ids':journal_ids,'display_partner': 'non-zero_balance','fiscalyear': fy_id ,'target_move': 'all','query_line':query_line}} (data, format) = netsvc.LocalService('report.account.third_party_ledger_other').create(cr, uid, [], data_dict, {}) diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml index 37d64ead528..9a733d8ad5f 100644 --- a/addons/account/test/account_validate_account_move.yml +++ b/addons/account/test/account_validate_account_move.yml @@ -1,3 +1,12 @@ +- + Demo data for Account tax code +- + !record {model: account.tax.code, id: account_tax_code_0}: + name : Tax Code Test + sign : 1.00 +- + + - In order to test the 'Validate Journal Entries' wizard in OpenERP, I created an account move @@ -20,6 +29,7 @@ - journal_id: account.bank_journal period_id: account.period_6 ref: '2010010' + tax_code_id: account_tax_code_0 tax_amount: 0.0 account_id: account.a_recv amount_currency: 0.0 diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index efce4bc4da4..f94082445da 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -200,7 +200,8 @@ class account_automatic_reconcile(osv.osv_memory): "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ - "AND debit > 0", + "AND debit > 0 " \ + "ORDER BY date_maturity", (account_id, partner_id)) debits = cr.fetchall() @@ -212,7 +213,8 @@ class account_automatic_reconcile(osv.osv_memory): "AND partner_id=%s " \ "AND reconcile_id IS NULL " \ "AND state <> 'draft' " \ - "AND credit > 0", + "AND credit > 0 " \ + "ORDER BY date_maturity", (account_id, partner_id)) credits = cr.fetchall() diff --git a/addons/account/wizard/account_vat_view.xml b/addons/account/wizard/account_vat_view.xml index c8a6645f744..72c6fa768e5 100644 --- a/addons/account/wizard/account_vat_view.xml +++ b/addons/account/wizard/account_vat_view.xml @@ -16,7 +16,7 @@