Merge branch 'master-sale-account-discount' into 'master'
[IMP/ADD] Add Sales and Account Discount Test Cases and Remove Branding In Emails See merge request flectra-hq/flectra!12
This commit is contained in:
commit
9394e7a28c
@ -20,10 +20,11 @@ class TestDiscountCommon(TransactionCase):
|
|||||||
'fix_amount': 3000.0,
|
'fix_amount': 3000.0,
|
||||||
'percentage': 20.0,
|
'percentage': 20.0,
|
||||||
})
|
})
|
||||||
|
|
||||||
ir_model_data_obj = self.env['ir.model.data']
|
ir_model_data_obj = self.env['ir.model.data']
|
||||||
account_acccount_obj = self.env['account.account']
|
AccountAccount = self.env['account.account']
|
||||||
journal_obj = self.env['account.journal']
|
AccountJournal = self.env['account.journal']
|
||||||
|
self.AccountInvoice = self.env['account.invoice']
|
||||||
|
self.AccountInvoiceLine = self.env['account.invoice.line']
|
||||||
company_id = \
|
company_id = \
|
||||||
ir_model_data_obj.xmlid_to_res_id('base.main_company') or False
|
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(
|
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(
|
self.user_type_revenue_id = ir_model_data_obj.xmlid_to_res_id(
|
||||||
'account.data_account_type_revenue')
|
'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',
|
'name': 'Test Payable Account',
|
||||||
'code': 'TestPA',
|
'code': 'TestPA',
|
||||||
'reconcile': True,
|
'reconcile': True,
|
||||||
'user_type_id': user_type_payable_id})
|
'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',
|
'name': 'Test Reiceivable Account',
|
||||||
'code': 'TestRA',
|
'code': 'TestRA',
|
||||||
'reconcile': True,
|
'reconcile': True,
|
||||||
@ -52,8 +53,14 @@ class TestDiscountCommon(TransactionCase):
|
|||||||
'email': 'testpartner@test.com',
|
'email': 'testpartner@test.com',
|
||||||
})
|
})
|
||||||
|
|
||||||
self.journal_id = journal_obj.create({
|
self.journal_id = AccountJournal.create({
|
||||||
'name': 'Test Journal',
|
'name': 'Test Journal',
|
||||||
'code': 'Journal001',
|
'code': 'Journal001',
|
||||||
'type': 'sale',
|
'type': 'sale',
|
||||||
'company_id': company_id})
|
'company_id': company_id})
|
||||||
|
|
||||||
|
self.account_id = AccountAccount.create({
|
||||||
|
'name': 'Test',
|
||||||
|
'code': 'DA',
|
||||||
|
'user_type_id': self.user_type_revenue_id,
|
||||||
|
})
|
||||||
|
@ -10,14 +10,7 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
super(TestInvoiceDiscount, self).setUp()
|
super(TestInvoiceDiscount, self).setUp()
|
||||||
|
|
||||||
def discount_01_set_fixamount(self):
|
def discount_01_set_fixamount(self):
|
||||||
|
invoice_id = self.AccountInvoice.create({
|
||||||
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 Fixed',
|
'name': 'Discount Invoice Test Fixed',
|
||||||
'partner_id': self.partner_id.id,
|
'partner_id': self.partner_id.id,
|
||||||
'currency_id': self.env.ref('base.USD').id,
|
'currency_id': self.env.ref('base.USD').id,
|
||||||
@ -27,7 +20,7 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
'journal_id': self.journal_id.id,
|
'journal_id': self.journal_id.id,
|
||||||
})
|
})
|
||||||
invoice_id.onchange_discount_method()
|
invoice_id.onchange_discount_method()
|
||||||
self.env['account.invoice.line'].create({
|
self.AccountInvoiceLine.create({
|
||||||
'product_id': self.env.ref("product.product_product_10").id,
|
'product_id': self.env.ref("product.product_product_10").id,
|
||||||
'quantity': 10,
|
'quantity': 10,
|
||||||
'price_unit': 400,
|
'price_unit': 400,
|
||||||
@ -35,7 +28,7 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
'name': 'Mouse, Optical',
|
'name': 'Mouse, Optical',
|
||||||
'account_id': self.account_id.id,
|
'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,
|
'product_id': self.env.ref("product.product_product_12").id,
|
||||||
'quantity': 30,
|
'quantity': 30,
|
||||||
'price_unit': 250,
|
'price_unit': 250,
|
||||||
@ -56,13 +49,8 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
return invoice_id
|
return invoice_id
|
||||||
|
|
||||||
def discount_02_set_percentages(self):
|
def discount_02_set_percentages(self):
|
||||||
self.account_id = self.env['account.account'].create({
|
invoice_id = self.AccountInvoice.create({
|
||||||
'name': 'Test',
|
'name': 'Discount Invoice Test Percentage',
|
||||||
'code': 'DA',
|
|
||||||
'user_type_id': self.user_type_revenue_id,
|
|
||||||
})
|
|
||||||
invoice_id = self.env['account.invoice'].create({
|
|
||||||
'name': 'Discount Invoice Test',
|
|
||||||
'partner_id': self.partner_id.id,
|
'partner_id': self.partner_id.id,
|
||||||
'currency_id': self.env.ref('base.USD').id,
|
'currency_id': self.env.ref('base.USD').id,
|
||||||
'account_id': self.account_id.id,
|
'account_id': self.account_id.id,
|
||||||
@ -72,7 +60,7 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
'date_invoice': time.strftime('%Y') + '-03-12',
|
'date_invoice': time.strftime('%Y') + '-03-12',
|
||||||
'journal_id': self.journal_id.id,
|
'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,
|
'product_id': self.env.ref("product.product_product_10").id,
|
||||||
'quantity': 10,
|
'quantity': 10,
|
||||||
'price_unit': 400,
|
'price_unit': 400,
|
||||||
@ -81,7 +69,7 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
'name': 'Mouse, Optical',
|
'name': 'Mouse, Optical',
|
||||||
'account_id': self.account_id.id,
|
'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,
|
'product_id': self.env.ref("product.product_product_12").id,
|
||||||
'quantity': 30,
|
'quantity': 30,
|
||||||
'price_unit': 250,
|
'price_unit': 250,
|
||||||
@ -91,3 +79,51 @@ class TestInvoiceDiscount(TestDiscountCommon):
|
|||||||
'account_id': self.account_id.id,
|
'account_id': self.account_id.id,
|
||||||
})
|
})
|
||||||
return invoice_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
|
||||||
|
@ -25,3 +25,10 @@ class TestDiscountInvoice(TestInvoiceDiscount):
|
|||||||
})
|
})
|
||||||
invoice_id.calculate_discount()
|
invoice_id.calculate_discount()
|
||||||
invoice_id.action_invoice_open()
|
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()
|
||||||
|
@ -45,9 +45,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
|
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
|
||||||
${user.signature | safe}
|
${user.signature | safe}
|
||||||
<p style="font-size: 11px; margin-top: 10px;">
|
|
||||||
<strong>Sent by ${user.company_id.name} using <a href="www.flectra.com" style="text-decoration:none; color: #875A7B;">Flectra</a></strong>
|
|
||||||
</p>
|
|
||||||
</div>]]></field>
|
</div>]]></field>
|
||||||
<field name="user_signature" eval="False"/>
|
<field name="user_signature" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
@ -84,9 +81,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
|
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
|
||||||
${user.signature | safe}
|
${user.signature | safe}
|
||||||
<p style="font-size: 11px; margin-top: 10px;">
|
|
||||||
<strong>Sent by ${user.company_id.name} using <a href="www.flectra.com" style="text-decoration:none; color: #875A7B;">Flectra</a></strong>
|
|
||||||
</p>
|
|
||||||
</div>]]></field>
|
</div>]]></field>
|
||||||
<field name="user_signature" eval="False"/>
|
<field name="user_signature" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
@ -128,9 +122,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
|
<div style="padding:0px;width:600px;margin:auto; margin-top: 10px; background: #fff repeat top /100%;color:#777777">
|
||||||
${user.signature | safe}
|
${user.signature | safe}
|
||||||
<p style="font-size: 11px; margin-top: 10px;">
|
|
||||||
<strong>Sent by ${user.company_id.name} using <a href="www.flectra.com" style="text-decoration:none; color: #875A7B;">Flectra</a></strong>
|
|
||||||
</p>
|
|
||||||
</div></field>
|
</div></field>
|
||||||
<field name="user_signature" eval="False"/>
|
<field name="user_signature" eval="False"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -180,7 +180,6 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top:10px;font-size: 12px;">
|
<td style="padding-top:10px;font-size: 12px;">
|
||||||
<div>Sent by ${object.company_id.name}</div>
|
|
||||||
% if 'website_url' in object.event_id and object.event_id.website_url:
|
% if 'website_url' in object.event_id and object.event_id.website_url:
|
||||||
<div>
|
<div>
|
||||||
Discover <a href="/event" style="text-decoration:none;color:#717188;">all our events</a>.
|
Discover <a href="/event" style="text-decoration:none;color:#717188;">all our events</a>.
|
||||||
@ -348,7 +347,6 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top:10px;font-size: 12px;">
|
<td style="padding-top:10px;font-size: 12px;">
|
||||||
<p style="margin:0px 0px 9px 0px;padding-top:10px;">Sent by ${object.company_id.name}</p>
|
|
||||||
% if 'website_url' in object.event_id and object.event_id.website_url:
|
% if 'website_url' in object.event_id and object.event_id.website_url:
|
||||||
<div>
|
<div>
|
||||||
Discover <a href="/event" style="text-decoration:none;color:#717188;">all our events</a>.
|
Discover <a href="/event" style="text-decoration:none;color:#717188;">all our events</a>.
|
||||||
|
@ -82,7 +82,6 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top:10px;font-size: 12px;">
|
<td style="padding-top:10px;font-size: 12px;">
|
||||||
<div>Sent by ${object.company_id.name}</div>
|
|
||||||
% if 'website_url' in object.job_id and object.job_id.website_url:
|
% if 'website_url' in object.job_id and object.job_id.website_url:
|
||||||
<div>
|
<div>
|
||||||
Discover <a href="/jobs" style="text-decoration:none;color:#717188;">our others jobs</a>.
|
Discover <a href="/jobs" style="text-decoration:none;color:#717188;">our others jobs</a>.
|
||||||
@ -229,7 +228,6 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top:10px;font-size: 12px;">
|
<td style="padding-top:10px;font-size: 12px;">
|
||||||
<div>Sent by ${object.company_id.name}</div>
|
|
||||||
% if 'website_url' in object.job_id and object.job_id.website_url:
|
% if 'website_url' in object.job_id and object.job_id.website_url:
|
||||||
<div>
|
<div>
|
||||||
Discover <a href="/jobs" style="text-decoration:none;color:#717188;">all our jobs</a>.
|
Discover <a href="/jobs" style="text-decoration:none;color:#717188;">all our jobs</a>.
|
||||||
@ -368,7 +366,6 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td style="padding-top:10px;font-size: 12px;">
|
<td style="padding-top:10px;font-size: 12px;">
|
||||||
<div>Sent by ${object.company_id.name}</div>
|
|
||||||
% if 'website_url' in object.job_id and object.job_id.website_url:
|
% if 'website_url' in object.job_id and object.job_id.website_url:
|
||||||
<div>
|
<div>
|
||||||
Discover <a href="/jobs" style="text-decoration:none;color:#717188;">all our jobs</a>.
|
Discover <a href="/jobs" style="text-decoration:none;color:#717188;">all our jobs</a>.
|
||||||
|
@ -143,18 +143,6 @@
|
|||||||
${ctx['signature'] | safe}
|
${ctx['signature'] | safe}
|
||||||
% endif
|
% endif
|
||||||
<br/>
|
<br/>
|
||||||
<p style="color: #555555;">
|
|
||||||
Sent by
|
|
||||||
% if ctx.get('website_url'):
|
|
||||||
<a href="${ctx['website_url']}" style="text-decoration:none; color: #875A7B;">
|
|
||||||
% endif
|
|
||||||
${ctx.get('company_name')}
|
|
||||||
% if ctx.get('website_url'):
|
|
||||||
</a>
|
|
||||||
% endif
|
|
||||||
using
|
|
||||||
<a target="_blank" href="https://www.flectra.com" style="text-decoration:none; color: #875A7B;">Flectra</a>.
|
|
||||||
</p>
|
|
||||||
</div>]]></field>
|
</div>]]></field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
@ -100,7 +100,6 @@
|
|||||||
% if object.project_id.rating_status == 'periodic':
|
% if object.project_id.rating_status == 'periodic':
|
||||||
<p>This customer survey is sent <b>${object.project_id.rating_status_period}</b> as long as the task is in the <b>${object.stage_id.name}</b> stage.</p>
|
<p>This customer survey is sent <b>${object.project_id.rating_status_period}</b> as long as the task is in the <b>${object.stage_id.name}</b> stage.</p>
|
||||||
% endif
|
% endif
|
||||||
<p>Email automatically sent by <a target="_blank" href="https://www.flectra.com/page/project-management" style="color:#875A7B;text-decoration:none;">Flectra Project</a> for <a href="${object.project_id.company_id.website}" style="color:#875A7B;text-decoration:none;">${object.project_id.company_id.name}</a></p>
|
|
||||||
</td></tr>
|
</td></tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
@ -69,3 +69,7 @@ class TestDiscountCommon(TransactionCase):
|
|||||||
'property_account_income_id': self.account_type_receivable_id.id})
|
'property_account_income_id': self.account_type_receivable_id.id})
|
||||||
self.product_2.write({
|
self.product_2.write({
|
||||||
'property_account_income_id': self.account_type_receivable_id.id})
|
'property_account_income_id': self.account_type_receivable_id.id})
|
||||||
|
self.sale_order = self.SaleOrder.create({
|
||||||
|
'partner_id': self.partner_id.id,
|
||||||
|
'pricelist_id': self.pricelist_id.id,
|
||||||
|
})
|
||||||
|
@ -8,18 +8,14 @@ class TestSODiscount(TestDiscountCommon):
|
|||||||
super(TestSODiscount, self).setUp()
|
super(TestSODiscount, self).setUp()
|
||||||
|
|
||||||
def discount_01_set_fixamount(self):
|
def discount_01_set_fixamount(self):
|
||||||
sale_order = self.SaleOrder.create({
|
self.sale_order.onchange_discount_method()
|
||||||
'partner_id': self.partner_id.id,
|
|
||||||
'pricelist_id': self.pricelist_id.id,
|
|
||||||
})
|
|
||||||
sale_order.onchange_discount_method()
|
|
||||||
self.SaleOrderLine.create({
|
self.SaleOrderLine.create({
|
||||||
'name': self.product_1.name,
|
'name': self.product_1.name,
|
||||||
'product_id': self.product_1.id,
|
'product_id': self.product_1.id,
|
||||||
'product_uom_qty': 20,
|
'product_uom_qty': 20,
|
||||||
'product_uom': self.product_1.uom_id.id,
|
'product_uom': self.product_1.uom_id.id,
|
||||||
'price_unit': self.product_1.list_price,
|
'price_unit': self.product_1.list_price,
|
||||||
'order_id': sale_order.id,
|
'order_id': self.sale_order.id,
|
||||||
})
|
})
|
||||||
self.SaleOrderLine.create({
|
self.SaleOrderLine.create({
|
||||||
'name': self.product_2.name,
|
'name': self.product_2.name,
|
||||||
@ -27,21 +23,17 @@ class TestSODiscount(TestDiscountCommon):
|
|||||||
'product_uom_qty': 20,
|
'product_uom_qty': 20,
|
||||||
'product_uom': self.product_2.uom_id.id,
|
'product_uom': self.product_2.uom_id.id,
|
||||||
'price_unit': self.product_2.list_price,
|
'price_unit': self.product_2.list_price,
|
||||||
'order_id': sale_order.id,
|
'order_id': self.sale_order.id,
|
||||||
})
|
})
|
||||||
sale_order.write({
|
self.sale_order.write({
|
||||||
'discount_method': 'fixed',
|
'discount_method': 'fixed',
|
||||||
'discount_amount': 100,
|
'discount_amount': 100,
|
||||||
})
|
})
|
||||||
return sale_order
|
return self.sale_order
|
||||||
|
|
||||||
def discount_02_set_percentages(self):
|
def discount_02_set_percentages(self):
|
||||||
sale_order = self.SaleOrder.create({
|
self.sale_order.onchange_discount_method()
|
||||||
'partner_id': self.partner_id.id,
|
self.sale_order.write({
|
||||||
'pricelist_id': self.pricelist_id.id,
|
|
||||||
})
|
|
||||||
sale_order.onchange_discount_method()
|
|
||||||
sale_order.write({
|
|
||||||
'discount_method': 'per',
|
'discount_method': 'per',
|
||||||
'discount_per': 10,
|
'discount_per': 10,
|
||||||
})
|
})
|
||||||
@ -51,7 +43,7 @@ class TestSODiscount(TestDiscountCommon):
|
|||||||
'product_uom_qty': 10,
|
'product_uom_qty': 10,
|
||||||
'product_uom': self.product_1.uom_id.id,
|
'product_uom': self.product_1.uom_id.id,
|
||||||
'price_unit': self.product_1.list_price,
|
'price_unit': self.product_1.list_price,
|
||||||
'order_id': sale_order.id,
|
'order_id': self.sale_order.id,
|
||||||
'discount': 10,
|
'discount': 10,
|
||||||
})
|
})
|
||||||
self.SaleOrderLine.create({
|
self.SaleOrderLine.create({
|
||||||
@ -60,11 +52,47 @@ class TestSODiscount(TestDiscountCommon):
|
|||||||
'product_uom_qty': 20,
|
'product_uom_qty': 20,
|
||||||
'product_uom': self.product_2.uom_id.id,
|
'product_uom': self.product_2.uom_id.id,
|
||||||
'price_unit': self.product_2.list_price,
|
'price_unit': self.product_2.list_price,
|
||||||
'order_id': sale_order.id,
|
'order_id': self.sale_order.id,
|
||||||
'discount': 10,
|
'discount': 10,
|
||||||
})
|
})
|
||||||
sale_order.write({
|
self.sale_order.write({
|
||||||
'discount_method': 'per',
|
'discount_method': 'per',
|
||||||
'discount_per': 20.0,
|
'discount_per': 20.0,
|
||||||
})
|
})
|
||||||
return sale_order
|
return self.sale_order
|
||||||
|
|
||||||
|
def discount_03_check_include_taxes(self):
|
||||||
|
self.sale_order.onchange_discount_method()
|
||||||
|
|
||||||
|
tax_id = self.env['account.tax'].create({
|
||||||
|
'name': 'Tax 7.7',
|
||||||
|
'amount': 7.7,
|
||||||
|
'amount_type': 'percent',
|
||||||
|
'price_include': True,
|
||||||
|
'include_base_amount': True,
|
||||||
|
})
|
||||||
|
|
||||||
|
self.SaleOrderLine.create({
|
||||||
|
'name': self.product_1.name,
|
||||||
|
'product_id': self.product_1.id,
|
||||||
|
'product_uom_qty': 1,
|
||||||
|
'product_uom': self.product_1.uom_id.id,
|
||||||
|
'price_unit': 100,
|
||||||
|
'tax_id': [(6, 0, [tax_id.id])],
|
||||||
|
'order_id': self.sale_order.id,
|
||||||
|
})
|
||||||
|
self.SaleOrderLine.create({
|
||||||
|
'name': self.product_2.name,
|
||||||
|
'product_id': self.product_2.id,
|
||||||
|
'product_uom_qty': 1,
|
||||||
|
'product_uom': self.product_2.uom_id.id,
|
||||||
|
'price_unit': 200,
|
||||||
|
'tax_id': [(6, 0, [tax_id.id])],
|
||||||
|
'order_id': self.sale_order.id,
|
||||||
|
})
|
||||||
|
|
||||||
|
self.sale_order.write({
|
||||||
|
'discount_method': 'fixed',
|
||||||
|
'discount_amount': 10,
|
||||||
|
})
|
||||||
|
return self.sale_order
|
||||||
|
@ -25,3 +25,14 @@ class TestSODiscountInvoice(TestSODiscount):
|
|||||||
sale_order.order_line._compute_product_updatable()
|
sale_order.order_line._compute_product_updatable()
|
||||||
sale_order.action_confirm()
|
sale_order.action_confirm()
|
||||||
sale_order.action_invoice_create()
|
sale_order.action_invoice_create()
|
||||||
|
|
||||||
|
def test_03_so_fixed_discount_include_taxes(self):
|
||||||
|
sale_order = self.discount_03_check_include_taxes()
|
||||||
|
self.assertTrue(sale_order, 'Sale Order: no sale order created')
|
||||||
|
logging.info('Successful: Sale Order Created!')
|
||||||
|
sale_order.calculate_discount()
|
||||||
|
self.assertEquals(10, round(sale_order.discount),
|
||||||
|
'Discount Calculation error')
|
||||||
|
sale_order.order_line._compute_product_updatable()
|
||||||
|
sale_order.action_confirm()
|
||||||
|
sale_order.action_invoice_create()
|
||||||
|
@ -137,11 +137,6 @@
|
|||||||
<p style="font-size: 14px;">${user.signature | safe}
|
<p style="font-size: 14px;">${user.signature | safe}
|
||||||
</p>
|
</p>
|
||||||
% endif
|
% endif
|
||||||
<p style="font-size: 11px;"><strong>Sent by
|
|
||||||
<a href="${user.company_id.website}" style="text-decoration:none; color: #875A7B;">
|
|
||||||
<strong>${user.company_id.name}</strong>
|
|
||||||
</a> using <a href="www.flectra.com" style="text-decoration:none; color: #875A7B;"><strong>Flectra</strong></a>
|
|
||||||
</strong></p>
|
|
||||||
</td>
|
</td>
|
||||||
</tr></tbody>
|
</tr></tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user