Merge pull request #185 from Daniel-CA/mrp_operations_extension

[8.0][FIX] mrp_operations_extension: Check option "Calc Cycles by BoM…
This commit is contained in:
Pedro M. Baeza
2017-03-29 10:34:45 +02:00
committed by GitHub
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')