diff --git a/addons/account_discount/tests/discount_common.py b/addons/account_discount/tests/discount_common.py index cfb391fd..9af42c56 100644 --- a/addons/account_discount/tests/discount_common.py +++ b/addons/account_discount/tests/discount_common.py @@ -20,10 +20,11 @@ class TestDiscountCommon(TransactionCase): 'fix_amount': 3000.0, 'percentage': 20.0, }) - ir_model_data_obj = self.env['ir.model.data'] - account_acccount_obj = self.env['account.account'] - journal_obj = self.env['account.journal'] + AccountAccount = self.env['account.account'] + AccountJournal = self.env['account.journal'] + self.AccountInvoice = self.env['account.invoice'] + self.AccountInvoiceLine = self.env['account.invoice.line'] company_id = \ ir_model_data_obj.xmlid_to_res_id('base.main_company') or False user_type_payable_id = ir_model_data_obj.xmlid_to_res_id( @@ -33,13 +34,13 @@ class TestDiscountCommon(TransactionCase): self.user_type_revenue_id = ir_model_data_obj.xmlid_to_res_id( 'account.data_account_type_revenue') - self.account_type_payable_id = account_acccount_obj.create({ + self.account_type_payable_id = AccountAccount.create({ 'name': 'Test Payable Account', 'code': 'TestPA', 'reconcile': True, 'user_type_id': user_type_payable_id}) - self.account_type_receivable_id = account_acccount_obj.create({ + self.account_type_receivable_id = AccountAccount.create({ 'name': 'Test Reiceivable Account', 'code': 'TestRA', 'reconcile': True, @@ -52,8 +53,14 @@ class TestDiscountCommon(TransactionCase): 'email': 'testpartner@test.com', }) - self.journal_id = journal_obj.create({ + self.journal_id = AccountJournal.create({ 'name': 'Test Journal', 'code': 'Journal001', 'type': 'sale', 'company_id': company_id}) + + self.account_id = AccountAccount.create({ + 'name': 'Test', + 'code': 'DA', + 'user_type_id': self.user_type_revenue_id, + }) diff --git a/addons/account_discount/tests/test_01_account_discount.py b/addons/account_discount/tests/test_01_account_discount.py index b3100190..abaf6215 100644 --- a/addons/account_discount/tests/test_01_account_discount.py +++ b/addons/account_discount/tests/test_01_account_discount.py @@ -10,14 +10,7 @@ class TestInvoiceDiscount(TestDiscountCommon): super(TestInvoiceDiscount, self).setUp() def discount_01_set_fixamount(self): - - self.account_id = self.env['account.account'].create({ - 'name': 'Test', - 'code': 'DA', - 'user_type_id': self.user_type_revenue_id, - }) - - invoice_id = self.env['account.invoice'].create({ + invoice_id = self.AccountInvoice.create({ 'name': 'Discount Invoice Test Fixed', 'partner_id': self.partner_id.id, 'currency_id': self.env.ref('base.USD').id, @@ -27,7 +20,7 @@ class TestInvoiceDiscount(TestDiscountCommon): 'journal_id': self.journal_id.id, }) invoice_id.onchange_discount_method() - self.env['account.invoice.line'].create({ + self.AccountInvoiceLine.create({ 'product_id': self.env.ref("product.product_product_10").id, 'quantity': 10, 'price_unit': 400, @@ -35,7 +28,7 @@ class TestInvoiceDiscount(TestDiscountCommon): 'name': 'Mouse, Optical', 'account_id': self.account_id.id, }) - self.env['account.invoice.line'].create({ + self.AccountInvoiceLine.create({ 'product_id': self.env.ref("product.product_product_12").id, 'quantity': 30, 'price_unit': 250, @@ -56,13 +49,8 @@ class TestInvoiceDiscount(TestDiscountCommon): return invoice_id def discount_02_set_percentages(self): - self.account_id = self.env['account.account'].create({ - 'name': 'Test', - 'code': 'DA', - 'user_type_id': self.user_type_revenue_id, - }) - invoice_id = self.env['account.invoice'].create({ - 'name': 'Discount Invoice Test', + invoice_id = self.AccountInvoice.create({ + 'name': 'Discount Invoice Test Percentage', 'partner_id': self.partner_id.id, 'currency_id': self.env.ref('base.USD').id, 'account_id': self.account_id.id, @@ -72,7 +60,7 @@ class TestInvoiceDiscount(TestDiscountCommon): 'date_invoice': time.strftime('%Y') + '-03-12', 'journal_id': self.journal_id.id, }) - self.env['account.invoice.line'].create({ + self.AccountInvoiceLine.create({ 'product_id': self.env.ref("product.product_product_10").id, 'quantity': 10, 'price_unit': 400, @@ -81,7 +69,7 @@ class TestInvoiceDiscount(TestDiscountCommon): 'name': 'Mouse, Optical', 'account_id': self.account_id.id, }) - self.env['account.invoice.line'].create({ + self.AccountInvoiceLine.create({ 'product_id': self.env.ref("product.product_product_12").id, 'quantity': 30, 'price_unit': 250, @@ -91,3 +79,51 @@ class TestInvoiceDiscount(TestDiscountCommon): 'account_id': self.account_id.id, }) return invoice_id + + def account_discount_03_check_include_taxes(self): + tax_id = self.env['account.tax'].create({ + 'name': 'Tax 7.7', + 'amount': 7.7, + 'amount_type': 'percent', + 'price_include': True, + 'include_base_amount': True, + }) + + invoice_id = self.AccountInvoice.create({ + 'name': 'Discount Invoice Test Tax Included Price', + 'partner_id': self.partner_id.id, + 'currency_id': self.env.ref('base.USD').id, + 'account_id': self.account_id.id, + 'type': 'out_invoice', + 'date_invoice': time.strftime('%Y') + '-03-12', + 'journal_id': self.journal_id.id, + }) + invoice_id.onchange_discount_method() + self.AccountInvoiceLine.create({ + 'product_id': self.env.ref("product.product_product_10").id, + 'quantity': 10, + 'price_unit': 400, + 'invoice_id': invoice_id.id, + 'name': 'Mouse, Optical', + 'account_id': self.account_id.id, + 'invoice_line_tax_ids': [(6, 0, [tax_id.id])], + }) + self.AccountInvoiceLine.create({ + 'product_id': self.env.ref("product.product_product_12").id, + 'quantity': 30, + 'price_unit': 250, + 'invoice_id': invoice_id.id, + 'name': 'Mouse, Wireless', + 'account_id': self.account_id.id, + 'invoice_line_tax_ids': [(6, 0, [tax_id.id])], + }) + invoice_id.write({ + 'discount_method': 'fixed', + 'discount_amount': 10, + }) + self.assertTrue(invoice_id, 'Invoice: no invoice created') + invoice_id._check_constrains() + invoice_id.onchange_discount_per() + invoice_id.onchange_discount_amount() + logging.info('Successful: Invoice Created!') + return invoice_id diff --git a/addons/account_discount/tests/test_02_account_discount_invoice.py b/addons/account_discount/tests/test_02_account_discount_invoice.py index 9b3b1cd6..a9b2cbea 100644 --- a/addons/account_discount/tests/test_02_account_discount_invoice.py +++ b/addons/account_discount/tests/test_02_account_discount_invoice.py @@ -25,3 +25,10 @@ class TestDiscountInvoice(TestInvoiceDiscount): }) invoice_id.calculate_discount() invoice_id.action_invoice_open() + + def test_03_fixed_discount_include_taxes(self): + invoice_id = self.account_discount_03_check_include_taxes() + invoice_id.calculate_discount() + self.assertEquals(10, round(invoice_id.discount), + 'Discount Calculation error') + invoice_id.action_invoice_open() diff --git a/addons/auth_signup/data/auth_signup_data.xml b/addons/auth_signup/data/auth_signup_data.xml index c7584cd5..c3e2ccb7 100644 --- a/addons/auth_signup/data/auth_signup_data.xml +++ b/addons/auth_signup/data/auth_signup_data.xml @@ -45,9 +45,6 @@
- Sent by ${user.company_id.name} using Flectra -
- Sent by ${user.company_id.name} using Flectra -
- Sent by ${user.company_id.name} using Flectra -
Sent by ${object.company_id.name}
% if 'website_url' in object.event_id and object.event_id.website_url:- Sent by - % if ctx.get('website_url'): - - % endif - ${ctx.get('company_name')} - % if ctx.get('website_url'): - - % endif - using - Flectra. -
This customer survey is sent ${object.project_id.rating_status_period} as long as the task is in the ${object.stage_id.name} stage.
% endif -Email automatically sent by Flectra Project for ${object.project_id.company_id.name}
${user.signature | safe}
% endif -Sent by - - ${user.company_id.name} - using Flectra -