File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -538,7 +538,6 @@ def create(self, values):
538538 production = super (MrpProduction , self ).create (values )
539539 production .move_raw_ids .write ({
540540 'group_id' : production .procurement_group_id .id ,
541- 'reference' : production .name , # set reference when MO name is different than 'New'
542541 })
543542 # Trigger move_raw creation when importing a file
544543 if 'import_file' in self .env .context :
Original file line number Diff line number Diff line change @@ -125,6 +125,19 @@ def _compute_is_done(self):
125125 for move in self :
126126 move .is_done = (move .state in ('done' , 'cancel' ))
127127
128+ @api .depends ('raw_material_production_id.name' )
129+ def _compute_reference (self ):
130+ not_prod_move = self .env ['stock.move' ]
131+ for move in self :
132+ if not move .raw_material_production_id :
133+ not_prod_move |= move
134+ continue
135+ move .write ({
136+ 'name' : move .raw_material_production_id .name ,
137+ 'reference' : move .raw_material_production_id .name ,
138+ })
139+ super (StockMove , not_prod_move )._compute_reference ()
140+
128141 @api .model
129142 def default_get (self , fields_list ):
130143 defaults = super (StockMove , self ).default_get (fields_list )
You can’t perform that action at this time.
0 commit comments