Add entry to show lot quantity
issue5501 review18121002
This commit is contained in:
1 parent
ab17e27abb
commit
2d9291b4a0
6 files changed
+88
-2
No files matched your search
@@ -1,3 +1,5 @@
|
||||
* Add entry to show lot quantities
|
||||
|
||||
Version 4.0.0 - 2016-05-02
|
||||
* Bug fixes (see mercurial logs for details)
|
||||
* Add Python3 support
|
||||
|
||||
@@ -9,6 +9,7 @@ from .product import *
|
||||
def register():
|
||||
Pool.register(
|
||||
Lot,
|
||||
LotByLocationContext,
|
||||
LotType,
|
||||
Move,
|
||||
ShipmentIn,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
# this repository contains the full copyright notices and license terms.
|
||||
import datetime
|
||||
|
||||
from trytond.model import ModelView, ModelSQL, fields
|
||||
from trytond.pyson import Eval
|
||||
from trytond.pool import Pool, PoolMeta
|
||||
@@ -7,9 +9,9 @@ from trytond.transaction import Transaction
|
||||
from trytond.modules.stock import StockMixin
|
||||
|
||||
__all__ = ['Lot', 'LotType', 'Move', 'ShipmentIn', 'ShipmentOut',
|
||||
'ShipmentOutReturn',
|
||||
'LotByLocationContext', 'ShipmentOutReturn',
|
||||
'Period', 'PeriodCacheLot',
|
||||
'Inventory', 'InventoryLine']
|
||||
'Inventory', 'InventoryLine', 'LotByLocationContext']
|
||||
|
||||
|
||||
class Lot(ModelSQL, ModelView, StockMixin):
|
||||
@@ -37,6 +39,29 @@ class Lot(ModelSQL, ModelView, StockMixin):
|
||||
grouping=('product', 'lot'))
|
||||
|
||||
|
||||
class LotByLocationContext(ModelView):
|
||||
'Lot by Location'
|
||||
__name__ = 'stock.lots_by_location.context'
|
||||
forecast_date = fields.Date(
|
||||
'At Date', help=('Allow to compute expected '
|
||||
'stock quantities for this date.\n'
|
||||
'* An empty value is an infinite date in the future.\n'
|
||||
'* A date in the past will provide historical values.'))
|
||||
stock_date_end = fields.Function(fields.Date('At Date'),
|
||||
'on_change_with_stock_date_end')
|
||||
|
||||
@staticmethod
|
||||
def default_forecast_date():
|
||||
Date = Pool().get('ir.date')
|
||||
return Date.today()
|
||||
|
||||
@fields.depends('forecast_date')
|
||||
def on_change_with_stock_date_end(self, name=None):
|
||||
if self.forecast_date is None:
|
||||
return datetime.datetime.max
|
||||
return self.forecast_date
|
||||
|
||||
|
||||
class LotType(ModelSQL, ModelView):
|
||||
"Stock Lot Type"
|
||||
__name__ = 'stock.lot.type'
|
||||
|
||||
@@ -14,6 +14,12 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="type">tree</field>
|
||||
<field name="name">lot_tree</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="lot_quantity_view_tree">
|
||||
<field name="model">stock.lot</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="priority" eval="20"/>
|
||||
<field name="name">lot_quantity_tree</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_lot_form">
|
||||
<field name="name">Lots</field>
|
||||
@@ -48,6 +54,41 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="lots_by_location_context_view_form">
|
||||
<field name="model">stock.lots_by_location.context</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">lot_by_location_context_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_lots_by_locations">
|
||||
<field name="name">Lot</field>
|
||||
<field name="res_model">stock.lot</field>
|
||||
<field name="context" eval="{'locations': Eval('active_ids')}"
|
||||
pyson="1"/>
|
||||
<field name="domain"
|
||||
eval="['OR', ('quantity', '!=', 0.0), ('forecast_quantity', '!=', 0.0)]"
|
||||
pyson="1"/>
|
||||
<field name="context_model">stock.lots_by_location.context</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_lots_by_locations_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="lot_quantity_view_tree"/>
|
||||
<field name="act_window" ref="act_lots_by_locations"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view"
|
||||
id="act_lots_by_locations_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="lot_view_form"/>
|
||||
<field name="act_window" ref="act_lots_by_locations"/>
|
||||
</record>
|
||||
<record model="ir.action.keyword"
|
||||
id="act_products_by_locations_keyword2">
|
||||
<field name="keyword">form_relate</field>
|
||||
<field name="model">stock.location,-1</field>
|
||||
<field name="action" ref="act_lots_by_locations"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_move_form_relate_lot">
|
||||
<field name="name">Moves</field>
|
||||
<field name="res_model">stock.move</field>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<form string="Lot by Location">
|
||||
<label name="forecast_date"/>
|
||||
<field name="forecast_date"/>
|
||||
<field name="stock_date_end" invisible="1" colspan="4"/>
|
||||
</form>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
|
||||
this repository contains the full copyright notices and license terms. -->
|
||||
<tree string="Lots">
|
||||
<field name="number"/>
|
||||
<field name="product"/>
|
||||
<field name="quantity"/>
|
||||
<field name="forecast_quantity"/>
|
||||
</tree>
|
||||
Reference in new issue
Block a user