[IMP]stock_account: Test case changes.
property_cost_method is removed from product.product and product.template. And use property_cost_method of product.category everywhare. In This - Used property_cost_method of product.category instead of cost_method or property_cost_method of product.template. This commit is related to task#1866333.
This commit is contained in:
@@ -24,13 +24,13 @@ class TestAveragePrice(TestPurchase):
|
||||
'standard_price': 60.0,
|
||||
'uom_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'uom_po_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'cost_method': 'average',
|
||||
'valuation': 'real_time',
|
||||
'property_stock_account_input': self.ref('purchase.o_expense'),
|
||||
'property_stock_account_output': self.ref('purchase.o_income'),
|
||||
'supplier_taxes_id': [],
|
||||
'description': 'FIFO Ice Cream',
|
||||
})
|
||||
product_cable_management_box.categ_id.property_cost_method = 'average'
|
||||
product_cable_management_box.categ_id.property_valuation = 'real_time'
|
||||
product_cable_management_box.categ_id.property_stock_account_input_categ_id = self.ref('purchase.o_expense')
|
||||
product_cable_management_box.categ_id.property_stock_account_output_categ_id = self.ref('purchase.o_income')
|
||||
|
||||
# I create a draft Purchase Order for first incoming shipment for 10 pieces at 60€
|
||||
purchase_order_1 = self.env['purchase.order'].create({
|
||||
|
||||
@@ -23,13 +23,13 @@ class TestFifoPrice(TestPurchase):
|
||||
'standard_price': 70.0,
|
||||
'uom_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'uom_po_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'property_stock_account_input': self.ref('purchase.o_expense'),
|
||||
'property_stock_account_output': self.ref('purchase.o_income'),
|
||||
'supplier_taxes_id': '[]',
|
||||
'description': 'FIFO Ice Cream',
|
||||
})
|
||||
product_cable_management_box.categ_id.property_cost_method = 'fifo'
|
||||
product_cable_management_box.categ_id.property_valuation = 'real_time'
|
||||
product_cable_management_box.categ_id.property_stock_account_input_categ_id = self.ref('purchase.o_expense')
|
||||
product_cable_management_box.categ_id.property_stock_account_output_categ_id = self.ref('purchase.o_income')
|
||||
|
||||
# I create a draft Purchase Order for first in move for 10 kg at 50 euro
|
||||
purchase_order_1 = self.env['purchase.order'].create({
|
||||
@@ -217,13 +217,13 @@ class TestFifoPrice(TestPurchase):
|
||||
'standard_price': 70.0,
|
||||
'uom_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'uom_po_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'property_stock_account_input': self.ref('purchase.o_expense'),
|
||||
'property_stock_account_output': self.ref('purchase.o_income'),
|
||||
'supplier_taxes_id': '[]',
|
||||
'description': 'FIFO Ice Cream',
|
||||
})
|
||||
product_fifo_negative.categ_id.property_cost_method = 'fifo'
|
||||
product_fifo_negative.categ_id.property_valuation = 'real_time'
|
||||
product_fifo_negative.categ_id.property_stock_account_input_categ_id = self.ref('purchase.o_expense')
|
||||
product_fifo_negative.categ_id.property_stock_account_output_categ_id = self.ref('purchase.o_income')
|
||||
|
||||
# Create outpicking.create delivery order of 100 kg.
|
||||
outgoing_shipment_neg = self.env['stock.picking'].create({
|
||||
|
||||
@@ -22,12 +22,12 @@ class TestFifoReturns(TestPurchase):
|
||||
'standard_price': 0.0,
|
||||
'uom_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'uom_po_id': self.env.ref('uom.product_uom_kgm').id,
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'property_stock_account_input': self.ref('purchase.o_expense'),
|
||||
'property_stock_account_output': self.ref('purchase.o_income'),
|
||||
'description': 'FIFO Ice Cream',
|
||||
})
|
||||
product_fiforet_icecream.categ_id.property_cost_method = 'fifo'
|
||||
product_fiforet_icecream.categ_id.property_valuation = 'real_time'
|
||||
product_fiforet_icecream.categ_id.property_stock_account_input_categ_id = self.ref('purchase.o_expense')
|
||||
product_fiforet_icecream.categ_id.property_stock_account_output_categ_id = self.ref('purchase.o_income')
|
||||
|
||||
# I create a draft Purchase Order for first in move for 10 kg at 50 euro
|
||||
purchase_order_1 = self.env['purchase.order'].create({
|
||||
|
||||
@@ -53,7 +53,7 @@ class TestStockValuation(TransactionCase):
|
||||
purchase order before validating the receipt, the value of the received goods should be set
|
||||
according to the last unit cost.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'average'
|
||||
po1 = self.env['purchase.order'].create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'order_line': [
|
||||
@@ -96,7 +96,7 @@ class TestStockValuation(TransactionCase):
|
||||
purchase order and the standard price of the product before validating the receipt, the
|
||||
value of the received goods should be set according to the last standard price.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'
|
||||
|
||||
# set a standard price
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
@@ -149,7 +149,7 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
eur_currency = self.env.ref('base.EUR')
|
||||
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'average'
|
||||
|
||||
# default currency is USD, create a purchase order in EUR
|
||||
po1 = self.env['purchase.order'].create({
|
||||
@@ -212,7 +212,7 @@ class TestStockValuation(TransactionCase):
|
||||
""" Check that the extra move when over processing a receipt is correctly merged back in
|
||||
the original move.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
po1 = self.env['purchase.order'].create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'order_line': [
|
||||
@@ -246,7 +246,7 @@ class TestStockValuation(TransactionCase):
|
||||
""" Check that the backordered move when under processing a receipt correctly keep the
|
||||
price unit of the original move.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
po1 = self.env['purchase.order'].create({
|
||||
'partner_id': self.partner_id.id,
|
||||
'order_line': [
|
||||
@@ -321,8 +321,8 @@ class TestStockValuationWithCOA(AccountingTestCase):
|
||||
|
||||
def test_fifo_anglosaxon_return(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'delivery'
|
||||
price_diff_account = self.env['account.account'].create({
|
||||
'name': 'price diff account',
|
||||
@@ -421,8 +421,8 @@ class TestStockValuationWithCOA(AccountingTestCase):
|
||||
|
||||
def test_anglosaxon_valuation(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'delivery'
|
||||
price_diff_account = self.env['account.account'].create({
|
||||
'name': 'price diff account',
|
||||
|
||||
@@ -29,8 +29,8 @@ class TestStockValuation(TransactionCase):
|
||||
'categ_id': self.env.ref('product.product_category_all').id,
|
||||
})
|
||||
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product2.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.categ_id.property_valuation = 'real_time'
|
||||
self.product2.categ_id.property_valuation = 'real_time'
|
||||
Account = self.env['account.account']
|
||||
self.stock_input_account = Account.create({
|
||||
'name': 'Stock Input',
|
||||
@@ -113,7 +113,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(price_change_aml.product_id, self.product1)
|
||||
|
||||
def test_fifo_perpetual_1(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# receive 10 units @ 10.00 per unit
|
||||
@@ -779,7 +779,7 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
def test_fifo_perpetual_2(self):
|
||||
# http://accountingexplained.com/financial/inventories/fifo-method
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# Beginning Inventory: 68 units @ 15.00 per unit
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -1223,7 +1223,7 @@ class TestStockValuation(TransactionCase):
|
||||
""" Send products that you do not have. Value the first outgoing move to the standard
|
||||
price, receive in multiple times the delivered quantity and run _fifo_vacuum to compensate.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# We expect the user to set manually set a standard price to its products if its first
|
||||
# transfer is sending products that he doesn't have.
|
||||
@@ -1416,7 +1416,7 @@ class TestStockValuation(TransactionCase):
|
||||
price, running the vacuum should not do anything. Receive 2 units at the price the two
|
||||
extra units were sent, check that no accounting entries are created.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Receive 10@10
|
||||
@@ -1584,7 +1584,7 @@ class TestStockValuation(TransactionCase):
|
||||
""" Receives 10 units, send 10 units, then send more: the extra quantity should be valued
|
||||
at the last fifo price, running the vacuum should not do anything.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Receive 10@10
|
||||
@@ -1750,7 +1750,7 @@ class TestStockValuation(TransactionCase):
|
||||
IN03 2@30 product2
|
||||
vacuum
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Receive 10@10
|
||||
@@ -1791,7 +1791,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Add a stock move, receive 10@20 of another product
|
||||
# ---------------------------------------------------------------------
|
||||
self.product2.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product2.categ_id.property_cost_method = 'fifo'
|
||||
self.product2.standard_price = 20
|
||||
move2 = self.env['stock.move'].create({
|
||||
'picking_id': receipt.id,
|
||||
@@ -1974,7 +1974,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(move4.value, -60) # after correction, the move is valued -(2*30)
|
||||
|
||||
def test_fifo_add_moveline_in_done_move_1(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Receive 10@10
|
||||
@@ -2037,7 +2037,7 @@ class TestStockValuation(TransactionCase):
|
||||
def test_fifo_edit_done_move1(self):
|
||||
""" Increase OUT done move while quantities are available.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Receive 10@10
|
||||
@@ -2216,7 +2216,7 @@ class TestStockValuation(TransactionCase):
|
||||
def test_fifo_edit_done_move2(self):
|
||||
""" Decrease, then increase OUT done move while quantities are available.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# Receive 10@10
|
||||
@@ -2305,7 +2305,7 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
def test_average_perpetual_1(self):
|
||||
# http://accountingexplained.com/financial/inventories/avco-method
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
# Beginning Inventory: 60 units @ 15.00 per unit
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -2410,7 +2410,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(move6.value, 0)
|
||||
|
||||
def test_average_perpetual_2(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 10 units at 10',
|
||||
@@ -2471,7 +2471,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(self.product1.stock_value, 87.5)
|
||||
|
||||
def test_average_perpetual_3(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 10 units at 10',
|
||||
@@ -2530,7 +2530,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(self.product1.stock_value, -187.5)
|
||||
|
||||
def test_average_perpetual_4(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 1 unit at 10',
|
||||
@@ -2566,7 +2566,7 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
def test_average_perpetual_5(self):
|
||||
''' Set owner on incoming move => no valuation '''
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 1 unit at 10',
|
||||
@@ -2590,7 +2590,7 @@ class TestStockValuation(TransactionCase):
|
||||
def test_average_negative_1(self):
|
||||
""" Test edit in the past. Receive 10, send 20, edit the second move to only send 10.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 10 units at 10',
|
||||
@@ -2644,7 +2644,7 @@ class TestStockValuation(TransactionCase):
|
||||
def test_average_negative_2(self):
|
||||
""" Send goods that you don't have in stock and never received any unit.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
# set a standard price
|
||||
self.product1.standard_price = 99
|
||||
@@ -2667,7 +2667,7 @@ class TestStockValuation(TransactionCase):
|
||||
def test_average_negative_3(self):
|
||||
""" Send goods that you don't have in stock but received and send some units before.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method= 'average'
|
||||
|
||||
# set a standard price
|
||||
self.product1.standard_price = 99
|
||||
@@ -2722,7 +2722,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(move3.value, -100.0) # as no move out were done for this product, fallback on latest cost
|
||||
|
||||
def test_average_negative_4(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
# set a standard price
|
||||
self.product1.standard_price = 99
|
||||
@@ -2745,7 +2745,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(move1.value, 100.0)
|
||||
|
||||
def test_average_negative_5(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
# in 10 @ 10
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -2871,8 +2871,8 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
def test_average_manual_1(self):
|
||||
''' Set owner on incoming move => no valuation '''
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.product_tmpl_id.valuation = 'manual_periodic'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
self.product1.categ_id.property_valuation = 'manual_periodic'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 1 unit at 10',
|
||||
@@ -2895,7 +2895,7 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
def test_standard_perpetual_1(self):
|
||||
''' Set owner on incoming move => no valuation '''
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.categ_id.property_cost_method = 'standard'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 1 unit at 10',
|
||||
@@ -2918,8 +2918,8 @@ class TestStockValuation(TransactionCase):
|
||||
|
||||
def test_standard_manual_1(self):
|
||||
''' Set owner on incoming move => no valuation '''
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.valuation = 'manual_periodic'
|
||||
self.product1.categ_id.property_cost_method = 'standard'
|
||||
self.product1.categ_id.property_valuation = 'manual_periodic'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 1 unit at 10',
|
||||
@@ -2946,7 +2946,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Use FIFO, make some operations
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# receive 10@10
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -2999,7 +2999,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Change the production valuation to AVCO
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.categ_id.property_cost_method = 'average'
|
||||
|
||||
# valuation should stay to ~240
|
||||
self.assertAlmostEqual(self.product1.stock_value, 240, delta=0.03)
|
||||
@@ -3016,7 +3016,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Use FIFO, make some operations
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# receive 10@10
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -3069,7 +3069,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# Change the production valuation to AVCO
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.categ_id.property_cost_method = 'standard'
|
||||
|
||||
# valuation should stay to ~240
|
||||
self.assertAlmostEqual(self.product1.stock_value, 240, delta=0.03)
|
||||
@@ -3088,7 +3088,7 @@ class TestStockValuation(TransactionCase):
|
||||
quants to a customer, only the one in the internal location
|
||||
should be valued.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
view_location = self.env['stock.location'].create({'name': 'view', 'usage': 'view'})
|
||||
subloc1 = self.env['stock.location'].create({
|
||||
@@ -3258,7 +3258,7 @@ class TestStockValuation(TransactionCase):
|
||||
move2._action_done()
|
||||
|
||||
def test_at_date_standard_1(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.categ_id.property_cost_method = 'standard'
|
||||
|
||||
now = Datetime.now()
|
||||
date1 = now - timedelta(days=8)
|
||||
@@ -3452,7 +3452,7 @@ class TestStockValuation(TransactionCase):
|
||||
date wizard are consistent. Afterwards, edit the done quantity of some operations. The
|
||||
valuation at date results should take these changes into account.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
now = Datetime.now()
|
||||
date1 = now - timedelta(days=8)
|
||||
@@ -3579,7 +3579,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# ending: manual valuation
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.valuation = 'manual_periodic'
|
||||
self.product1.categ_id.property_valuation = 'manual_periodic'
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).qty_at_date, 20)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).stock_value, 200)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date2)).qty_at_date, 30)
|
||||
@@ -3598,7 +3598,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# ending: perpetual valuation
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.categ_id.property_valuation = 'real_time'
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).qty_at_date, 10)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).stock_value, 100)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date2)).qty_at_date, 20)
|
||||
@@ -3615,7 +3615,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(self.product1.stock_value, 1375)
|
||||
|
||||
def test_at_date_fifo_2(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
now = Datetime.now()
|
||||
date1 = now - timedelta(days=8)
|
||||
@@ -3740,7 +3740,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# ending: manual valuation
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.valuation = 'manual_periodic'
|
||||
self.product1.categ_id.property_valuation = 'manual_periodic'
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).qty_at_date, 10)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).stock_value, 100)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date2)).qty_at_date, 20)
|
||||
@@ -3759,7 +3759,7 @@ class TestStockValuation(TransactionCase):
|
||||
# ---------------------------------------------------------------------
|
||||
# ending: perpetual valuation
|
||||
# ---------------------------------------------------------------------
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.categ_id.property_valuation = 'real_time'
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).qty_at_date, 10)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date1)).stock_value, 100)
|
||||
self.assertEqual(self.product1.with_context(to_date=Datetime.to_string(date2)).qty_at_date, 20)
|
||||
|
||||
@@ -40,8 +40,8 @@ class TestLifoPrice(common.TransactionCase):
|
||||
# category (or hand-assign the property_* version which seems...)
|
||||
# product_form.valuation = 'real_time'
|
||||
# product_form.cost_method = 'fifo'
|
||||
product_form.property_stock_account_input = self.env.ref('stock_dropshipping.o_expense')
|
||||
product_form.property_stock_account_output = self.env.ref('stock_dropshipping.o_income')
|
||||
product_form.categ_id.property_stock_account_input_categ_id = self.env.ref('stock_dropshipping.o_expense')
|
||||
product_form.categ_id.property_stock_account_output_categ_id = self.env.ref('stock_dropshipping.o_income')
|
||||
product_lifo_icecream = product_form.save()
|
||||
|
||||
# I create a draft Purchase Order for first in move for 10 pieces at 60 euro
|
||||
|
||||
@@ -108,9 +108,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
# -------------------------------------------------------------------------
|
||||
def test_dropship_standard_perpetual_continental_ordered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = False
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'order'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -126,9 +126,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
|
||||
def test_dropship_standard_perpetual_continental_delivered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = False
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'delivery'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -144,9 +144,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
|
||||
def test_dropship_fifo_perpetual_continental_ordered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = False
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.proprty_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'order'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -163,9 +163,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
def test_dropship_fifo_perpetual_continental_delivered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = False
|
||||
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'delivery'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -184,9 +184,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
# -------------------------------------------------------------------------
|
||||
def test_dropship_standard_perpetual_anglosaxon_ordered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'order'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -207,9 +207,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
|
||||
def test_dropship_standard_perpetual_anglosaxon_delivered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'delivery'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -230,9 +230,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
|
||||
def test_dropship_fifo_perpetual_anglosaxon_ordered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'order'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -250,9 +250,9 @@ class TestStockValuation(AccountingTestCase):
|
||||
|
||||
def test_dropship_fifo_perpetual_anglosaxon_delivered(self):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'delivery'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
@@ -272,7 +272,7 @@ class TestStockValuation(AccountingTestCase):
|
||||
self.env.user.company_id.anglo_saxon_accounting = True
|
||||
self.product1.product_tmpl_id.cost_method = 'standard'
|
||||
self.product1.product_tmpl_id.standard_price = 10
|
||||
self.product1.product_tmpl_id.valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'order'
|
||||
|
||||
all_amls = self._dropship_product1()
|
||||
|
||||
@@ -47,29 +47,26 @@ class TestStockLandedCostsCommon(AccountingTestCase):
|
||||
self.product_refrigerator = self.Product.create({
|
||||
'name': 'Refrigerator',
|
||||
'type': 'product',
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'standard_price': 1.0,
|
||||
'weight': 10,
|
||||
'volume': 1,
|
||||
'categ_id': self.categ_all.id})
|
||||
self.product_refrigerator.categ_id.property_cost_method = 'fifo'
|
||||
self.product_refrigerator.categ_id.property_valuation = 'real_time'
|
||||
self.product_oven = self.Product.create({
|
||||
'name': 'Microwave Oven',
|
||||
'type': 'product',
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'standard_price': 1.0,
|
||||
'weight': 20,
|
||||
'volume': 1.5,
|
||||
'categ_id': self.categ_all.id})
|
||||
self.product_oven.categ_id.property_cost_method = 'fifo'
|
||||
self.product_oven.categ_id.property_valuation = 'real_time'
|
||||
# Create service type product 1.Labour 2.Brokerage 3.Transportation 4.Packaging
|
||||
self.landed_cost = self._create_services('Landed Cost')
|
||||
self.brokerage_quantity = self._create_services('Brokerage Cost')
|
||||
self.transportation_weight = self._create_services('Transportation Cost')
|
||||
self.packaging_volume = self._create_services('Packaging Cost')
|
||||
# Ensure the account properties exists.
|
||||
self.ensure_account_property('property_stock_account_input')
|
||||
self.ensure_account_property('property_stock_account_output')
|
||||
|
||||
def _create_services(self, name):
|
||||
return self.Product.create({
|
||||
|
||||
@@ -20,23 +20,21 @@ class TestStockLandedCosts(TestStockLandedCostsCommon):
|
||||
# them for real_time valuation and fifo costing method
|
||||
product_landed_cost_1 = self.env['product.product'].create({
|
||||
'name': "LC product 1",
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'weight': 10,
|
||||
'volume': 1,
|
||||
'property_stock_account_input': self.ref('stock_landed_costs.o_expense'),
|
||||
'property_stock_account_output': self.ref('stock_landed_costs.o_income'),
|
||||
})
|
||||
product_landed_cost_1.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
product_landed_cost_1.product_tmpl_id.categ_id.property_stock_account_input_categ_id = self.ref('stock_landed_costs.o_expense')
|
||||
product_landed_cost_1.product_tmpl_id.categ_id.property_stock_account_output_categ_id = self.ref('stock_landed_costs.o_income')
|
||||
|
||||
product_landed_cost_2 = self.env['product.product'].create({
|
||||
'name': "LC product 2",
|
||||
'cost_method': 'fifo',
|
||||
'valuation': 'real_time',
|
||||
'weight': 20,
|
||||
'volume': 1.5,
|
||||
'property_stock_account_input': self.ref('stock_landed_costs.o_expense'),
|
||||
'property_stock_account_output': self.ref('stock_landed_costs.o_income'),
|
||||
})
|
||||
product_landed_cost_2.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
product_landed_cost_2.product_tmpl_id.categ_id.property_stock_account_input_categ_id = self.ref('stock_landed_costs.o_expense')
|
||||
product_landed_cost_2.product_tmpl_id.categ_id.property_stock_account_output_categ_id = self.ref('stock_landed_costs.o_income')
|
||||
|
||||
picking_default_vals = self.env['stock.picking'].default_get(list(self.env['stock.picking'].fields_get()))
|
||||
|
||||
|
||||
@@ -25,21 +25,20 @@ class TestStockLandedCostsRounding(TestStockLandedCostsCommon):
|
||||
# valuation and real price costing method
|
||||
product_landed_cost_3 = self.env['product.product'].create({
|
||||
'name': "LC product 3",
|
||||
'cost_method': 'fifo',
|
||||
'uom_id': product_uom_unit_round_1.id,
|
||||
'valuation': 'real_time',
|
||||
'property_stock_account_input': self.ref('stock_landed_costs.o_expense'),
|
||||
'property_stock_account_output': self.ref('stock_landed_costs.o_income'),
|
||||
})
|
||||
product_landed_cost_3.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
product_landed_cost_3.product_tmpl_id.categ_id.property_stock_account_input_categ_id = self.ref('stock_landed_costs.o_expense')
|
||||
product_landed_cost_3.product_tmpl_id.categ_id.property_stock_account_output_categ_id = self.ref('stock_landed_costs.o_income')
|
||||
|
||||
product_landed_cost_4 = self.env['product.product'].create({
|
||||
'name': "LC product 4",
|
||||
'cost_method': 'fifo',
|
||||
'uom_id': product_uom_unit_round_1.id,
|
||||
'valuation': 'real_time',
|
||||
'property_stock_account_input': self.ref('stock_landed_costs.o_expense'),
|
||||
'property_stock_account_output': self.ref('stock_landed_costs.o_income'),
|
||||
})
|
||||
product_landed_cost_4.product_tmpl_id.categ_id.property_cost_method = 'fifo'
|
||||
product_landed_cost_4.product_tmpl_id.categ_id.property_valuation = 'real_time'
|
||||
product_landed_cost_4.product_tmpl_id.categ_id.property_stock_account_input_categ_id = self.ref('stock_landed_costs.o_expense')
|
||||
product_landed_cost_4.product_tmpl_id.categ_id.property_stock_account_output_categ_id = self.ref('stock_landed_costs.o_income')
|
||||
|
||||
picking_default_vals = self.env['stock.picking'].default_get(list(self.env['stock.picking'].fields_get()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user