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

« back to all changes in this revision

Viewing changes to service_purchasing/test/service_purchasing-3.yml

UF-645 [MERGE] Service purchasing lp:~unifield-team/unifield-wm/uf-645

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
2
  Creating a res.partner record
 
3
 
4
  !record {model: res.partner, id: res_partner_a0}:
 
5
    credit_limit: 0.0
 
6
    debit_limit: 0.0
 
7
    name: A
 
8
    supplier: true
 
9
    
 
10
 
11
  Creating a res.partner.address record
 
12
 
13
  !record {model: res.partner.address, id: res_partner_address_0}:
 
14
    partner_id: res_partner_a0
 
15
    street: A
 
16
 
 
17
-
 
18
  Creating a product.product record service with reception
 
19
 
20
  !record {model: product.product, id: product_service_p0}:
 
21
    default_code: P0
 
22
    name: product 0 test
 
23
    type: service
 
24
    
 
25
 
26
  Creating a product.product record service with reception
 
27
 
28
  !record {model: product.product, id: product_service_recep_p1}:
 
29
    default_code: P0
 
30
    name: product 0 test
 
31
    type: service_recep
 
32
    
 
33
 
34
  Creating a product.product record stockable
 
35
 
36
  !record {model: product.product, id: product_stockable_p2}:
 
37
    default_code: P1
 
38
    name: product 1 test
 
39
    type: product
 
40
  
 
41
    
 
42
 
43
  3. First create an Incoming shipment, so we are allowed to manipulate
 
44
  service with reception products. 
 
45
  I create a stock move with a service with reception product,
 
46
  I then change the destination location with a non Service one.
 
47
  An exception is raised.
 
48
  
 
49
  Creating a stock.picking record
 
50
-
 
51
  !record {model: stock.picking, id: stock_picking_3}:
 
52
    name: test IN
 
53
    type: in
 
54
 
 
55
-
 
56
  Creating a stock.move record
 
57
 
58
  !record {model: stock.move, id: stock_move_3}:
 
59
    name: test stock move
 
60
    product_id: product_service_recep_p1
 
61
    product_uom: product.product_uom_unit
 
62
    location_dest_id: msf_profile.stock_location_service
 
63
    location_id: stock.stock_location_stock
 
64
    picking_id: stock_picking_3
 
65
 
 
66
-
 
67
  Change the destination location to non Service location
 
68
-
 
69
  !python {model: stock.move}: |
 
70
    from osv.orm import except_orm
 
71
    
 
72
    try:
 
73
      self.write(cr, uid, ref("stock_move_3"), {'location_dest_id': ref("stock.stock_location_stock"),}, context=context)
 
74
    except except_orm as e:
 
75
      # ok the constraint has been raised
 
76
      #print e
 
77
      pass
 
78
    else:
 
79
      assert False, 'The constraint: "Service Products must have Service Location as Destination Location." has not been triggered.'
 
80
    
 
81
    
 
 
b'\\ No newline at end of file'