added incomin, outgoing and forecast stock

stock_warehouse_orderpoint_stock_info: Search orderpoint rules by product category
This commit is contained in:
mikelarre
2016-05-05 15:40:06 +02:00
committed by ps-tubtim
parent b8e0d8c30b
commit f8825abf1a
3 changed files with 37 additions and 3 deletions

View File

@@ -18,7 +18,7 @@
{
"name": "Reordering rules stock info",
"version": "1.0",
"version": "8.0.1.0.0",
"depends": [
"stock",
],

View File

@@ -11,9 +11,13 @@ class StockWarehouseOrderpoint(models.Model):
@api.one
def _product_available_qty(self):
self.product_location_qty = self.product_id.with_context(
product_available = self.product_id.with_context(
location=self.location_id.id
)._product_available()[self.product_id.id]['qty_available']
)._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.one
@api.depends('product_location_qty', 'product_min_qty')
@@ -22,6 +26,16 @@ class StockWarehouseOrderpoint(models.Model):
product_location_qty = fields.Float(
string='Quantity On Location', compute='_product_available_qty')
incoming_location_qty = fields.Float(
string='Incoming On Location', compute='_product_available_qty')
outgoing_location_qty = fields.Float(
string='Outgoing On Location', compute='_product_available_qty')
virtual_location_qty = fields.Float(
string='Forecast On Location', compute='_product_available_qty')
available = fields.Boolean(
string='Is enough product available?', compute='_product_available',
store=True)
product_category = fields.Many2one(string='Product Category',
related='product_id.categ_id',
store=True)

View File

@@ -6,8 +6,14 @@
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id" ref="stock.view_warehouse_orderpoint_tree" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_category"/>
</field>
<field name="product_max_qty" position="after">
<field name="product_location_qty" />
<field name="incoming_location_qty" />
<field name="outgoing_location_qty" />
<field name="virtual_location_qty" />
<field name="available" invisible="1" />
</field>
</field>
@@ -21,6 +27,9 @@
<group string="Rules" position="after">
<group string="Stock Info">
<field name="product_location_qty" />
<field name="incoming_location_qty" />
<field name="outgoing_location_qty" />
<field name="virtual_location_qty" />
</group>
</group>
</field>
@@ -31,6 +40,17 @@
<field name="model">stock.warehouse.orderpoint</field>
<field name="inherit_id" ref="stock.warehouse_orderpoint_search" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="product_category" filter_domain="[('product_category','child_of',self)]"/>
</field>
<filter string="Warehouse" position="before">
<filter string="Product" icon="terp-go-home"
domain="[]"
context="{'group_by':'product_id'}"/>
<filter string="Product Category" icon="terp-go-home"
domain="[]"
context="{'group_by':'product_category'}"/>
</filter>
<group string="Group By" position="before">
<filter string="Availability under minimum"
domain="[('available', '=', False)]"