parameters: (self, new_qty, origin_values)
docstring: Increase the quantity on the related purchase lines
              :param new_qty: new quantity (higher than the current one on SO line), expressed
                  in UoM of SO line.
              :param origin_values: map from sale line id to old value for the ordered quantity (dict)
docstring_summary: Increase the quantity on the related purchase lines
              :param new_qty: new quantity (higher than the current one on SO line), expressed
                  in UoM of SO line.
              :param origin_values: map from sale line id to old value for the ordered quantity (dict)
docstring_tokens: Increase the quantity on the related purchase lines : param new_qty : new quantity ( higher than the current one on SO line ) expressed in UoM of SO line . : param origin_values : map from sale line id to old value for the ordered quantity ( dict )
function: def _purchase_increase_ordered_qty(self, new_qty, origin_values):
          """ Increase the quantity on the related purchase lines
              :param new_qty: new quantity (higher than the current one on SO line), expressed
                  in UoM of SO line.
              :param origin_values: map from sale line id to old value for the ordered quantity (dict)
          """
          for line in self:
              last_purchase_line = self.env['purchase.order.line'].search([('sale_line_id', '=', line.id)], order='create_date DESC', limit=1)
              if last_purchase_line.state in ['draft', 'sent', 'to approve']:  # update qty for draft PO lines
                  quantity = line.product_uom._compute_quantity(new_qty, last_purchase_line.product_uom)
                  last_purchase_line.write({'product_qty': quantity})
              elif last_purchase_line.state in ['purchase', 'done', 'cancel']:  # create new PO, by forcing the quantity as the difference from SO line
                  quantity = line.product_uom._compute_quantity(new_qty - origin_values.get(line.id, 0.0), last_purchase_line.product_uom)
                  line._purchase_service_create(quantity=quantity)
function_tokens: def _purchase_increase_ordered_qty ( self , new_qty , origin_values ) : for line in self : last_purchase_line = self . env [ 'purchase.order.line' ] . search ( [ ( 'sale_line_id' , '=' , line . id ) ] , order = 'create_date DESC' , limit = 1 ) if last_purchase_line . state in [ 'draft' , 'sent' , 'to approve' ] : # update qty for draft PO lines quantity = line . product_uom . _compute_quantity ( new_qty , last_purchase_line . product_uom ) last_purchase_line . write ( { 'product_qty' : quantity } ) elif last_purchase_line . state in [ 'purchase' , 'done' , 'cancel' ] : # create new PO, by forcing the quantity as the difference from SO line quantity = line . product_uom . _compute_quantity ( new_qty - origin_values . get ( line . id , 0.0 ) , last_purchase_line . product_uom ) line . _purchase_service_create ( quantity = quantity )