# -*- coding: utf-8 -*-
from openerp import models, api, fields, _


class Inventory(models.Model):
    _inherit = 'stock.inventory'

    stock_move_related_count = fields.Integer(
        string='# of Invoices',
        compute='_compute_stock_move_related_count',
        help='Count invoice in billing',
    )

    @api.multi
    def _compute_stock_move_related_count(self):
        for inventory in self:
            move_ids = self.env['stock.move'].search_count([
                ('id', 'in', inventory.move_ids.ids)
            ])
            inventory.stock_move_related_count = move_ids

    @api.multi
    def stock_move_tree_view(self):
        self.ensure_one()
        action = self.env.ref('stock.action_move_form2')
        result = action.read()[0]
        result.update({'domain': [('id', 'in', self.move_ids.ids)]})
        return result


class StockInventoryLine(models.Model):
    _inherit = 'stock.inventory.line'

    @api.model
    def _get_move_values(
            self, inventory_line, qty, location_id, location_dest_id):
        res = super(StockInventoryLine, self)._get_move_values(
            inventory_line, qty, location_id, location_dest_id)
        res['name'] = inventory_line.product_id.name
        # TODO: Fix this
        res['origin'] = _('INV:') + (inventory_line.inventory_id.name or '')
        return res


class StockMove(models.Model):
    _inherit = 'stock.move'

    account_move_id = fields.Many2one(
        comodel_name='account.move',
        string='Journal Entry',
        help='Account Move',
    )

7f2425fadf0fd883c65af9aeca3392974d62c802
<mask token>


class Inventory(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


class StockInventoryLine(models.Model):
    _inherit = 'stock.inventory.line'

    @api.model
    def _get_move_values(self, inventory_line, qty, location_id,
        location_dest_id):
        res = super(StockInventoryLine, self)._get_move_values(inventory_line,
            qty, location_id, location_dest_id)
        res['name'] = inventory_line.product_id.name
        res['origin'] = _('INV:') + (inventory_line.inventory_id.name or '')
        return res


class StockMove(models.Model):
    _inherit = 'stock.move'
    account_move_id = fields.Many2one(comodel_name='account.move', string=
        'Journal Entry', help='Account Move')

<mask token>


class Inventory(models.Model):
    <mask token>
    <mask token>

    @api.multi
    def _compute_stock_move_related_count(self):
        for inventory in self:
            move_ids = self.env['stock.move'].search_count([('id', 'in',
                inventory.move_ids.ids)])
            inventory.stock_move_related_count = move_ids

    @api.multi
    def stock_move_tree_view(self):
        self.ensure_one()
        action = self.env.ref('stock.action_move_form2')
        result = action.read()[0]
        result.update({'domain': [('id', 'in', self.move_ids.ids)]})
        return result


class StockInventoryLine(models.Model):
    _inherit = 'stock.inventory.line'

    @api.model
    def _get_move_values(self, inventory_line, qty, location_id,
        location_dest_id):
        res = super(StockInventoryLine, self)._get_move_values(inventory_line,
            qty, location_id, location_dest_id)
        res['name'] = inventory_line.product_id.name
        res['origin'] = _('INV:') + (inventory_line.inventory_id.name or '')
        return res


class StockMove(models.Model):
    _inherit = 'stock.move'
    account_move_id = fields.Many2one(comodel_name='account.move', string=
        'Journal Entry', help='Account Move')

<mask token>


class Inventory(models.Model):
    _inherit = 'stock.inventory'
    stock_move_related_count = fields.Integer(string='# of Invoices',
        compute='_compute_stock_move_related_count', help=
        'Count invoice in billing')

    @api.multi
    def _compute_stock_move_related_count(self):
        for inventory in self:
            move_ids = self.env['stock.move'].search_count([('id', 'in',
                inventory.move_ids.ids)])
            inventory.stock_move_related_count = move_ids

    @api.multi
    def stock_move_tree_view(self):
        self.ensure_one()
        action = self.env.ref('stock.action_move_form2')
        result = action.read()[0]
        result.update({'domain': [('id', 'in', self.move_ids.ids)]})
        return result


class StockInventoryLine(models.Model):
    _inherit = 'stock.inventory.line'

    @api.model
    def _get_move_values(self, inventory_line, qty, location_id,
        location_dest_id):
        res = super(StockInventoryLine, self)._get_move_values(inventory_line,
            qty, location_id, location_dest_id)
        res['name'] = inventory_line.product_id.name
        res['origin'] = _('INV:') + (inventory_line.inventory_id.name or '')
        return res


class StockMove(models.Model):
    _inherit = 'stock.move'
    account_move_id = fields.Many2one(comodel_name='account.move', string=
        'Journal Entry', help='Account Move')

from openerp import models, api, fields, _


class Inventory(models.Model):
    _inherit = 'stock.inventory'
    stock_move_related_count = fields.Integer(string='# of Invoices',
        compute='_compute_stock_move_related_count', help=
        'Count invoice in billing')

    @api.multi
    def _compute_stock_move_related_count(self):
        for inventory in self:
            move_ids = self.env['stock.move'].search_count([('id', 'in',
                inventory.move_ids.ids)])
            inventory.stock_move_related_count = move_ids

    @api.multi
    def stock_move_tree_view(self):
        self.ensure_one()
        action = self.env.ref('stock.action_move_form2')
        result = action.read()[0]
        result.update({'domain': [('id', 'in', self.move_ids.ids)]})
        return result


class StockInventoryLine(models.Model):
    _inherit = 'stock.inventory.line'

    @api.model
    def _get_move_values(self, inventory_line, qty, location_id,
        location_dest_id):
        res = super(StockInventoryLine, self)._get_move_values(inventory_line,
            qty, location_id, location_dest_id)
        res['name'] = inventory_line.product_id.name
        res['origin'] = _('INV:') + (inventory_line.inventory_id.name or '')
        return res


class StockMove(models.Model):
    _inherit = 'stock.move'
    account_move_id = fields.Many2one(comodel_name='account.move', string=
        'Journal Entry', help='Account Move')

# -*- coding: utf-8 -*-
from openerp import models, api, fields, _


class Inventory(models.Model):
    _inherit = 'stock.inventory'

    stock_move_related_count = fields.Integer(
        string='# of Invoices',
        compute='_compute_stock_move_related_count',
        help='Count invoice in billing',
    )

    @api.multi
    def _compute_stock_move_related_count(self):
        for inventory in self:
            move_ids = self.env['stock.move'].search_count([
                ('id', 'in', inventory.move_ids.ids)
            ])
            inventory.stock_move_related_count = move_ids

    @api.multi
    def stock_move_tree_view(self):
        self.ensure_one()
        action = self.env.ref('stock.action_move_form2')
        result = action.read()[0]
        result.update({'domain': [('id', 'in', self.move_ids.ids)]})
        return result


class StockInventoryLine(models.Model):
    _inherit = 'stock.inventory.line'

    @api.model
    def _get_move_values(
            self, inventory_line, qty, location_id, location_dest_id):
        res = super(StockInventoryLine, self)._get_move_values(
            inventory_line, qty, location_id, location_dest_id)
        res['name'] = inventory_line.product_id.name
        # TODO: Fix this
        res['origin'] = _('INV:') + (inventory_line.inventory_id.name or '')
        return res


class StockMove(models.Model):
    _inherit = 'stock.move'

    account_move_id = fields.Many2one(
        comodel_name='account.move',
        string='Journal Entry',
        help='Account Move',
    )
