~unifield-team/unifield-wm/us-671-homere

« back to all changes in this revision

Viewing changes to sale_override/test/split_line.yml

UF-359 [FIX] Bad repercutions on engagement journal: amounts are positive

- correct engagement journal to take part of analytic lines creation

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-
2
 
  Tests of the splitting line wizard
3
 
-
4
 
  We create a new UoM
5
 
-
6
 
  !record {model: product.uom, id: split_uom}:
7
 
    category_id: product.product_uom_categ_unit
8
 
    name: Split
9
 
    factor: 1.0
10
 
    rounding: 0.01
11
 
-
12
 
  We create a new sale order
13
 
-
14
 
  !record {model: sale.order, id: split_so}:
15
 
    name: Split
16
 
    company_id: base.main_company
17
 
    picking_policy: direct
18
 
    invoice_quantity: order
19
 
    partner_order_id: address1
20
 
    partner_invoice_id: address1
21
 
    partner_shipping_id: address1
22
 
    partner_id: supplier1
23
 
    pricelist_id: purchase.list0
24
 
    order_type: regular
25
 
-
26
 
  We create a line for this sale order
27
 
-
28
 
  !record {model: sale.order.line, id: split_sol}:
29
 
    product_uom: split_uom
30
 
    product_id: product2
31
 
    order_id: split_so
32
 
    price_unit: 3.0
33
 
    product_uom_qty: 300
34
 
    name: P2
35
 
-
36
 
  Launch the split order line wizard
37
 
-
38
 
  !record {model: split.sale.order.line.wizard, id: split_wiz}:
39
 
    sale_line_id: split_sol
40
 
    original_qty: 300
41
 
    new_line_qty: 2.05
42
 
-
43
 
  Run the splitting
44
 
-
45
 
  !python {model: split.sale.order.line.wizard}: |
46
 
    self.split_line(cr, uid, ref('split_wiz'), context=context)
47
 
-
48
 
  Check if the SO has now 2 lines with the good quantities
49
 
-
50
 
  !python {model: sale.order.line}: |
51
 
    lines = self.search(cr, uid, [('order_id', '=', ref('split_so'))], context=context)
52
 
    assert len(lines) == 2, "The SO must have 2 lines after splitting, but it has %s lines !" % len(lines)
53
 
    for l in self.browse(cr, uid, lines, context=context):
54
 
      if l.product_uom_qty != 297.95 and l.product_uom_qty != 2.05:
55
 
          assert False, "The quantities of SO lines are not correct"
56
 
-
57
 
  Launch a second time the split order line wizard
58
 
-
59
 
  !record {model: split.sale.order.line.wizard, id: split_wiz1}:
60
 
    sale_line_id: split_sol
61
 
    original_qty: 297.95
62
 
    new_line_qty: 297.95
63
 
-
64
 
  Check if the splitting method return an error
65
 
-
66
 
  !python {model: split.sale.order.line.wizard}: |
67
 
     from osv import osv
68
 
     try:
69
 
       self.split_line(cr, uid, ref('split_wiz1'), context=context)
70
 
       raise False, "No error raised when the new qty is equal to the original qty"
71
 
     except osv.except_osv, e:
72
 
       pass
73
 
-
74
 
  Change the new qty to have a new qty greater than the original qty
75
 
-
76
 
  !record {model: split.sale.order.line.wizard, id: split_wiz1}:
77
 
    sale_line_id: split_sol
78
 
    original_qty: 297.95
79
 
    new_line_qty: 400
80
 
-
81
 
  Check if the splitting method return an error
82
 
-
83
 
  !python {model: split.sale.order.line.wizard}: |
84
 
     from osv import osv
85
 
     try:
86
 
       self.split_line(cr, uid, ref('split_wiz1'), context=context)
87
 
       raise False, "No error raised when the new qty is greater than the original qty"
88
 
     except osv.except_osv, e:
89
 
       pass
90
 
-
91
 
  Change the new qty to have a negative new qty
92
 
-
93
 
  !record {model: split.sale.order.line.wizard, id: split_wiz1}:
94
 
    sale_line_id: split_sol
95
 
    original_qty: 297.95
96
 
    new_line_qty: -10
97
 
-
98
 
  Check if the splitting method return an error
99
 
-
100
 
  !python {model: split.sale.order.line.wizard}: |
101
 
     from osv import osv
102
 
     try:
103
 
       self.split_line(cr, uid, ref('split_wiz1'), context=context)
104
 
       raise False, "No error raised when the new qty is negative"
105
 
     except osv.except_osv, e:
106
 
       pass
107
 
-
108
 
  Change the new qty to have a new qty equal to 0.00
109
 
-
110
 
  !record {model: split.sale.order.line.wizard, id: split_wiz1}:
111
 
    sale_line_id: split_sol
112
 
    original_qty: 297.95
113
 
    new_line_qty: 0.00
114
 
-
115
 
  Check if the splitting method return an error
116
 
-
117
 
  !python {model: split.sale.order.line.wizard}: |
118
 
     from osv import osv
119
 
     try:
120
 
       self.split_line(cr, uid, ref('split_wiz1'), context=context)
121
 
       raise False, "No error raised when the new qty is 0.00"
122
 
     except osv.except_osv, e:
123
 
       pass
124
 
-
125
 
  Change the new qty to have a new qty equal to 10.00
126
 
-
127
 
  !record {model: split.sale.order.line.wizard, id: split_wiz1}:
128
 
    sale_line_id: split_sol
129
 
    original_qty: 297.95
130
 
    new_line_qty: 10.00
131
 
-
132
 
  Check if the splitting method return an error
133
 
-
134
 
  !python {model: split.sale.order.line.wizard}: |
135
 
     from osv import osv
136
 
     try:
137
 
       self.split_line(cr, uid, ref('split_wiz1'), context=context)
138
 
     except osv.except_osv, e:
139
 
       raise False, "An error has been raised when the new qty is 10.00"