Commit 51bfc28 1 parent b3a5f68 commit 51bfc28 Copy full SHA for 51bfc28
File tree 1 file changed +28
-1
lines changed
mrp_production_stencil_product/models
1 file changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -10,5 +10,32 @@ class MrpBom(models.Model):
10
10
string = "Stencil products" ,
11
11
comodel_name = "mrp.bom.stencil.product" ,
12
12
inverse_name = "bom_id" ,
13
- copy = False ,
13
+ copy = True ,
14
14
)
15
+
16
+ def copy (self , default = None ):
17
+ default = default or {}
18
+ default_stencil_products = [
19
+ (
20
+ 0 ,
21
+ 0 ,
22
+ {
23
+ "product_id" : (
24
+ stencil .product_id .id if stencil .product_id else False
25
+ ),
26
+ "location_id" : (
27
+ stencil .location_id .id if stencil .location_id else False
28
+ ),
29
+ "product_uom_id" : (
30
+ stencil .product_uom_id .id if stencil .product_uom_id else False
31
+ ),
32
+ "product_uom_qty" : (
33
+ stencil .product_uom_qty if stencil .product_uom_qty else 0
34
+ ),
35
+ },
36
+ )
37
+ for stencil in self .stencil_product_ids
38
+ ]
39
+ default ["stencil_product_ids" ] = default_stencil_products
40
+ new_record = super ().copy (default )
41
+ return new_record
You can’t perform that action at this time.
0 commit comments