
from openerp import api, models


class StockChangeProductQty(models.TransientModel):
    _inherit = "stock.change.product.qty"

    @api.model
    def _finalize_inventory_line(self, data):
        line_data = super(StockChangeProductQty,
                          self)._finalize_inventory_line(data)

        Company = self.env['res.company']
        location = data.location_id
        line_data['partner_id'] = (
            location.partner_id.id or
            location.company_id.partner_id.id or
            Company.browse(
                Company._company_default_get('stock.quant')
            ).partner_id.id
        )

        return line_data


from openerp import api, models


class StockChangeProductQty(models.TransientModel):
    _inherit = "stock.change.product.qty"

    @api.model
    def _prepare_inventory_line(self, inventory_id, data):
        line_data = super(StockChangeProductQty,
                          self)._prepare_inventory_line(inventory_id, data)
        Company = self.env['res.company']
        location = data.location_id
        line_data['partner_id'] = (
            location.partner_id.id or
            location.company_id.partner_id.id or
            Company.browse(
                Company._company_default_get('stock.quant')
            ).partner_id.id
        )

        return line_data


Update PR regarding hook accepted by Odoo
Update PR regarding hook accepted by Odoo

  
  from openerp import api, models
  
  
  class StockChangeProductQty(models.TransientModel):
      _inherit = "stock.change.product.qty"
  
      @api.model
-     def _finalize_inventory_line(self, data):
+     def _prepare_inventory_line(self, inventory_id, data):
          line_data = super(StockChangeProductQty,
-                           self)._finalize_inventory_line(data)
+                           self)._prepare_inventory_line(inventory_id, data)
- 
          Company = self.env['res.company']
          location = data.location_id
          line_data['partner_id'] = (
              location.partner_id.id or
              location.company_id.partner_id.id or
              Company.browse(
                  Company._company_default_get('stock.quant')
              ).partner_id.id
          )
  
          return line_data
  
+ 
Update PR regarding hook accepted by Odoo
## Code Before:

from openerp import api, models


class StockChangeProductQty(models.TransientModel):
    _inherit = "stock.change.product.qty"

    @api.model
    def _finalize_inventory_line(self, data):
        line_data = super(StockChangeProductQty,
                          self)._finalize_inventory_line(data)

        Company = self.env['res.company']
        location = data.location_id
        line_data['partner_id'] = (
            location.partner_id.id or
            location.company_id.partner_id.id or
            Company.browse(
                Company._company_default_get('stock.quant')
            ).partner_id.id
        )

        return line_data

## Instruction:
Update PR regarding hook accepted by Odoo
## Code After:

from openerp import api, models


class StockChangeProductQty(models.TransientModel):
    _inherit = "stock.change.product.qty"

    @api.model
    def _prepare_inventory_line(self, inventory_id, data):
        line_data = super(StockChangeProductQty,
                          self)._prepare_inventory_line(inventory_id, data)
        Company = self.env['res.company']
        location = data.location_id
        line_data['partner_id'] = (
            location.partner_id.id or
            location.company_id.partner_id.id or
            Company.browse(
                Company._company_default_get('stock.quant')
            ).partner_id.id
        )

        return line_data

