parameters: (self, values)
return_statement: return res
docstring: If the initial demand is updated then also update the linked
          subcontract order to the new quantity.
docstring_summary: If the initial demand is updated then also update the linked
          subcontract order to the new quantity.
docstring_tokens: If the initial demand is updated then also update the linked subcontract order to the new quantity .
function: 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
function_tokens: 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