diff --git a/stock_warehouse_orderpoint_stock_info/__openerp__.py b/stock_warehouse_orderpoint_stock_info/__openerp__.py index eaca605d7..f7f17b395 100644 --- a/stock_warehouse_orderpoint_stock_info/__openerp__.py +++ b/stock_warehouse_orderpoint_stock_info/__openerp__.py @@ -12,11 +12,13 @@ "depends": [ "stock", ], - "author": "OdooMRP team," - "AvanzOSC," - "Tecnativa", + "author": "OdooMRP team, " + "AvanzOSC, " + "Tecnativa, " + "Odoo Community Association (OCA)", "website": "http://www.odoomrp.com", "category": "Warehouse", + "license": "AGPL-3", "data": [ "views/stock_warehouse_orderpoint_view.xml", ], diff --git a/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py b/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py index c2afd30c2..755218d51 100644 --- a/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py +++ b/stock_warehouse_orderpoint_stock_info/models/stock_warehouse_orderpoint.py @@ -12,32 +12,39 @@ from openerp import models, fields, api class StockWarehouseOrderpoint(models.Model): _inherit = 'stock.warehouse.orderpoint' - @api.one - def _product_available_qty(self): - product_available = self.product_id.with_context( - location=self.location_id.id - )._product_available()[self.product_id.id] - self.product_location_qty = product_available['qty_available'] - self.incoming_location_qty = product_available['incoming_qty'] - self.outgoing_location_qty = product_available['outgoing_qty'] - self.virtual_location_qty = product_available['virtual_available'] + @api.multi + def _compute_product_available_qty(self): + for rec in self: + product_available = rec.product_id.with_context( + location=rec.location_id.id + )._product_available()[rec.product_id.id] + rec.product_location_qty = product_available['qty_available'] + rec.incoming_location_qty = product_available['incoming_qty'] + rec.outgoing_location_qty = product_available['outgoing_qty'] + rec.virtual_location_qty = product_available['virtual_available'] - @api.one + @api.multi @api.depends('product_location_qty', 'product_min_qty') - def _product_available(self): - self.available = self.product_location_qty > self.product_min_qty + def _compute_product_available(self): + for rec in self: + rec.available = rec.product_location_qty > rec.product_min_qty product_location_qty = fields.Float( - string='Quantity On Location', compute='_product_available_qty') + string='Quantity On Location', + compute='_compute_product_available_qty') incoming_location_qty = fields.Float( - string='Incoming On Location', compute='_product_available_qty') + string='Incoming On Location', + compute='_compute_product_available_qty') outgoing_location_qty = fields.Float( - string='Outgoing On Location', compute='_product_available_qty') + string='Outgoing On Location', + compute='_compute_product_available_qty') virtual_location_qty = fields.Float( - string='Forecast On Location', compute='_product_available_qty') + string='Forecast On Location', + compute='_compute_product_available_qty') available = fields.Boolean( - string='Is enough product available?', compute='_product_available', + string='Is enough product available?', + compute='_compute_product_available', store=True) product_category = fields.Many2one(string='Product Category', related='product_id.categ_id',