2
Creating a res.partner record
4
!record {model: res.partner, id: res_partner_a0}:
11
Creating a res.partner.address record
13
!record {model: res.partner.address, id: res_partner_address_0}:
14
partner_id: res_partner_a0
18
Creating a product.product record service with reception
20
!record {model: product.product, id: product_service_p0}:
26
Creating a product.product record service with reception
28
!record {model: product.product, id: product_service_recep_p1}:
34
Creating a product.product record stockable
36
!record {model: product.product, id: product_stockable_p2}:
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.
49
Creating a stock.picking record
51
!record {model: stock.picking, id: stock_picking_3}:
56
Creating a stock.move record
58
!record {model: stock.move, id: stock_move_3}:
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
67
Change the destination location to non Service location
69
!python {model: stock.move}: |
70
from osv.orm import except_orm
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
79
assert False, 'The constraint: "Service Products must have Service Location as Destination Location." has not been triggered.'
b'\\ No newline at end of file'