From 8622032818465b628a2187e8b4ea8abf021a95e4 Mon Sep 17 00:00:00 2001 From: "psi (Open ERP)" Date: Tue, 8 Jun 2010 18:17:44 +0530 Subject: [PATCH] [ADD] account, account_*: Add YAML test files bzr revid: psi@tinyerp.co.in-20100608124744-8g3ggthdb6mn17ok --- addons/account/__openerp__.py | 8 + addons/account/account.py | 2 +- ...analytic_cost_ledger_for_journal_report.py | 48 ------ .../wizard/project_account_analytic_line.py | 40 ++--- .../account/test/account_change_currency.yml | 84 ++++++++++ .../account/test/account_customer_invoice.yml | 92 +++++------ .../account/test/account_fiscalyear_close.yml | 91 +++++++++++ .../test/account_fiscalyear_close_state.yml | 46 ++++++ addons/account/test/account_invoice_state.yml | 68 ++++++++ addons/account/test/account_period_close.yml | 35 +++++ .../account/test/account_supplier_invoice.yml | 73 +++------ addons/account/test/account_use_model.yml | 44 ++++++ .../test/account_validate_account_move.yml | 60 ++++++++ addons/account/test/chart_of_account.yml | 75 +++++++++ .../account_automatic_reconcile_view.xml | 2 +- .../account/wizard/account_invoice_state.py | 6 +- .../wizard/account_move_line_select.py | 2 +- .../account/wizard/account_use_model_view.xml | 50 +++--- .../account_analytic_plans.py | 2 + addons/account_anglo_saxon/__openerp__.py | 14 +- addons/account_budget/__openerp__.py | 4 + addons/account_budget/test/account_budget.yml | 71 +++++++++ .../test/account_budget_spread.yml | 19 +++ .../wizard/account_budget_spread_view.xml | 1 + addons/account_coda/wizard/coda_import.py | 12 +- addons/account_followup/__openerp__.py | 3 + .../test/account_followup.yml | 111 ++++++++++++++ addons/account_payment/__openerp__.py | 2 +- .../account_payment/test/account_payment.yml | 145 ++++++++++++++++++ 29 files changed, 993 insertions(+), 217 deletions(-) create mode 100644 addons/account/test/account_change_currency.yml create mode 100644 addons/account/test/account_fiscalyear_close.yml create mode 100644 addons/account/test/account_fiscalyear_close_state.yml create mode 100644 addons/account/test/account_invoice_state.yml create mode 100644 addons/account/test/account_period_close.yml create mode 100644 addons/account/test/account_use_model.yml create mode 100644 addons/account/test/account_validate_account_move.yml create mode 100644 addons/account/test/chart_of_account.yml create mode 100644 addons/account_budget/test/account_budget.yml create mode 100644 addons/account_budget/test/account_budget_spread.yml create mode 100644 addons/account_followup/test/account_followup.yml create mode 100644 addons/account_payment/test/account_payment.yml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index c53e2030e7f..9213183f7f1 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -124,6 +124,14 @@ module named account_voucherss 'test': [ 'test/account_customer_invoice.yml', 'test/account_supplier_invoice.yml', + 'test/account_change_currency.yml', + 'test/chart_of_account.yml', + 'test/account_period_close.yml', + 'test/account_fiscalyear_close_state.yml', + 'test/account_invoice_state.yml', + 'test/account_use_model.yml', + 'test/account_validate_account_move.yml', +# 'test/account_fiscalyear_close.yml', ], 'installable': True, 'active': False, diff --git a/addons/account/account.py b/addons/account/account.py index e30912aa187..cf50946d516 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -62,7 +62,7 @@ class account_payment_term(osv.osv): elif line.value == 'balance': amt = round(amount, prec) if amt: - next_date = datetime.strptime(date_ref, '%y-%m-%d') + relativedelta(days=line.days) + next_date = datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days) if line.days2 < 0: next_date += relativedelta(day=line.days2) if line.days2 > 0: diff --git a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py index 73dd38533c4..527b6f02f84 100644 --- a/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py +++ b/addons/account/project/wizard/account_analytic_cost_ledger_for_journal_report.py @@ -55,51 +55,3 @@ class account_analytic_cost_ledger_journal_report(osv.osv_memory): account_analytic_cost_ledger_journal_report() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - -#import time -#import wizard -# -#_form = ''' -#
-# -# -# -# -# -#''' -# -#_fields = { -# 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')}, -# 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}, -# 'journal': {'string':'Journals','type':'many2many', 'relation':'account.analytic.journal'}, -#} -# -# -#class wizard_report(wizard.interface): -# states = { -# 'init': { -# 'actions': [], -# 'result': { -# 'type': 'form', -# 'arch': _form, -# 'fields': _fields, -# 'state': [ -# ('end','Cancel'), -# ('report','Print') -# ] -# } -# }, -# 'report': { -# 'actions': [], -# 'result': { -# 'type': 'print', -# 'report': 'account.analytic.account.quantity_cost_ledger', -# 'state': 'end' -# } -# }, -# } -# -#wizard_report('account.analytic.account.quantity_cost_ledger.report') -# -## vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: - diff --git a/addons/account/project/wizard/project_account_analytic_line.py b/addons/account/project/wizard/project_account_analytic_line.py index d84c199ff40..dbe3df3c819 100644 --- a/addons/account/project/wizard/project_account_analytic_line.py +++ b/addons/account/project/wizard/project_account_analytic_line.py @@ -32,26 +32,26 @@ class project_account_analytic_line(osv.osv_memory): def action_open_window(self, cr, uid, ids, context={}): mod_obj =self.pool.get('ir.model.data') domain = [] - for data in self.read(cr, uid, ids, context=context): - from_date = data['from_date'] - to_date = data['to_date'] - if from_date and to_date: - domain = [('date','>=',from_date), ('date','<=',to_date)] - elif from_date: - domain = [('date','>=',from_date)] - elif to_date: - domain = [('date','<=',to_date)] - result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter') - id = mod_obj.read(cr, uid, result, ['res_id'], context=context) - return { - 'name': _('Analytic Entries by line'), - 'view_type': 'form', - "view_mode": 'tree,form', - 'res_model': 'account.analytic.line', - 'type': 'ir.actions.act_window', - 'domain': domain, - 'search_view_id': id['res_id'], - } + data = self.read(cr, uid, ids, [])[0] + from_date = data['from_date'] + to_date = data['to_date'] + if from_date and to_date: + domain = [('date','>=',from_date), ('date','<=',to_date)] + elif from_date: + domain = [('date','>=',from_date)] + elif to_date: + domain = [('date','<=',to_date)] + result = mod_obj._get_id(cr, uid, 'account', 'view_account_analytic_line_filter') + id = mod_obj.read(cr, uid, result, ['res_id'], context=context) + return { + 'name': _('Analytic Entries by line'), + 'view_type': 'form', + "view_mode": 'tree,form', + 'res_model': 'account.analytic.line', + 'type': 'ir.actions.act_window', + 'domain': domain, + 'search_view_id': id['res_id'], + } project_account_analytic_line() diff --git a/addons/account/test/account_change_currency.yml b/addons/account/test/account_change_currency.yml new file mode 100644 index 00000000000..d99c9002870 --- /dev/null +++ b/addons/account/test/account_change_currency.yml @@ -0,0 +1,84 @@ +- + In order to test change currency wizard I create an invoice with currency "EUR" and change it to "USD" using the wizard +- + !record {model: account.invoice, id: account_invoice_currency}: + account_id: account.a_recv + address_contact_id: base.res_partner_address_3000 + address_invoice_id: base.res_partner_address_3000 + company_id: base.main_company + currency_id: base.EUR + invoice_line: + - account_id: account.a_sale + name: '[PC1] Basic PC' + price_unit: 450.0 + quantity: 1.0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + journal_id: account.sales_journal + partner_id: base.res_partner_desertic_hispafuentes + reference_type: none + +- + I check that Initially customer invoice is in the draft state +- + !assert {model: account.invoice, id: account_invoice_currency, string: Customer Invoice is in Draft state}: + - state == 'draft' +- + I change the state of invoice to proforma2 by clicking PRO-FORMA button +- + !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_currency} +- + I check that now customer invoice is in the "proforma2" state +- + !assert {model: account.invoice, id: account_invoice_currency}: + - state == 'proforma2' +- + Now I select USD as new currency +- + !record {model: account.change.currency, id: account_change_currency_0}: + currency_id: base.USD +- + I clicked on Change Currency button to change the currency +- + !python {model: account.change.currency}: | + try: + self.view_init(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US', + "active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids": + [ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"), + }) + self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US', + "active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids": + [ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"), + }) + except: + print "You can not change currency for Open Invoice !" +- + I can't change the currency of invoice when it is not in draft state so i change the state to cancel +- + !workflow {model: account.invoice, action: invoice_cancel, ref: account_invoice_currency} +- + I change the state to "Draft" +- + !python {model: account.invoice}: | + self.action_cancel_draft(cr, uid, [ref("account_invoice_currency")], {"lang": 'en_US', + "tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_invoice_tree1")], + "type": "out_invoice", "active_id": ref("account.menu_action_invoice_tree1"), + }) +- + I change the currency. +- + !record {model: account.change.currency, id: account_change_currency_0}: + currency_id: base.USD +- + I clicked on Change Currency button to change the currency +- + !python {model: account.change.currency}: | + self.change_currency(cr, uid, [ref("account_change_currency_0")], {"lang": 'en_US', + "active_model": "account.invoice", "tz": False, "record_id": 4, "active_ids": + [ref("account_invoice_currency")], "type": "out_invoice", "active_id": ref("account_invoice_currency"), + }) +- + I check that the currency is changed successfully +- + !assert {model: account.invoice, id: account_invoice_currency, string: Currency changed from EUR to USD}: + - currency_id.id == ref("base.USD") diff --git a/addons/account/test/account_customer_invoice.yml b/addons/account/test/account_customer_invoice.yml index 1700f08b470..0cbcc0f944d 100644 --- a/addons/account/test/account_customer_invoice.yml +++ b/addons/account/test/account_customer_invoice.yml @@ -1,9 +1,7 @@ - - In order to test account invoice i create a new customer invoice + In order to test account invoice I create a new customer invoice - - Creating a account.invoice record -- - !record {model: account.invoice, id: account_invoice_0}: + !record {model: account.invoice, id: account_invoice_customer0}: account_id: account.a_recv address_contact_id: base.res_partner_address_zen address_invoice_id: base.res_partner_address_zen @@ -21,36 +19,30 @@ partner_id: base.res_partner_3 reference_type: none - - I check that Initially customer invoice is in the draft state + I check that Initially customer invoice is in the "Draft" state - - !assert {model: account.invoice, id: account_invoice_0}: + !assert {model: account.invoice, id: account_invoice_customer0}: - state == 'draft' - - I change the state of invoice to proforma2 by clicking PRO-FORMA button + I change the state of invoice to "Proforma2" by clicking PRO-FORMA button - - Performing a workflow action invoice_proforma2 on module account.invoice + !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_customer0} - - !workflow {model: account.invoice, action: invoice_proforma2, ref: account_invoice_0} + I check that the invoice state is now "Proforma2" - - I check that the invoice state is now proforma2 -- - !assert {model: account.invoice, id: account_invoice_0}: + !assert {model: account.invoice, id: account_invoice_customer0}: - state == 'proforma2' - I create invoice by clicking on Create button - - Performing a workflow action invoice_open on module account.invoice + !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_customer0} - - !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_0} + I check that the invoice state is "Open" - - I check that the invoice state is now open -- - !assert {model: account.invoice, id: account_invoice_0}: + !assert {model: account.invoice, id: account_invoice_customer0}: - state == 'open' - - I make a partial payment of 1000 by clicking on Pay Invoice button -- - Creating a account.invoice.pay record + I create a record for partial payment of 1000 EUR. - !record {model: account.invoice.pay, id: account_invoice_pay_first0}: amount: 1000.0 @@ -58,25 +50,21 @@ journal_id: account.sales_journal name: First payment for [PC3] Medium PC to Distrib PC period_id: account.period_5 - - - - Performing an osv_memory action pay_and_reconcile on module account.invoice.pay + I make partial payment by clicking on Partial Payment button - !python {model: account.invoice.pay}: | self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_first0")], {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids": - [ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"), + [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"), }) - I check that the invoice state is still open - - !assert {model: account.invoice, id: account_invoice_0}: + !assert {model: account.invoice, id: account_invoice_customer0}: - state == 'open' - - I make second partial payment of 6000 by clicking on Pay Invoice button -- - Creating a account.invoice.pay record + I make second partial payment of 6000 EUR. - !record {model: account.invoice.pay, id: account_invoice_pay_second0}: amount: 6000.0 @@ -84,19 +72,17 @@ journal_id: account.sales_journal name: Second payment for [PC3] Medium PC to Distrib PC period_id: account.period_5 - - - Performing an osv_memory action pay_and_reconcile on module account.invoice.pay + I make partial payment by clicking on Partial Payment button + - !python {model: account.invoice.pay}: | self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_second0")], {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids": - [ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"), + [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"), }) - - I make final partial payment of 2000 by clicking on Pay Invoice button -- - Creating a account.invoice.pay record + I make final partial payment of 2000 EUR - !record {model: account.invoice.pay, id: account_invoice_pay_final0}: amount: 2000.0 @@ -105,39 +91,39 @@ name: Final payment for [PC3] Medium PC to Distrib PC period_id: account.period_5 - - - Performing an osv_memory action pay_and_reconcile on module account.invoice.pay + I make partial payment by clicking on Partial Payment button + - !python {model: account.invoice.pay}: | self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_final0")], {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id": 3, "active_ids": - [ref("account_invoice_0")], "type": "out_invoice", "active_id": ref("account_invoice_0"), + [ref("account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account_invoice_customer0"), }) - I check that the invoice state is now Done - - !assert {model: account.invoice, id: account_invoice_0}: + !assert {model: account.invoice, id: account_invoice_customer0}: - state == 'paid' - I check that an payment entry gets created in the account.move.line - !python {model: account.invoice}: | - acc_id=self.browse(cr, uid, ref("account_invoice_0")) + acc_id=self.browse(cr, uid, ref("account_invoice_customer0")) assert(acc_id.move_id) -#- -# I refund the invoice -#- -# Creating a account.invoice.refund record -#- -# !record {model: account.invoice.refund, id: account_invoice_refund_0}: -# description: Refund -# -#- -# Performing an osv_memory action invoice_refund on module account.invoice.refund -#- -# !python {model: account.invoice.refund}: | -# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")], "type": "out_invoice", "active_id": ref("account.account_invoice_0"), }) -# return self.compute_refund(cr, uid, [ref("account_invoice_refund_0")], "refund" {"lang": 'en_US',"tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_0")], "type": "out_invoice", "active_id": ref("account.account_invoice_0"), }) +- + I refund the invoice Using Credit Note +- + !record {model: account.invoice.refund, id: account_invoice_refund_0}: + description: Refund To China Export + period: account.period_5 +- + I clicked on refund button +- + !python {model: account.invoice.refund}: | + self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', "tz": False, "active_model": "account.invoice", "active_ids": [ref("account.account_invoice_customer0")], "type": "out_invoice", "active_id": ref("account.account_invoice_customer0"), }) +- + I checked that a new entry with state "Draft" created in account move line + diff --git a/addons/account/test/account_fiscalyear_close.yml b/addons/account/test/account_fiscalyear_close.yml new file mode 100644 index 00000000000..6a619a8df5c --- /dev/null +++ b/addons/account/test/account_fiscalyear_close.yml @@ -0,0 +1,91 @@ +- + In order to test Generate Fiscalyear Opening Entries wizard of OpenERP I first create a fiscalyear "Fiscal Year 2011" to which the entries will move +- + !record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}: + code: FY2011 + company_id: base.main_company + date_start: '2011-01-01' + date_stop: '2011-12-31' + name: Fiscal Year 2011 +- + I create a period "Jan2011" for the new fiscalyear +- + !record {model: account.period, id: account_period_jan11}: + company_id: base.main_company + date_start: '2011-01-01' + date_stop: '2011-12-31' + fiscalyear_id: account_fiscalyear_fiscalyear0 + name: Jan2011 + special: 1 + +- + I made modification in journal so it can move entries +- + !record {model: account.journal, id: account.sales_journal}: + centralisation: 1 + +- + I called the Generate Fiscalyear Opening Entries wizard +- + !record {model: account.fiscalyear.close, id: account_fiscalyear_close_0}: + fy2_id: account_fiscalyear_fiscalyear0 + fy_id: account.data_fiscalyear + journal_id: account.sales_journal + period_id: account_period_jan11 + report_name: End of Fiscal Year Entry + sure: 1 +- + I clicked on create Button + +- + !python {model: account.fiscalyear.close}: | + self.data_save(cr, uid, [ref("account_fiscalyear_close_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close")], + "tz": False, "active_id": ref("account.menu_wizard_fy_close"), }) + +- + I check the opening entries By using "Entries by Line wizard" +- + !record {model: account.move.journal, id: account_move_journal_0}: + journal_id: account.sales_journal + period_id: account_period_jan11 +- + I clicked on Open Journal Button to check the entries + +- + !python {model: account.move.journal}: | + self.action_open_window(cr, uid, [ref("account_move_journal_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_move_journal_line_form")], + "tz": False, "active_id": ref("account.menu_action_move_journal_line_form"), + }) + +- + In order to test Cancel Opening Entries I cancelled the opening entries created for "Fiscal Year 2011" +- + !record {model: account.open.closed.fiscalyear, id: account_open_closed_fiscalyear_1}: + fyear_id: account.data_fiscalyear +- + I clicked on Open button +- + !python {model: account.open.closed.fiscalyear}: | + self.remove_entries(cr, uid, [ref("account_open_closed_fiscalyear_1")], {"lang": + 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_open_closed_fy")], + "tz": False, "active_id": ref("account.menu_wizard_open_closed_fy"), }) +- + I check the opening entries By using "Entries by Line wizard" +- + !record {model: account.move.journal, id: account_move_journal_2}: + journal_id: account.sales_journal + period_id: account_period_jan11 + +- + I checked the Opening entries are cancelled successfully +- + !python {model: account.move.journal}: | + self.action_open_window(cr, uid, [ref("account_move_journal_2")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_move_journal_line_form")], + "tz": False, "active_id": ref("account.menu_action_move_journal_line_form"), + }) + + + diff --git a/addons/account/test/account_fiscalyear_close_state.yml b/addons/account/test/account_fiscalyear_close_state.yml new file mode 100644 index 00000000000..988ba5593d5 --- /dev/null +++ b/addons/account/test/account_fiscalyear_close_state.yml @@ -0,0 +1,46 @@ + +- + In order to check the Close a Fiscal Year wizard in OpenERP I first create a Fiscalyear +- + !record {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0}: + code: FY2011 + company_id: base.main_company + date_start: '2011-01-01' + date_stop: '2011-12-31' + name: Fiscal Year 2011 +- + I create monthly Periods for this fiscalyear +- + !python {model: account.fiscalyear}: | + self.create_period(cr, uid, [ref("account_fiscalyear_fiscalyear0")], {"lang": + 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_fiscalyear_form")], + "tz": False, "active_id": ref("account.menu_action_account_fiscalyear_form"), + }) +- + I check that the fiscalyear state is "Draft" +- + !assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Draft state}: + - state == 'draft' +- + I run the Close a Fiscalyear wizard to close this fiscalyear +- + !record {model: account.fiscalyear.close.state, id: account_fiscalyear_close_state_0}: + fy_id: account_fiscalyear_fiscalyear0 + sure: 1 +- + I clicked on Close States Button to close fiscalyear + +- + !python {model: account.fiscalyear.close.state}: | + self.data_save(cr, uid, [ref("account_fiscalyear_close_state_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_wizard_fy_close_state")], + "tz": False, "active_id": ref("account.menu_wizard_fy_close_state"), }) +- + I check that the fiscalyear state is now "Done" +- + !assert {model: account.fiscalyear, id: account_fiscalyear_fiscalyear0, string: Fiscal Year is in Done state}: + - state == 'done' + + + + diff --git a/addons/account/test/account_invoice_state.yml b/addons/account/test/account_invoice_state.yml new file mode 100644 index 00000000000..b9818b71d2f --- /dev/null +++ b/addons/account/test/account_invoice_state.yml @@ -0,0 +1,68 @@ +- + In order to test Confirm Draft Invoice wizard I create an invoice and confirm it with this wizard +- + !record {model: account.invoice, id: account_invoice_state}: + account_id: account.a_recv + address_contact_id: base.res_partner_address_3000 + address_invoice_id: base.res_partner_address_3000 + company_id: base.main_company + currency_id: base.EUR + invoice_line: + - account_id: account.a_sale + name: '[PC1] Basic PC' + price_unit: 450.0 + quantity: 1.0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + journal_id: account.bank_journal + partner_id: base.res_partner_desertic_hispafuentes + reference_type: none +- + I check that Initially customer invoice state is "Draft" +- + !assert {model: account.invoice, id: account_invoice_state}: + - state == 'draft' +- + I called the "Confirm Draft Invoices" wizard +- + !record {model: account.invoice.confirm, id: account_invoice_confirm_0}: + {} +- + I clicked on Confirm Invoices Button +- + !python {model: account.invoice.confirm}: | + self.invoice_confirm(cr, uid, [ref("account_invoice_confirm_0")], {"lang": 'en_US', + "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_state")], + "type": "out_invoice", "active_id": ref("account_invoice_state"), }) +- + I check that customer invoice state is "Open" +- + !assert {model: account.invoice, id: account_invoice_state}: + - state == 'open' +- + I Modified the journal record so it can cancel invoice +- + !record {model: account.journal, id: account.bank_journal}: + update_posted: 1 + + +- + In order to check the "Cancel Selected Invoices" wizard in openerp I cancelled this open invoice using this wizard +- + !record {model: account.invoice.cancel, id: account_invoice_cancel_0}: + {} + +- + I clicked on Cancel Invoices Button +- + !python {model: account.invoice.cancel}: | + self.invoice_cancel(cr, uid, [ref("account_invoice_cancel_0")], {"lang": 'en_US', + "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_state")], + "type": "out_invoice", "active_id": ref("account_invoice_state"), }) + +- + I check that customer invoice is in the cancel state +- + !assert {model: account.invoice, id: account_invoice_state}: + - state == 'cancel' + diff --git a/addons/account/test/account_period_close.yml b/addons/account/test/account_period_close.yml new file mode 100644 index 00000000000..af180050b1b --- /dev/null +++ b/addons/account/test/account_period_close.yml @@ -0,0 +1,35 @@ + +- + In order to test close period wizard I create a period then close it and checked it's state +- + !record {model: account.period, id: account_period_jan0}: + company_id: base.main_company + date_start: '2010-01-01' + date_stop: '2010-01-31' + fiscalyear_id: account.data_fiscalyear + name: Jan-2010 + special: 1 + +- + I check that the period state is "Draft" +- + !assert {model: account.period, id: account_period_jan0, string: Period is in Draft state}: + - state == 'draft' +- + I use "Close a Period" wizard to close period Jan-2010 +- + !record {model: account.period.close, id: account_period_close_0}: + sure: 1 +- + I clicked on Close Period Button to close Period + +- + !python {model: account.period.close}: | + self.data_save(cr, uid, [ref("account_period_close_0")], {"lang": 'en_US', "active_model": + "account.period", "active_ids": [ref("account_period_jan0")], "tz": False, "active_id": + ref("account_period_jan0"), }) +- + I check that the period state is "Done" +- + !assert {model: account.period, id: account_period_jan0, string: Period is in Done state}: + - state == 'done' diff --git a/addons/account/test/account_supplier_invoice.yml b/addons/account/test/account_supplier_invoice.yml index a577fa8330b..c5ed0087a92 100644 --- a/addons/account/test/account_supplier_invoice.yml +++ b/addons/account/test/account_supplier_invoice.yml @@ -1,9 +1,7 @@ - - In order to test account invoice i create a new supplier invoice + In order to test account invoice I create a new supplier invoice - - Creating a account.invoice record -- - !record {model: account.invoice, id: account_invoice_1}: + !record {model: account.invoice, id: account_invoice_supplier0}: account_id: account.a_pay address_contact_id: base.res_partner_address_3000 address_invoice_id: base.res_partner_address_3000 @@ -22,25 +20,21 @@ reference_type: none type: in_invoice - - I check that Initially supplier invoice is in the draft state + I check that Initially supplier invoice state is "Draft" - - !assert {model: account.invoice, id: account_invoice_1}: + !assert {model: account.invoice, id: account_invoice_supplier0}: - state == 'draft' - I change the state of invoice to open by clicking Validate button - - Performing a workflow action invoice_open on module account.invoice + !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_supplier0} - - !workflow {model: account.invoice, action: invoice_open, ref: account_invoice_1} + I check that the invoice state is now "Open" - - I check that the invoice state is now open -- - !assert {model: account.invoice, id: account_invoice_1}: + !assert {model: account.invoice, id: account_invoice_supplier0}: - state == 'open' - - I make a partial payment of 2000 by clicking on Pay Invoice button -- - Creating a account.invoice.pay record + I make a partial payment of 2000 EUR - !record {model: account.invoice.pay, id: account_invoice_pay_firstpaymenttoaxelorforbasicpc0}: amount: 2000.0 @@ -48,24 +42,21 @@ journal_id: account.sales_journal name: First Payment to Axelor for Basic PC period_id: account.period_5 - - - Performing an osv_memory action pay_and_reconcile on module account.invoice.pay + I make partial payment by clicking on Partial Payment button - !python {model: account.invoice.pay}: | self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_firstpaymenttoaxelorforbasicpc0")], {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id": - 25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id": - ref("account_invoice_1"), }) + 25, "active_ids": [ref("account_invoice_supplier0")], "type": "in_invoice", "active_id": + ref("account_invoice_supplier0"), }) - - I check that the invoice state is still open + I check that the invoice state is still "Open" - - !assert {model: account.invoice, id: account_invoice_1}: + !assert {model: account.invoice, id: account_invoice_supplier0}: - state == 'open' - - I make final partial payment of 1000 by clicking on Pay Invoice button -- - Creating a account.invoice.pay record + I make final partial payment of 1000 EUR - !record {model: account.invoice.pay, id: account_invoice_pay_finalpaymenttoaxelorforbasicpc0}: amount: 1000.0 @@ -73,45 +64,23 @@ journal_id: account.sales_journal name: Final Payment to Axelor for Basic PC period_id: account.period_5 - - - - Performing an osv_memory action pay_and_reconcile on module account.invoice.pay + I make partial payment by clicking on Partial Payment button - !python {model: account.invoice.pay}: | self.pay_and_reconcile(cr, uid, [ref("account_invoice_pay_finalpaymenttoaxelorforbasicpc0")], {"lang": 'en_US', "active_model": "account.invoice", "tz": False, "record_id": - 25, "active_ids": [ref("account_invoice_1")], "type": "in_invoice", "active_id": - ref("account_invoice_1"), }) + 25, "active_ids": [ref("account_invoice_supplier0")], "type": "in_invoice", "active_id": + ref("account_invoice_supplier0"), }) - - I check that the invoice state is now Done + I check that the invoice state is now "Done" - - !assert {model: account.invoice, id: account_invoice_1}: + !assert {model: account.invoice, id: account_invoice_supplier0}: - state == 'paid' - - I check that an payment entry gets created in the account.move.line + I check that an payment entry gets created in the account move line - !python {model: account.invoice}: | - acc_id=self.browse(cr, uid, ref("account_invoice_1")) + acc_id=self.browse(cr, uid, ref("account_invoice_supplier0")) assert(acc_id.move_id) -#- -# I refund the invoice -#- -# Creating a account.invoice.refund record -#- -# !record {model: account.invoice.refund, id: account_invoice_refund_0}: -# date: '2010-06-22' -# description: 'Refund By Axelor ' -# -# -#- -# Performing an osv_memory action invoice_refund on module account.invoice.refund -#- -# !python {model: account.invoice.refund}: | -# self.invoice_refund(cr, uid, [ref("account_invoice_refund_0")], {"lang": 'en_US', -# "tz": False, "active_model": "account.invoice", "active_ids": [ref("account_invoice_1")], -# "type": "in_invoice", "active_id": ref("account_invoice_1"), }) - - - diff --git a/addons/account/test/account_use_model.yml b/addons/account/test/account_use_model.yml new file mode 100644 index 00000000000..7de88cff94e --- /dev/null +++ b/addons/account/test/account_use_model.yml @@ -0,0 +1,44 @@ +- + In order to test account use models wizard in OpenERP I create an account model record +- + !record {model: account.model, id: account_model_mymodelonyears0}: + journal_id: account.expenses_journal + lines_id: + - account_id: account.a_recv + credit: 0.0 + debit: 0.0 + name: test1 + sequence: 0.0 + date: today + quantity: 0.0 + name: My Model on %(year)s + +- + I create an account use model record + +- + !record {model: account.use.model, id: account_use_model_0}: + {} + +- + I create entries. +- + !python {model: account.use.model}: | + self.create_entries(cr, uid, [ref("account_use_model_0")], {"lang": 'en_US', "active_model": + "account.model", "active_ids": [ref("account_model_mymodelonyears0")], "tz": + False, "active_id": ref("account_model_mymodelonyears0"), }) +- + I create an account use model record +- + !record {model: account.use.model, id: account_use_model_1}: + {} + +- + I checked that Moves are created successfully + +- + !python {model: account.use.model}: | + self.open_moves(cr, uid, [ref("account_use_model_1")], {"lang": 'en_US', "move_ids": + [], "tz": False, "active_model": "account.model", "active_ids": [ref("account_model_mymodelonyears0")], + "active_id": ref("account_model_mymodelonyears0"), }) + diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml new file mode 100644 index 00000000000..5157467800b --- /dev/null +++ b/addons/account/test/account_validate_account_move.yml @@ -0,0 +1,60 @@ +- + In order to test Validate Ledger Postings wizard in OpenERP I created a account move + +- + !record {model: account.move, id: account_move_0}: + date: '2010-06-07' + journal_id: account.bank_journal + line_id: + - account_id: account.cash + amount_currency: 0.0 + credit: 2000.0 + date: '2010-06-07' + debit: 0.0 + journal_id: account.bank_journal + name: Basic Computer + partner_id: base.res_partner_desertic_hispafuentes + period_id: account.period_6 + ref: '2010010' + tax_amount: 0.0 + - journal_id: account.bank_journal + period_id: account.period_6 + ref: '2010010' + tax_amount: 0.0 + account_id: account.a_recv + amount_currency: 0.0 + credit: 0.0 + date: '2010-06-07' + debit: 2000.0 + name: Basic Computer + partner_id: base.res_partner_desertic_hispafuentes + quantity: 0.0 + name: / + period_id: account.period_6 + ref: '2010010' + state: draft + +- + I check that Initially account move state is "Draft" +- + !assert {model: account.move, id: account_move_0}: + - state == 'draft' +- + I validate this account move by using Validate Ledger Postings +- + !record {model: validate.account.move, id: validate_account_move_0}: + journal_id: account.bank_journal + period_id: account.period_6 +- + I clicked on validate Button +- + !python {model: validate.account.move}: | + self.validate_move(cr, uid, [ref("validate_account_move_0")], {"lang": "en_US", + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_validate_account_moves")], + "tz": False, "active_id": ref("account.menu_validate_account_moves"), }) + +- + I check that the invoice state is now "Posted" +- + !assert {model: account.move, id: account_move_0}: + - state == 'posted' diff --git a/addons/account/test/chart_of_account.yml b/addons/account/test/chart_of_account.yml new file mode 100644 index 00000000000..39d7428ea73 --- /dev/null +++ b/addons/account/test/chart_of_account.yml @@ -0,0 +1,75 @@ +- + In order to check the Chart of Accounts wizard I run the wizard with target move set as all + +- + !record {model: account.chart, id: account_chart_0}: + target_move: all +- + I clicked on Open chart Button to open the chart +- + !python {model: account.chart}: | + self.account_chart_open_window(cr, uid, [ref("account_chart_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_tree2")], + "tz": False, "active_id": ref("account.menu_action_account_tree2"), }) + +- + I create chart of account with target move set as posted +- + !record {model: account.chart, id: account_chart_0}: + target_move: posted +- + I clicked on Open chart Button to open the chart +- + !python {model: account.chart}: | + self.account_chart_open_window(cr, uid, [ref("account_chart_0")], {"lang": 'en_US', + "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_account_tree2")], + "tz": False, "active_id": ref("account.menu_action_account_tree2"), }) + +- + In order to test Account Move Line Wizard I check the move line entries using this wizard +- + !record {model: account.move.line.select, id: account_move_line_select_0}: + {} +- + I clicked on Button to open the account move lines +- + !python {model: account.move.line.select}: | + self.open_window(cr, uid, [ref("account_move_line_select_0")], {"lang": 'en_US', + "state": "all", "tz": False, "active_model": "account.account", "active_ids": + [ref("account.a_recv")], "fiscalyear": 1, "active_id": ref("account.a_recv"), + }) + + +- + In order to test the Analytic Charts of Account wizard I will generate chart + +- + !record {model: account.analytic.chart, id: account_analytic_chart_0}: + from_date: '2010-01-01' + to_date: '2010-06-30' +- + I clicked on Open chart Button to open the charts + +- + !python {model: account.analytic.chart}: | + self.analytic_account_chart_open_window(cr, uid, [ref("account_analytic_chart_0")], + {"lang": 'en_US', "active_model": "ir.ui.menu", "active_ids": [ref("account.menu_action_analytic_account_tree2")], + "tz": False, "active_id": ref("account.menu_action_analytic_account_tree2"), + }) + +- + In order to test Account Journal Select wizard I open journal entries using this wizard +- + !record {model: account.journal.select, id: account_journal_select_0}: + {} +- + I clicked on Open Journal Button to open the entries + +- + !python {model: account.journal.select}: | + self.action_open_window(cr, uid, [ref("account_journal_select_0")], {"lang": + 'en_US', "active_model": "account.journal.period", "active_ids": [ref("account.a_recv")], + "tz": False, "active_id": ref("account.a_recv"), }) +- + I check that the entries open successfully + diff --git a/addons/account/wizard/account_automatic_reconcile_view.xml b/addons/account/wizard/account_automatic_reconcile_view.xml index 76b10e8745c..5afbbed7eed 100644 --- a/addons/account/wizard/account_automatic_reconcile_view.xml +++ b/addons/account/wizard/account_automatic_reconcile_view.xml @@ -40,7 +40,7 @@ diff --git a/addons/account/wizard/account_invoice_state.py b/addons/account/wizard/account_invoice_state.py index c3934e38db0..3b63ed843d1 100644 --- a/addons/account/wizard/account_invoice_state.py +++ b/addons/account/wizard/account_invoice_state.py @@ -37,11 +37,11 @@ class account_invoice_confirm(osv.osv_memory): context = {} pool_obj = pooler.get_pool(cr.dbname) data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context) - + for record in data_inv: if record['state'] not in ('draft','proforma','proforma2'): raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be confirmed as they are not in 'Draft' or 'Pro-Forma' state!")) - wf_service.trg_validate(uid, 'account.invoice', id, 'invoice_open', cr) + wf_service.trg_validate(uid, 'account.invoice', record['id'], 'invoice_open', cr) return {} account_invoice_confirm() @@ -61,7 +61,7 @@ class account_invoice_cancel(osv.osv_memory): wf_service = netsvc.LocalService('workflow') pool_obj = pooler.get_pool(cr.dbname) data_inv = pool_obj.get('account.invoice').read(cr, uid, context['active_ids'], ['state'], context=context) - + for record in data_inv: if record['state'] in ('cancel','paid'): raise osv.except_osv(_('Warning'), _("Selected Invoice(s) cannot be cancelled as they are already in 'Cancelled' or 'Done' state!")) diff --git a/addons/account/wizard/account_move_line_select.py b/addons/account/wizard/account_move_line_select.py index 8b3388f7f96..32ecf85f375 100644 --- a/addons/account/wizard/account_move_line_select.py +++ b/addons/account/wizard/account_move_line_select.py @@ -43,7 +43,7 @@ class account_move_line_select(osv.osv_memory): else: fiscalyear_ids = [context['fiscalyear']] - fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) +# fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')]) fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids) period_ids = [] diff --git a/addons/account/wizard/account_use_model_view.xml b/addons/account/wizard/account_use_model_view.xml index a5720e3a0b4..aeeac91a644 100644 --- a/addons/account/wizard/account_use_model_view.xml +++ b/addons/account/wizard/account_use_model_view.xml @@ -7,15 +7,17 @@ account.use.model form -
- - - - -