~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to analytic_distribution/test/bug_1681.yml

  • Committer: chloups208
  • Date: 2011-09-07 12:58:12 UTC
  • mto: (307.2.1 unifield-wm)
  • mto: This revision was merged to the branch mainline in revision 311.
  • Revision ID: chloups208@chloups208-laptop-20110907125812-dsb1jt93ae6bgfe2
[UF-390]pro forma invoice + shipment object refactoring + pack family object refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-
2
 
  In order to test that no lines with a 0 percentage value could be created, I will create a distribution.
3
 
-
4
 
  !record {model: analytic.distribution, id: global_distrib_2}:
5
 
    name: UF-1681
6
 
-
7
 
  Then I create a cost center line to 0. This should raise an error
8
 
-
9
 
  !python {model: cost.center.distribution.line}: |
10
 
    from osv import osv
11
 
    try:
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."
17
 
        assert True
18
 
      else:
19
 
        assert False, "Another problem found."