2
Creating a service location
4
!record {model: stock.location, id: location_service}:
6
location_category: other
10
Creating a res.partner record
12
!record {model: res.partner, id: res_partner_a0}:
19
Creating a res.partner.address record
21
!record {model: res.partner.address, id: res_partner_address_0}:
22
partner_id: res_partner_a0
25
Creating a product.product record service with reception
27
!record {model: product.product, id: product_service_recep_p1}:
31
procure_method: make_to_order
32
international_status: product_attributes.int_1
35
Creating a product.product record stockable
37
!record {model: product.product, id: product_stockable_p2}:
41
international_status: product_attributes.int_1
45
3. First create an Incoming shipment, so we are allowed to manipulate
46
service with reception products.
47
I create a stock move with a service with reception product,
48
I then change the destination location with a non Service one.
49
An exception is raised.
51
Creating a stock.picking record
53
!record {model: stock.picking, id: stock_picking_3}:
58
Creating a stock.move record
60
!record {model: stock.move, id: stock_move_3}:
62
product_id: product_service_recep_p1
63
product_uom: product.product_uom_unit
64
location_dest_id: location_service
65
location_id: stock.stock_location_stock
66
picking_id: stock_picking_3
69
Change the destination location to non Service location
71
!python {model: stock.move}: |
75
self.write(cr, uid, ref("stock_move_3"), {'location_dest_id': ref("stock.stock_location_stock"),}, context=context)
76
except osv.except_osv, e:
77
# ok the constraint has been raised
81
assert False, 'The constraint: "Service Products must have Service Location as Destination Location." has not been triggered.'