[FIX] *: stupid assignments on non-stored fields without inverse
Some tests had to be adapted because they relied on the buggy behavior: this was particularly the case when they tried to write on readonly related fields. closes odoo/odoo#32460 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
This commit is contained in:
@@ -122,17 +122,17 @@ class TestEventFlow(TestEventCommon):
|
||||
|
||||
self.mock_datetime.now.return_value = datetime.datetime(2015, 12, 31, 12, 0)
|
||||
|
||||
self.event_0.registration_ids.event_begin_date = datetime.datetime(2015, 12, 31, 18, 0)
|
||||
self.event_0.date_begin = datetime.datetime(2015, 12, 31, 18, 0)
|
||||
self.assertEqual(self.event_0.registration_ids.get_date_range_str(), u'today')
|
||||
|
||||
self.event_0.registration_ids.event_begin_date = datetime.datetime(2016, 1, 1, 6, 0)
|
||||
self.event_0.date_begin = datetime.datetime(2016, 1, 1, 6, 0)
|
||||
self.assertEqual(self.event_0.registration_ids.get_date_range_str(), u'tomorrow')
|
||||
|
||||
self.event_0.registration_ids.event_begin_date = datetime.datetime(2016, 1, 2, 6, 0)
|
||||
self.event_0.date_begin = datetime.datetime(2016, 1, 2, 6, 0)
|
||||
self.assertEqual(self.event_0.registration_ids.get_date_range_str(), u'in 2 days')
|
||||
|
||||
self.mock_datetime.now.return_value = datetime.datetime(2015, 12, 10, 12, 0)
|
||||
self.event_0.registration_ids.event_begin_date = datetime.datetime(2016, 1, 25, 6, 0)
|
||||
self.event_0.date_begin = datetime.datetime(2016, 1, 25, 6, 0)
|
||||
self.assertEqual(self.event_0.registration_ids.get_date_range_str(), u'next month')
|
||||
|
||||
self.patcher.stop()
|
||||
|
||||
@@ -14,11 +14,16 @@ class TestRecruitmentSurvey(common.SingleTransactionCase):
|
||||
cls.department_admins = cls.env['hr.department'].create({'name': 'Admins'})
|
||||
cls.survey_sysadmin = cls.env['survey.survey'].create({'title': 'Questions for Sysadmin job offer'})
|
||||
|
||||
cls.job = cls.env['hr.job'].create({
|
||||
'name': 'Technical worker',
|
||||
'survey_id': cls.survey_sysadmin.id,
|
||||
})
|
||||
cls.job_sysadmin = cls.env['hr.applicant'].create({
|
||||
'name': 'Technical worker',
|
||||
'department_id': cls.department_admins.id,
|
||||
'description': 'A nice Sys Admin job offer !'})
|
||||
cls.job_sysadmin.survey_id = cls.survey_sysadmin
|
||||
'description': 'A nice Sys Admin job offer !',
|
||||
'job_id': cls.job.id,
|
||||
})
|
||||
|
||||
def test_start_survey(self):
|
||||
# We ensure that response is False because we don't know test order
|
||||
|
||||
@@ -480,8 +480,8 @@ class TestStockValuationWithCOA(AccountingTestCase):
|
||||
'sequence': 8,
|
||||
})
|
||||
|
||||
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.valuation = 'real_time'
|
||||
|
||||
|
||||
# Receive 10@10 ; create the vendor bill
|
||||
|
||||
@@ -63,9 +63,10 @@ class TestPacking(TransactionCase):
|
||||
packing_picking = pack_move_a.picking_id
|
||||
shipping_picking = ship_move_a.picking_id
|
||||
|
||||
pick_picking.picking_type_entire_packs = True
|
||||
packing_picking.picking_type_entire_packs = True
|
||||
shipping_picking.picking_type_entire_packs = True
|
||||
pick_picking.picking_type_id.show_entire_packs = True
|
||||
packing_picking.picking_type_id.show_entire_packs = True
|
||||
shipping_picking.picking_type_id.show_entire_packs = True
|
||||
|
||||
pick_picking.action_assign()
|
||||
self.assertEqual(len(pick_picking.move_ids_without_package), 2)
|
||||
pick_picking.move_line_ids.filtered(lambda ml: ml.product_id == self.productA).qty_done = 1.0
|
||||
@@ -88,7 +89,6 @@ class TestPacking(TransactionCase):
|
||||
packing_picking.package_level_ids.write({'is_done': True})
|
||||
packing_picking.action_done()
|
||||
|
||||
|
||||
def test_pick_a_pack_confirm(self):
|
||||
pack = self.env['stock.quant.package'].create({'name': 'The pack to pick'})
|
||||
self.env['stock.quant']._update_available_quantity(self.productA, self.stock_location, 20.0, package_id=pack)
|
||||
@@ -98,7 +98,7 @@ class TestPacking(TransactionCase):
|
||||
'location_dest_id': self.stock_location.id,
|
||||
'state': 'draft',
|
||||
})
|
||||
picking.picking_type_entire_packs = True
|
||||
picking.picking_type_id.show_entire_packs = True
|
||||
package_level = self.env['stock.package_level'].create({
|
||||
'package_id': pack.id,
|
||||
'picking_id': picking.id,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
from datetime import timedelta
|
||||
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.fields import Date, Datetime
|
||||
from odoo.fields import Datetime
|
||||
from odoo.tests.common import Form, TransactionCase
|
||||
|
||||
|
||||
@@ -997,7 +997,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertEqual(move9.remaining_qty, 0.0) # unused in out moves
|
||||
|
||||
def test_fifo_perpetual_3(self):
|
||||
self.product1.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# in 10 @ 100
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -1110,7 +1110,7 @@ class TestStockValuation(TransactionCase):
|
||||
def test_fifo_perpetual_4(self):
|
||||
""" Fifo and return handling.
|
||||
"""
|
||||
self.product1.cost_method = 'fifo'
|
||||
self.product1.categ_id.property_cost_method = 'fifo'
|
||||
|
||||
# in 8 @ 10
|
||||
move1 = self.env['stock.move'].create({
|
||||
@@ -2589,7 +2589,7 @@ class TestStockValuation(TransactionCase):
|
||||
self.assertAlmostEqual(self.product1.stock_value, 0.0)
|
||||
|
||||
def test_average_perpetual_6(self):
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'Receive 1 unit at 10',
|
||||
@@ -2626,7 +2626,7 @@ class TestStockValuation(TransactionCase):
|
||||
""" Test edit in the past. Receive 5@10, receive 10@20, edit the first move to receive
|
||||
15 instead.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'IN 5@10',
|
||||
@@ -2666,7 +2666,7 @@ class TestStockValuation(TransactionCase):
|
||||
""" Receive 1@10, then dropship 1@20, finally return the dropship. Dropship should not
|
||||
impact the price.
|
||||
"""
|
||||
self.product1.product_tmpl_id.cost_method = 'average'
|
||||
self.product1.product_tmpl_id.categ_id.property_cost_method = 'average'
|
||||
|
||||
move1 = self.env['stock.move'].create({
|
||||
'name': 'IN 1@10',
|
||||
|
||||
@@ -38,8 +38,8 @@ class TestLifoPrice(common.TransactionCase):
|
||||
# these are not available (visible) in either product or variant
|
||||
# for views, apparently from the UI you can only set the product
|
||||
# category (or hand-assign the property_* version which seems...)
|
||||
# product_form.valuation = 'real_time'
|
||||
# product_form.cost_method = 'fifo'
|
||||
# product_form.categ_id.valuation = 'real_time'
|
||||
# product_form.categ_id.property_cost_method = 'fifo'
|
||||
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()
|
||||
|
||||
@@ -270,7 +270,7 @@ class TestStockValuation(AccountingTestCase):
|
||||
|
||||
def test_dropship_standard_perpetual_anglosaxon_ordered_return(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.categ_id.property_valuation = 'real_time'
|
||||
self.product1.product_tmpl_id.invoice_policy = 'order'
|
||||
|
||||
Reference in New Issue
Block a user