2
In order to test that no lines with a 0 percentage value could be created, I will create a distribution.
4
!record {model: analytic.distribution, id: global_distrib_2}:
7
Then I create a cost center line to 0. This should raise an error
9
!python {model: cost.center.distribution.line}: |
12
self.create(cr, uid, {'currency_id': 1, 'percentage': 0.0, 'name': 'CC Line 3', 'destination_id': ref('analytic_distribution.analytic_account_destination_operation')})
13
assert False, "System achieved line creation with a percentage value to 0. It shouldn't!"
14
except Exception as e:
15
if e.name == 'ValidateError' and e.value == 'Error occurred while validating the field(s) percentage: 0 is not allowed as percentage value!':
16
print "System raise the right error. All is OK."
19
assert False, "Another problem found."