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

« back to all changes in this revision

Viewing changes to analytic_distribution/test/bug_1681.yml

  • Committer: jf
  • Date: 2012-11-29 13:00:27 UTC
  • mfrom: (1287.9.8 unifield-wm)
  • Revision ID: jfb@tempo-consulting.fr-20121129130027-564r4yns8t5d2v7d
UTP-368 [FIX] Shouldn't be possible to source a non-stockable product to stock in the order sourcing tool (fix unit test)
lp:~unifield-team/unifield-wm/utp-368

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."