parent
b7c50754e1
commit
0963960c83
|
@ -3,6 +3,7 @@
|
|||
# the full copyright notices and license terms.
|
||||
from trytond.pool import Pool
|
||||
from . import contract
|
||||
from . import history
|
||||
from . import party
|
||||
from . import plot
|
||||
from . import product
|
||||
|
@ -18,6 +19,7 @@ def register():
|
|||
contract.AgronomicsContractProductPriceListTypePriceList,
|
||||
contract.AgronomicsContract,
|
||||
contract.AgronomicsContractLine,
|
||||
history.WineAgingHistory,
|
||||
party.Party,
|
||||
plot.Enclosure,
|
||||
plot.Crop,
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains
|
||||
# the full copyright notices and license terms.
|
||||
from trytond.model import ModelSQL, ModelView, fields
|
||||
from trytond.pyson import Eval
|
||||
|
||||
|
||||
class WineAgingHistory(ModelSQL, ModelView):
|
||||
'Wine Aging History'
|
||||
__name__ = 'wine.wine_aging.history'
|
||||
production = fields.Many2One('production', "Production",
|
||||
required=True, readonly=True)
|
||||
location = fields.Many2One('stock.location', "Location", required=True,
|
||||
readonly=True)
|
||||
product = fields.Many2One('product.product', "Product", required=True,
|
||||
readonly=True)
|
||||
material = fields.Many2One('stock.location.material', "Material",
|
||||
required=True, readonly=True)
|
||||
date_start = fields.Date("Date Start", required=True, readonly=True)
|
||||
date_end = fields.Date("Date End", required=True, readonly=True,
|
||||
domain=[
|
||||
['OR',
|
||||
('end', '=', None),
|
||||
('end', '>', Eval('start')),
|
||||
],
|
||||
],
|
||||
depends=['start'])
|
||||
duration = fields.Function(fields.Integer("Duration"),
|
||||
'get_duration')
|
||||
|
||||
@classmethod
|
||||
def get_duration(cls, records, name):
|
||||
res = dict((x.id, None) for x in records)
|
||||
for record in records:
|
||||
res[record.id] = record.date_end - record.date_start
|
||||
return res
|
|
@ -0,0 +1,53 @@
|
|||
<?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. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<!-- wine aging history -->
|
||||
<record model="ir.ui.view" id="wine_aging_history_form_view">
|
||||
<field name="model">wine.wine_aging.history</field>
|
||||
<field name="type">form</field>
|
||||
<field name="name">wine_aging_history_form</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="wine_aging_history_list_view">
|
||||
<field name="model">wine.wine_aging.history</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">wine_aging_history_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_wine_aging_history">
|
||||
<field name="name">Wine Aging History</field>
|
||||
<field name="res_model">wine.wine_aging.history</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_wine_aging_history_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="wine_aging_history_list_view"/>
|
||||
<field name="act_window" ref="act_wine_aging_history"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_wine_aging_history_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="wine_aging_history_form_view"/>
|
||||
<field name="act_window" ref="act_wine_aging_history"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.access" id="access_wine_aging_history">
|
||||
<field name="model" search="[('model', '=', 'wine.wine_aging.history')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="False"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="History" sequence="0" id="menu_wine_aging_history"
|
||||
parent="menu_agronomics" action="act_wine_aging_history"/>
|
||||
|
||||
<record model="ir.ui.menu-res.group" id="menu_wine_aging_history_group_agronomics">
|
||||
<field name="menu" ref="menu_wine_aging_history"/>
|
||||
<field name="group" ref="group_agronomics"/>
|
||||
</record>
|
||||
<record model="ir.ui.menu-res.group" id="menu_wine_aging_history_group_agronomics_admin">
|
||||
<field name="menu" ref="menu_wine_aging_history"/>
|
||||
<field name="group" ref="group_agronomics_admin"/>
|
||||
</record>
|
||||
</data>
|
||||
</tryton>
|
|
@ -22,3 +22,4 @@ xml:
|
|||
location.xml
|
||||
quality.xml
|
||||
contract.xml
|
||||
history.xml
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
<form>
|
||||
<label name="production"/>
|
||||
<field name="production"/>
|
||||
<label name="location"/>
|
||||
<field name="location"/>
|
||||
<label name="product"/>
|
||||
<field name="product"/>
|
||||
<label name="material"/>
|
||||
<field name="material"/>
|
||||
<label name="date_start"/>
|
||||
<field name="date_start"/>
|
||||
<label name="date_end"/>
|
||||
<field name="date_end"/>
|
||||
<label name="duration"/>
|
||||
<field name="duration"/>
|
||||
</form>
|
|
@ -0,0 +1,9 @@
|
|||
<tree>
|
||||
<field name="production"/>
|
||||
<field name="location"/>
|
||||
<field name="product"/>
|
||||
<field name="material"/>
|
||||
<field name="date_start"/>
|
||||
<field name="date_end"/>
|
||||
<field name="duration"/>
|
||||
</tree>
|
Loading…
Reference in New Issue