MIG account_invoice_margin to 12.0

This commit is contained in:
Jared Kipe
2019-04-08 14:39:12 -07:00
committed by Bhoomi Vaishnani
parent 164dfebfdd
commit 41c3f8f5e4
3 changed files with 10 additions and 6 deletions

View File

@@ -1,4 +1,6 @@
from odoo.addons.sale_margin.tests.test_sale_margin import TestSaleMargin
from datetime import datetime
class TestInvoiceMargin(TestSaleMargin):
@@ -10,10 +12,11 @@ class TestInvoiceMargin(TestSaleMargin):
""" Test the sale_margin module in Odoo. """
# Create a sales order for product Graphics Card.
sale_order_so11 = self.SaleOrder.create({
'date_order': datetime.today(),
'name': 'Test_SO011',
'order_line': [
(0, 0, {
'name': '[CARD] Graphics Card',
'name': '[CARD] Individual Workplace',
'purchase_price': 700.0,
'price_unit': 1000.0,
'product_uom': self.product_uom_id,
@@ -26,8 +29,7 @@ class TestInvoiceMargin(TestSaleMargin):
'purchase_price': 700.0,
'product_uom_qty': 10.0,
'state': 'draft',
'product_id': self.product_id})
],
'product_id': self.product_id})],
'partner_id': self.partner_id,
'partner_invoice_id': self.partner_invoice_address_id,
'partner_shipping_id': self.partner_invoice_address_id,
@@ -37,6 +39,8 @@ class TestInvoiceMargin(TestSaleMargin):
# Verify that margin field gets bind with the value.
self.assertEqual(sale_order_so11.margin, 6000.00, "Sales order margin should be 6000.00")
sale_order_so11.order_line.write({'qty_delivered': 10.0})
# Invoice the sales order.
inv_id = sale_order_so11.action_invoice_create()
inv = self.AccountInvoice.browse(inv_id)