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

« back to all changes in this revision

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

  • Committer: jf
  • Date: 2012-06-13 12:43:21 UTC
  • mfrom: (827.5.11 uf-635)
  • Revision ID: jf@tempo4-20120613124321-2b8cwgl86gyy2tb7
UF-635 [DEV] Documents workflow: Graphic representation
lp:~unifield-team/unifield-wm/uf-635 revno 838

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
    procure_method: make_to_order
 
33
    
 
34
 
35
  Creating a product.product record stockable
 
36
 
37
  !record {model: product.product, id: product_stockable_p2}:
 
38
    default_code: P1
 
39
    name: product 1 test
 
40
    type: product
 
41
  
 
42
    
 
43
 
44
  0. I create a purchase order with service category.
 
45
  I create a line with service with non service product.
 
46
  Exception is raised
 
47
  
 
48
  Creating a purchase.order record
 
49
 
50
  !record {model: purchase.order, id: purchase_order_po00}:
 
51
    partner_id: res_partner_a0
 
52
    partner_address_id: res_partner_address_0
 
53
    pricelist_id: product.list0
 
54
    location_id: stock.stock_location_stock
 
55
    categ: service
 
56
    
 
57
 
58
  Creating a purchase.order.line record for service product
 
59
 
60
  !record {model: purchase.order.line, id: purchase_order_line_p00}:
 
61
    order_id: purchase_order_po00
 
62
    price_unit: 1.0
 
63
    product_id: product_service_p0
 
64
    product_uom: product.product_uom_unit
 
65
    
 
66
-
 
67
 
 
68
  I change the product for a stockable product in the line. An exception is raised.
 
69
 
 
70
-
 
71
  !python {model: purchase.order.line}: |
 
72
    from osv.orm import except_orm
 
73
    pol = self.browse(cr, uid, ref("purchase_order_line_p00"), context=context)
 
74
    try:
 
75
      pol.write({'product_id': ref("product_stockable_p2")}, context=None)
 
76
    except except_orm as e:
 
77
      # ok the constraint is triggered
 
78
      #print e
 
79
      pass
 
80
    else:
 
81
      assert False, 'The constraint: "Purchase Order of type Category Service should contain only Service with Reception Products." has not been triggered'
 
82