This commit is contained in:
jbeficent
2016-11-07 14:24:50 +01:00
committed by Jordi Ballester Alomar
parent cb634117cc
commit fe769edaa0
2 changed files with 29 additions and 20 deletions

View File

@@ -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",
],

View File

@@ -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',