diff --git a/addons/account_tax_include/__openerp__.py b/addons/account_tax_include/__openerp__.py index 5bb1a2e2399..a963b0b5118 100644 --- a/addons/account_tax_include/__openerp__.py +++ b/addons/account_tax_include/__openerp__.py @@ -35,6 +35,7 @@ This module implement the modification on the invoice form. 'init_xml': [], 'update_xml': ['account_tax_include_view.xml'], 'demo_xml': [], + 'test': ['test/account_tax_include.yml'], 'installable': True, 'active': False, 'certificate': '0070514190381', diff --git a/addons/account_tax_include/test/account_tax_include.yml b/addons/account_tax_include/test/account_tax_include.yml new file mode 100644 index 00000000000..a4b0f8531b9 --- /dev/null +++ b/addons/account_tax_include/test/account_tax_include.yml @@ -0,0 +1,93 @@ + +- + Creating a tax record +- + !record {model: account.tax, id: account_tax_a0}: + amount: 0.10000000000000001 + applicable_type: 'true' + company_id: base.main_company + description: a + name: a + sequence: 1 + type: percent + type_tax_use: all + +- + Creating a account invoice record with tax excluded +- + !record {model: account.invoice, id: account_invoice_tax_exclude}: + 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: 100.0 + quantity: 1.0 + invoice_line_tax_id: + - account_tax_a0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + journal_id: account.sales_journal + partner_id: base.res_partner_desertic_hispafuentes + price_type: tax_excluded + reference_type: none + +- + Performing an osv_memory action button_reset_taxes on module account.invoice +- + !python {model: account.invoice}: | + self.button_reset_taxes(cr, uid, [ref("account_invoice_tax_exclude")], {"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"), + }) +- + Check if tax is excluded in invoice +- + !assert {model: account.invoice, id: account_invoice_tax_exclude, severity: error, string: price type is tax excluded}: + - state == "draft" + - amount_untaxed == 100.0 + - amount_tax == 10.0 + - amount_total == 110.0 + +- + Creating a account invoice record with tax include +- + !record {model: account.invoice, id: account_invoice_tax_include}: + 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: 100.0 + quantity: 1.0 + invoice_line_tax_id: + - account_tax_a0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + journal_id: account.sales_journal + partner_id: base.res_partner_desertic_hispafuentes + price_type: tax_included + reference_type: none + +- + Performing an osv_memory action button_reset_taxes on module account.invoice +- + !python {model: account.invoice}: | + self.button_reset_taxes(cr, uid, [ref("account_invoice_tax_include")], {"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"), + }) +- + Check if tax is included in invoice +- + !assert {model: account.invoice, id: account_invoice_tax_include, severity: error, string: price type is tax included}: + - state == "draft" + - amount_untaxed == 90.91 + - amount_tax == 9.09 + - amount_total == 100.00 \ No newline at end of file