[8.0][FIX] mrp_operations_extension: Check option "Calc Cycles by BoM Quantity" does not update correctly + Test update

This commit is contained in:
Daniel-CA
2017-03-28 12:45:38 +02:00
parent 82f13529f9
commit c47518d9f1
2 changed files with 5 additions and 5 deletions

View File

@@ -30,7 +30,7 @@ class MrpConfigSettings(models.TransientModel):
def get_default_parameter_cycle_bom(self):
def get_value(key, default=''):
rec = self._get_parameter(key)
return rec and rec.value or default
return rec and rec.value and rec.value != 'False' or default
return {'cycle_by_bom': get_value('cycle.by.bom', False)}
@api.multi

View File

@@ -239,9 +239,9 @@ class TestMrpOperationsExtension(common.TransactionCase):
rec.unlink()
record = wiz_config_obj.new()
record.set_parameter_cycle_bom()
rec = param_obj.search([('key', '=', 'cycle.by.bom')])
self.assertEqual(rec.value, 'False', 'Error cycle.by.bom is marked')
data = record.get_default_parameter_cycle_bom()
self.assertFalse(data['cycle_by_bom'], 'Error cycle.by.bom is marked')
record.cycle_by_bom = True
record.set_parameter_cycle_bom()
rec = param_obj.search([('key', '=', 'cycle.by.bom')])
self.assertEqual(rec.value, 'True', 'Error cycle.by.bom not marked')
data = record.get_default_parameter_cycle_bom()
self.assertTrue(data['cycle_by_bom'], 'Error cycle.by.bom not marked')