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
26
Creating a product.product record service with reception
28
!record {model: product.product, id: product_service_p0}:
32
international_status: product_attributes.int_1
35
Creating a product.product record service with reception
37
!record {model: product.product, id: product_service_recep_p1}:
41
procure_method: make_to_order
42
international_status: product_attributes.int_1
45
Creating a product.product record stockable
47
!record {model: product.product, id: product_stockable_p2}:
51
international_status: product_attributes.int_1
55
1. I create a stock move, and then change the source location
56
with Service Location. An exception should be raised.
58
Creating a stock.move record
60
!record {model: stock.move, id: stock_move_1}:
62
product_id: product_stockable_p2
63
product_uom: product.product_uom_unit
64
location_dest_id: stock.stock_location_stock
65
location_id: stock.stock_location_stock
68
Change the source location to Service location
70
!python {model: stock.move}: |
72
service_location = self.pool.get('stock.location').search(cr, uid, [('service_location', '=', True)], context=context)
73
assert service_location, 'No Service Location available'
74
service_location = service_location[0]
77
self.write(cr, uid, ref("stock_move_1"), {'location_id': service_location} ,context=context)
78
except osv.except_osv as e:
79
# ok the constraint has been raised
82
assert False, 'The constraint: "You cannot select Service Location as Source Location." has not been triggered.'