(self, values)
return res
If the initial demand is updated then also update the linked
        subcontract order to the new quantity.
If the initial demand is updated then also update the linked
        subcontract order to the new quantity.
If the initial demand is updated then also update the linked subcontract order to the new quantity .
def write(self, values):
        """ If the initial demand is updated then also update the linked
        subcontract order to the new quantity.
        """
        if 'product_uom_qty' in values and self.env.context.get('cancel_backorder') is not False:
            self.filtered(lambda m: m.is_subcontract and m.state not in ['draft', 'cancel', 'done'])._update_subcontract_order_qty(values['product_uom_qty'])
        res = super().write(values)
        if 'date' in values:
            for move in self:
                if move.state in ('done', 'cancel') or not move.is_subcontract:
                    continue
                move.move_orig_ids.production_id.filtered(lambda p: p.state not in ('done', 'cancel')).write({
                    'date_planned_finished': move.date,
                    'date_planned_start': move.date,
                })
        return res
def write ( self , values ) : if 'product_uom_qty' in values and self . env . context . get ( 'cancel_backorder' ) is not False : self . filtered ( lambda m : m . is_subcontract and m . state not in [ 'draft' , 'cancel' , 'done' ] ) . _update_subcontract_order_qty ( values [ 'product_uom_qty' ] ) res = super ( ) . write ( values ) if 'date' in values : for move in self : if move . state in ( 'done' , 'cancel' ) or not move . is_subcontract : continue move . move_orig_ids . production_id . filtered ( lambda p : p . state not in ( 'done' , 'cancel' ) ) . write ( { 'date_planned_finished' : move . date , 'date_planned_start' : move . date , } ) return res