Quality wine control

#044796
This commit is contained in:
Raimon Esteve 2021-08-30 12:29:39 +02:00
parent 26fea9fc4d
commit a792f1bcdd
11 changed files with 1188 additions and 25 deletions

View File

@ -5,6 +5,7 @@ from trytond.pool import Pool
from . import party
from . import plot
from . import product
from . import quality
def register():
@ -28,6 +29,9 @@ def register():
product.ProductEcological,
product.ProductVariety,
product.Template,
quality.QualityTest,
quality.QuantitativeTestLine,
quality.QualitativeTestLine,
module='agronomics', type_='model')
Pool.register(
module='agronomics', type_='wizard')

View File

@ -139,8 +139,8 @@ msgid "Irrigation"
msgstr "Irrigació"
msgctxt "field:agronomics.parcel,max_production:"
msgid "Max Production"
msgstr "Producció Màxima"
msgid "Max. Production"
msgstr "Max. producció"
msgctxt "field:agronomics.parcel,plant_number:"
msgid "Plant number"
@ -348,7 +348,7 @@ msgstr "Parcel·la"
msgctxt "model:agronomics.parcel-agronomics.do,name:"
msgid "Parcel - Denomination Origin"
msgstr ""
msgstr "Parcel·la - Denominació d'origen"
msgctxt "model:agronomics.plantation,name:"
msgid "Plantation"
@ -492,12 +492,20 @@ msgstr "Administració Agronomics"
msgctxt "selection:product.product,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vi Embotellat"
msgstr "Vi embotellat"
msgctxt "selection:product.product,agronomic_type:"
msgid "Clarified Wine"
msgstr "Vi clarificat"
msgctxt "selection:product.product,agronomic_type:"
msgid "DO Wort"
msgstr "Most DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Filtered Wine"
msgstr "Vi filtrat"
msgctxt "selection:product.product,agronomic_type:"
msgid "Grape"
msgstr "Raïm"
@ -506,18 +514,30 @@ msgctxt "selection:product.product,agronomic_type:"
msgid "Not DO Wort"
msgstr "Most no DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Unfiltered Wine"
msgstr "Vi en rama"
msgctxt "selection:product.product,agronomic_type:"
msgid "Wine"
msgstr "Vi"
msgctxt "selection:product.template,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vi Embotellat"
msgstr "Vi embotellat"
msgctxt "selection:product.template,agronomic_type:"
msgid "Clarified Wine"
msgstr "Vi clarificat"
msgctxt "selection:product.template,agronomic_type:"
msgid "DO Wort"
msgstr "Most DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Filtered Wine"
msgstr "Vi filtrat"
msgctxt "selection:product.template,agronomic_type:"
msgid "Grape"
msgstr "Raïm"
@ -526,6 +546,10 @@ msgctxt "selection:product.template,agronomic_type:"
msgid "Not DO Wort"
msgstr "Most no DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Unfiltered Wine"
msgstr "Vi en rama"
msgctxt "selection:product.template,agronomic_type:"
msgid "Wine"
msgstr "Vi"

View File

@ -139,8 +139,8 @@ msgid "Irrigation"
msgstr "Irrigación"
msgctxt "field:agronomics.parcel,max_production:"
msgid "Max Production"
msgstr "Producción Máxima"
msgid "Max. Production"
msgstr "Max. producción"
msgctxt "field:agronomics.parcel,plant_number:"
msgid "Plant number"
@ -348,7 +348,7 @@ msgstr "Parcela"
msgctxt "model:agronomics.parcel-agronomics.do,name:"
msgid "Parcel - Denomination Origin"
msgstr ""
msgstr "Parecela - Denominación de origen"
msgctxt "model:agronomics.plantation,name:"
msgid "Plantation"
@ -492,12 +492,20 @@ msgstr "Agronomics Administración"
msgctxt "selection:product.product,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vino Embotellado"
msgstr "Vino embotellado"
msgctxt "selection:product.product,agronomic_type:"
msgid "Clarified Wine"
msgstr "Vino clarificado"
msgctxt "selection:product.product,agronomic_type:"
msgid "DO Wort"
msgstr "Mosto DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Filtered Wine"
msgstr "Vino filtrado"
msgctxt "selection:product.product,agronomic_type:"
msgid "Grape"
msgstr "Uva"
@ -506,18 +514,30 @@ msgctxt "selection:product.product,agronomic_type:"
msgid "Not DO Wort"
msgstr "Mosto no DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Unfiltered Wine"
msgstr "Vino en rama"
msgctxt "selection:product.product,agronomic_type:"
msgid "Wine"
msgstr "Vino"
msgctxt "selection:product.template,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vino Embotellado"
msgstr "Vino embotellado"
msgctxt "selection:product.template,agronomic_type:"
msgid "Clarified Wine"
msgstr "Vino clarificado"
msgctxt "selection:product.template,agronomic_type:"
msgid "DO Wort"
msgstr "Mosto DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Filtered Wine"
msgstr "Vino filtrado"
msgctxt "selection:product.template,agronomic_type:"
msgid "Grape"
msgstr "Uva"
@ -526,6 +546,10 @@ msgctxt "selection:product.template,agronomic_type:"
msgid "Not DO Wort"
msgstr "Mosto no DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Unfiltered Wine"
msgstr "Vino en rama"
msgctxt "selection:product.template,agronomic_type:"
msgid "Wine"
msgstr "Vino"

View File

@ -1,10 +1,12 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from trytond.model import ModelSQL, ModelView, fields
from trytond.pool import PoolMeta, Pool
from trytond.pool import PoolMeta
from trytond.pyson import Eval
from trytond.exceptions import UserError
from trytond.i18n import gettext
from trytond.modules.agronomics.wine import WineMixin
class Certification(ModelSQL, ModelView):
@ -35,6 +37,9 @@ class Template(metaclass=PoolMeta):
('grape', "Grape"),
('do-wort', "DO Wort"),
('not-do-wort', "Not DO Wort"),
('unfiltered-wine', 'Unfiltered Wine'),
('filtered-wine', 'Filtered Wine'),
('clarified-wine', 'Clarified Wine'),
('wine', "Wine"),
('bottled-wine', "Bottled Wine"),
], "Agronomic Type", select=True)
@ -57,7 +62,7 @@ class Template(metaclass=PoolMeta):
return [('container.capacity',) + tuple(clause[1:])]
class Product(metaclass=PoolMeta):
class Product(WineMixin, metaclass=PoolMeta):
__name__ = 'product.product'
vintages = fields.Many2Many('product.product-agronomics.crop', 'product',
@ -77,19 +82,22 @@ class Product(metaclass=PoolMeta):
quality_sample = fields.Many2One('quality.sample', 'Quality Sample',
states={
'invisible': ~ Eval('agronomic_type').in_(
['wine', 'bottled-wine']
['wine', 'unfiltered-wine', 'filtered-wine', 'clarified-wine',
'bottled-wine']
)
}, depends=['agronomic_type'])
certification = fields.Many2One('agronomics.certification',
'Certification', states={
'invisible': ~ Eval('agronomic_type').in_(
['wine', 'bottled-wine']
['wine', 'unfiltered-wine', 'filtered-wine', 'clarified-wine',
'bottled-wine']
)
}, depends=['agronomic_type'])
alcohol_volume = fields.Numeric('Alcohol Volume', digits=(16, 2), states={
alcohol_volume = fields.Function(fields.Numeric('Alcohol Volume', digits=(16, 2), states={
'invisible': ~ Eval('agronomic_type').in_(
['wine', 'bottled-wine']
)}, depends=['agronomic_type'])
['wine', 'unfiltered-wine', 'filtered-wine', 'clarified-wine',
'bottled-wine']
)}, depends=['agronomic_type']), 'get_alcohol_volume')
@classmethod
def validate(cls, products):
@ -104,6 +112,13 @@ class Product(metaclass=PoolMeta):
raise UserError(gettext('agronomics.msg_variety_limit',
product=product.rec_name))
def get_alcohol_volume(self, name):
if self.template.capacity and self.wine_alcohol_content:
return Decimal(
(float(self.template.capacity) * float(self.wine_alcohol_content))
/ 100).quantize(
Decimal(str(10 ** -self.__class__.alcohol_volume.digits[1])))
class ProductCrop(ModelSQL):
"Product - Crop"

View File

@ -11,6 +11,7 @@
<field name="name">template_list</field>
<field name="inherit" ref="product.template_view_tree"/>
</record>
<!-- Product Variant-->
<record model="ir.ui.view" id="product_view_form">
<field name="model">product.product</field>
@ -22,6 +23,49 @@
<field name="name">product_list</field>
<field name="inherit" ref="product.product_view_tree"/>
</record>
<record model="ir.action.act_window" id="act_product_quality_test">
<field name="name">Quality Test</field>
<field name="res_model">quality.test</field>
<field
name="domain"
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('document.id', '=', Eval('active_id'), 'product.product'), ('document.id', 'in', Eval('active_ids'), 'product.product'))]"
pyson="1"/>
</record>
<record model="ir.action.keyword" id="act_product_quality_test_keyword">
<field name="keyword">form_relate</field>
<field name="model">product.product,-1</field>
<field name="action" ref="act_product_quality_test"/>
</record>
<record model="ir.action.act_window" id="act_product_quantitative_test_lines">
<field name="name">Quantitative Lines</field>
<field name="res_model">quality.quantitative.test.line</field>
<field
name="domain"
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('product', '=', Eval('active_id')), ('product', 'in', Eval('active_ids')))]"
pyson="1"/>
</record>
<record model="ir.action.keyword" id="act_product_quantitative_test_lines_keyword">
<field name="keyword">form_relate</field>
<field name="model">product.product,-1</field>
<field name="action" ref="act_product_quantitative_test_lines"/>
</record>
<record model="ir.action.act_window" id="act_product_qualitative_test_lines">
<field name="name">Qualitative Lines</field>
<field name="res_model">quality.qualitative.test.line</field>
<field
name="domain"
eval="[If(Eval('active_ids', []) == [Eval('active_id')], ('product', '=', Eval('active_id')), ('product', 'in', Eval('active_ids')))]"
pyson="1"/>
</record>
<record model="ir.action.keyword" id="act_product_qualitative_test_lines_keyword">
<field name="keyword">form_relate</field>
<field name="model">product.product,-1</field>
<field name="action" ref="act_product_qualitative_test_lines"/>
</record>
<!-- Certification -->
<record model="ir.ui.view" id="certification_view_form">
<field name="model">agronomics.certification</field>
@ -130,15 +174,14 @@
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_container">
<record model="ir.model.access" id="access_container">
<field name="model" search="[('model', '=', 'agronomics.container')]"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="False"/>
<field name="perm_create" eval="False"/>
<field name="perm_delete" eval="False"/>
</record>
<record model="ir.model.access" id="access_container_agronomics_admin">
<record model="ir.model.access" id="access_container_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.container')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
@ -146,7 +189,7 @@
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_container_product_admin">
<record model="ir.model.access" id="access_container_product_admin">
<field name="model" search="[('model', '=', 'agronomics.container')]"/>
<field name="group" ref="product.group_product_admin"/>
<field name="perm_read" eval="True"/>
@ -154,6 +197,5 @@
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>
</tryton>

92
quality.py Normal file
View File

@ -0,0 +1,92 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta, Pool
from trytond.model import fields, Model
from trytond.modules.agronomics.wine import _WINE_DIGITS
class QualityTest(metaclass=PoolMeta):
__name__ = 'quality.test'
@classmethod
def confirmed(cls, tests):
pool = Pool()
Product = pool.get('product.product')
ModelData = pool.get('ir.model.data')
Date = pool.get('ir.date')
super(QualityTest, cls).confirmed(tests)
today = Date.today()
# get all key from ir.model.data
to_write = []
proof_ids = []
for test in tests:
if not test.document or not isinstance(test.document, Product):
continue
proof_ids += [line.proof for line in test.quantitative_lines
if line.proof]
if not proof_ids:
return
datas = ModelData.search([
('module', '=', 'agronomics'),
('db_id', 'in', proof_ids),
('model', '=', 'quality.proof')
])
data_key = dict((x.db_id, x.fs_id) for x in datas)
# check all quantitative lines has key and update the product
for test in tests:
if not test.document or not isinstance(test.document, Product):
continue
values = {}
for line in test.quantitative_lines:
key = data_key.get(line.proof.id)
if not key:
continue
values[key] = round(line.value, _WINE_DIGITS)
values[key + '_comment'] = line.internal_description
values[key + '_confirm'] = today
values[key + '_success'] = line.success
if values:
to_write.extend(([test.document], values))
if to_write:
Product.write(*to_write)
class TestLineMixin(Model):
product = fields.Function(fields.Many2One('product.product', 'Product', select=True),
'get_product', searcher='search_product')
def get_product(self, name):
Product = Pool().get('product.product')
if isinstance(self.test.document, Product):
return self.test.document.id
@classmethod
def search_product(cls, name, clause):
Product = Pool().get('product.product')
_, operator, value = clause[0:3]
if isinstance(value, list):
values = [('%s,%s' % ('product.product',
v.id if isinstance(v, Product) else v)) for v in value]
else:
values = '%s,%s' % ('product.product',
value.id if isinstance(value, Product) else value)
return [('test.document', operator, values)]
class QuantitativeTestLine(TestLineMixin, metaclass=PoolMeta):
__name__ = 'quality.quantitative.test.line'
class QualitativeTestLine(TestLineMixin, metaclass=PoolMeta):
__name__ = 'quality.qualitative.test.line'

View File

@ -1,6 +1,8 @@
[tryton]
version=6.0.0
depends:
ir
res
party
product_classification
product_classification_taxonomic
@ -8,5 +10,6 @@ depends:
xml:
plot.xml
party.xml
message.xml
product.xml
wine.xml
message.xml

View File

@ -1,6 +1,6 @@
<data>
<xpath expr="/form/notebook" position="inside">
<page string="Agronomics" id="agrnomics">
<page string="Agronomics" id="agronomics">
<field name="vintages" colspan="2"/>
<field name="varieties" colspan="2"/>
<field name="denominations_of_origin" colspan="2"/>
@ -17,4 +17,171 @@
<field name="capacity"/>
</page>
</xpath>
<xpath expr="/form/notebook" position="inside">
<page string="Quality" id="agronomics-quality" col="6">
<label name="wine_likely_alcohol_content"/>
<field name="wine_likely_alcohol_content"/>
<label name="wine_likely_alcohol_content_confirm"/>
<field name="wine_likely_alcohol_content_confirm"/>
<label name="wine_likely_alcohol_content_success"/>
<field name="wine_likely_alcohol_content_success"/>
<label name="wine_botrytis"/>
<field name="wine_botrytis"/>
<label name="wine_botrytis_confirm"/>
<field name="wine_botrytis_confirm"/>
<label name="wine_botrytis_success"/>
<field name="wine_botrytis_success"/>
<label name="wine_alcohol_content"/>
<field name="wine_alcohol_content"/>
<label name="wine_alcohol_content_confirm"/>
<field name="wine_alcohol_content_confirm"/>
<label name="wine_alcohol_content_success"/>
<field name="wine_alcohol_content_success"/>
<label name="wine_density"/>
<field name="wine_density"/>
<label name="wine_density_confirm"/>
<field name="wine_density_confirm"/>
<label name="wine_density_success"/>
<field name="wine_density_success"/>
<label name="wine_temperature"/>
<field name="wine_temperature"/>
<label name="wine_temperature_confirm"/>
<field name="wine_temperature_confirm"/>
<label name="wine_temperature_success"/>
<field name="wine_temperature_success"/>
<label name="wine_ph"/>
<field name="wine_ph"/>
<label name="wine_ph_confirm"/>
<field name="wine_ph_confirm"/>
<label name="wine_ph_success"/>
<field name="wine_ph_success"/>
<label name="wine_free_sulphur"/>
<field name="wine_free_sulphur"/>
<label name="wine_free_sulphur_confirm"/>
<field name="wine_free_sulphur_confirm"/>
<label name="wine_free_sulphur_success"/>
<field name="wine_free_sulphur_success"/>
<label name="wine_total_sulphur"/>
<field name="wine_total_sulphur"/>
<label name="wine_total_sulphur_confirm"/>
<field name="wine_total_sulphur_confirm"/>
<label name="wine_total_sulphur_success"/>
<field name="wine_total_sulphur_success"/>
<label name="wine_tartaric_acidity"/>
<field name="wine_tartaric_acidity"/>
<label name="wine_tartaric_acidity_confirm"/>
<field name="wine_tartaric_acidity_confirm"/>
<label name="wine_tartaric_acidity_success"/>
<field name="wine_tartaric_acidity_success"/>
<label name="wine_volatility"/>
<field name="wine_volatility"/>
<label name="wine_volatility_confirm"/>
<field name="wine_volatility_confirm"/>
<label name="wine_volatility_success"/>
<field name="wine_volatility_success"/>
<label name="wine_malic_acid"/>
<field name="wine_malic_acid"/>
<label name="wine_malic_acid_confirm"/>
<field name="wine_malic_acid_confirm"/>
<label name="wine_malic_acid_success"/>
<field name="wine_malic_acid_success"/>
<label name="wine_lactic_acid"/>
<field name="wine_lactic_acid"/>
<label name="wine_lactic_acid_confirm"/>
<field name="wine_lactic_acid_confirm"/>
<label name="wine_lactic_acid_success"/>
<field name="wine_lactic_acid_success"/>
<label name="wine_protein_stability"/>
<field name="wine_protein_stability"/>
<label name="wine_protein_stability_confirm"/>
<field name="wine_protein_stability_confirm"/>
<label name="wine_protein_stability_success"/>
<field name="wine_protein_stability_success"/>
<label name="wine_tartaric_stability"/>
<field name="wine_tartaric_stability"/>
<label name="wine_tartaric_stability_confirm"/>
<field name="wine_tartaric_stability_confirm"/>
<label name="wine_tartaric_stability_success"/>
<field name="wine_tartaric_stability_success"/>
<label name="wine_turbidity"/>
<field name="wine_turbidity"/>
<label name="wine_turbidity_confirm"/>
<field name="wine_turbidity_confirm"/>
<label name="wine_turbidity_success"/>
<field name="wine_turbidity_success"/>
<label name="wine_glucose_fructose"/>
<field name="wine_glucose_fructose"/>
<label name="wine_glucose_fructose_confirm"/>
<field name="wine_glucose_fructose_confirm"/>
<label name="wine_glucose_fructose_success"/>
<field name="wine_glucose_fructose_success"/>
<label name="wine_color_intensity"/>
<field name="wine_color_intensity"/>
<label name="wine_color_intensity_confirm"/>
<field name="wine_color_intensity_confirm"/>
<label name="wine_color_intensity_success"/>
<field name="wine_color_intensity_success"/>
<label name="wine_tone"/>
<field name="wine_tone"/>
<label name="wine_tone_confirm"/>
<field name="wine_tone_confirm"/>
<label name="wine_tone_success"/>
<field name="wine_tone_success"/>
<label name="wine_clogging"/>
<field name="wine_clogging"/>
<label name="wine_clogging_confirm"/>
<field name="wine_clogging_confirm"/>
<label name="wine_clogging_success"/>
<field name="wine_clogging_success"/>
<label name="wine_overall_impression"/>
<field name="wine_overall_impression"/>
<label name="wine_overall_impression_confirm"/>
<field name="wine_overall_impression_confirm"/>
<label name="wine_overall_impression_success"/>
<field name="wine_overall_impression_success"/>
<label name="wine_observing_phase"/>
<field name="wine_observing_phase"/>
<label name="wine_observing_phase_confirm"/>
<field name="wine_observing_phase_confirm"/>
<label name="wine_observing_phase_success"/>
<field name="wine_observing_phase_success"/>
<label name="wine_smelling_phase"/>
<field name="wine_smelling_phase"/>
<label name="wine_smelling_phase_confirm"/>
<field name="wine_smelling_phase_confirm"/>
<label name="wine_smelling_phase_success"/>
<field name="wine_smelling_phase_success"/>
<label name="wine_tasting_phase"/>
<field name="wine_tasting_phase"/>
<label name="wine_tasting_phase_confirm"/>
<field name="wine_tasting_phase_confirm"/>
<label name="wine_tasting_phase_success"/>
<field name="wine_tasting_phase_success"/>
<separator name="wine_quality_comment" colspan="6"/>
<field name="wine_quality_comment" widget="richtext" toolbar="0" yexpand="1" yfill="1" colspan="6"/>
</page>
</xpath>
</data>

View File

@ -9,5 +9,120 @@
<field name="alcohol_volume" tree_invisible="1"/>
<field name="container" tree_invisible="1"/>
<field name="capacity" tree_invisible="1"/>
<field name="wine_likely_alcohol_content" tree_invisible="1"/>
<field name="wine_likely_alcohol_content_comment" tree_invisible="1"/>
<field name="wine_likely_alcohol_content_confirm" tree_invisible="1"/>
<field name="wine_likely_alcohol_content_success" tree_invisible="1"/>
<field name="wine_botrytis" tree_invisible="1"/>
<field name="wine_botrytis_comment" tree_invisible="1"/>
<field name="wine_botrytis_confirm" tree_invisible="1"/>
<field name="wine_botrytis_success" tree_invisible="1"/>
<field name="wine_alcohol_content" tree_invisible="1"/>
<field name="wine_alcohol_content_comment" tree_invisible="1"/>
<field name="wine_alcohol_content_confirm" tree_invisible="1"/>
<field name="wine_alcohol_content_success" tree_invisible="1"/>
<field name="wine_density" tree_invisible="1"/>
<field name="wine_density_comment" tree_invisible="1"/>
<field name="wine_density_confirm" tree_invisible="1"/>
<field name="wine_density_success" tree_invisible="1"/>
<field name="wine_temperature" tree_invisible="1"/>
<field name="wine_temperature_comment" tree_invisible="1"/>
<field name="wine_temperature_confirm" tree_invisible="1"/>
<field name="wine_temperature_success" tree_invisible="1"/>
<field name="wine_ph" tree_invisible="1"/>
<field name="wine_ph_comment" tree_invisible="1"/>
<field name="wine_ph_confirm" tree_invisible="1"/>
<field name="wine_ph_success" tree_invisible="1"/>
<field name="wine_free_sulphur" tree_invisible="1"/>
<field name="wine_free_sulphur_comment" tree_invisible="1"/>
<field name="wine_free_sulphur_confirm" tree_invisible="1"/>
<field name="wine_free_sulphur_success" tree_invisible="1"/>
<field name="wine_total_sulphur" tree_invisible="1"/>
<field name="wine_total_sulphur_comment" tree_invisible="1"/>
<field name="wine_total_sulphur_confirm" tree_invisible="1"/>
<field name="wine_total_sulphur_success" tree_invisible="1"/>
<field name="wine_tartaric_acidity" tree_invisible="1"/>
<field name="wine_tartaric_acidity_comment" tree_invisible="1"/>
<field name="wine_tartaric_acidity_confirm" tree_invisible="1"/>
<field name="wine_tartaric_acidity_success" tree_invisible="1"/>
<field name="wine_volatility" tree_invisible="1"/>
<field name="wine_volatility_comment" tree_invisible="1"/>
<field name="wine_volatility_confirm" tree_invisible="1"/>
<field name="wine_volatility_success" tree_invisible="1"/>
<field name="wine_malic_acid" tree_invisible="1"/>
<field name="wine_malic_acid_comment" tree_invisible="1"/>
<field name="wine_malic_acid_confirm" tree_invisible="1"/>
<field name="wine_malic_acid_success" tree_invisible="1"/>
<field name="wine_lactic_acid" tree_invisible="1"/>
<field name="wine_lactic_acid_comment" tree_invisible="1"/>
<field name="wine_lactic_acid_confirm" tree_invisible="1"/>
<field name="wine_lactic_acid_success" tree_invisible="1"/>
<field name="wine_protein_stability" tree_invisible="1"/>
<field name="wine_protein_stability_comment" tree_invisible="1"/>
<field name="wine_protein_stability_confirm" tree_invisible="1"/>
<field name="wine_protein_stability_success" tree_invisible="1"/>
<field name="wine_tartaric_stability" tree_invisible="1"/>
<field name="wine_tartaric_stability_comment" tree_invisible="1"/>
<field name="wine_tartaric_stability_confirm" tree_invisible="1"/>
<field name="wine_tartaric_stability_success" tree_invisible="1"/>
<field name="wine_turbidity" tree_invisible="1"/>
<field name="wine_turbidity_comment" tree_invisible="1"/>
<field name="wine_turbidity_confirm" tree_invisible="1"/>
<field name="wine_turbidity_success" tree_invisible="1"/>
<field name="wine_glucose_fructose" tree_invisible="1"/>
<field name="wine_glucose_fructose_comment" tree_invisible="1"/>
<field name="wine_glucose_fructose_confirm" tree_invisible="1"/>
<field name="wine_glucose_fructose_success" tree_invisible="1"/>
<field name="wine_color_intensity" tree_invisible="1"/>
<field name="wine_color_intensity_comment" tree_invisible="1"/>
<field name="wine_color_intensity_confirm" tree_invisible="1"/>
<field name="wine_color_intensity_success" tree_invisible="1"/>
<field name="wine_tone" tree_invisible="1"/>
<field name="wine_tone_comment" tree_invisible="1"/>
<field name="wine_tone_confirm" tree_invisible="1"/>
<field name="wine_tone_success" tree_invisible="1"/>
<field name="wine_clogging" tree_invisible="1"/>
<field name="wine_clogging_comment" tree_invisible="1"/>
<field name="wine_clogging_confirm" tree_invisible="1"/>
<field name="wine_clogging_success" tree_invisible="1"/>
<field name="wine_overall_impression" tree_invisible="1"/>
<field name="wine_overall_impression_comment" tree_invisible="1"/>
<field name="wine_overall_impression_confirm" tree_invisible="1"/>
<field name="wine_overall_impression_success" tree_invisible="1"/>
<field name="wine_observing_phase" tree_invisible="1"/>
<field name="wine_observing_phase_comment" tree_invisible="1"/>
<field name="wine_observing_phase_confirm" tree_invisible="1"/>
<field name="wine_observing_phase_success" tree_invisible="1"/>
<field name="wine_smelling_phase" tree_invisible="1"/>
<field name="wine_smelling_phase_comment" tree_invisible="1"/>
<field name="wine_smelling_phase_confirm" tree_invisible="1"/>
<field name="wine_smelling_phase_success" tree_invisible="1"/>
<field name="wine_tasting_phase" tree_invisible="1"/>
<field name="wine_tasting_phase_comment" tree_invisible="1"/>
<field name="wine_tasting_phase_confirm" tree_invisible="1"/>
<field name="wine_tasting_phase_success" tree_invisible="1"/>
</xpath>
</data>

478
wine.py Normal file
View File

@ -0,0 +1,478 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.model import fields, Model
from trytond.pool import Pool
from trytond.pyson import Bool, Eval
from trytond.transaction import Transaction
__all__ = ['WineMixin']
_DEPENDS = ['agronomic_type']
_WINE_DIGITS = 4
class WineMixin(Model):
wine_quality_comment = fields.Function(fields.Text('Wine Quality Comments'),
'get_wine_quality_comment')
wine_likely_alcohol_content = fields.Float('Likely Alcohol Content',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort']
)}, depends=_DEPENDS)
wine_likely_alcohol_content_comment = fields.Text('Likely Alcohol Content Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort']
)}, depends=_DEPENDS)
wine_likely_alcohol_content_confirm = fields.Date('Likely Alcohol Content Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort']
)}, depends=_DEPENDS)
wine_likely_alcohol_content_success = fields.Boolean('Likely Alcohol Content Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort']
)}, depends=_DEPENDS)
wine_botrytis = fields.Float('Botrytis',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine']
)}, depends=_DEPENDS)
wine_botrytis_comment = fields.Text('Botrytis Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine']
)}, depends=_DEPENDS)
wine_botrytis_confirm = fields.Date('Botrytis Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine']
)}, depends=_DEPENDS)
wine_botrytis_success = fields.Boolean('Botrytis Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine']
)}, depends=_DEPENDS)
wine_alcohol_content = fields.Float('Alcohol Content',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_alcohol_content_comment = fields.Text('Alcohol Content Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_alcohol_content_confirm = fields.Date('Alcohol Content Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_alcohol_content_success = fields.Boolean('Alcohol Content Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_density = fields.Float('Density',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine']
)}, depends=_DEPENDS)
wine_density_comment = fields.Text('Density Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine']
)}, depends=_DEPENDS)
wine_density_confirm = fields.Date('Density Comment Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine']
)}, depends=_DEPENDS)
wine_density_success = fields.Boolean('Density Comment Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine']
)}, depends=_DEPENDS)
wine_temperature = fields.Float('Temperature',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'filtered-wine']
)}, depends=_DEPENDS)
wine_temperature_comment = fields.Text('Temperature Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'filtered-wine']
)}, depends=_DEPENDS)
wine_temperature_confirm = fields.Date('Temperature Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'filtered-wine']
)}, depends=_DEPENDS)
wine_temperature_success = fields.Boolean('Temperature Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'filtered-wine']
)}, depends=_DEPENDS)
wine_ph = fields.Float('PH',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_ph_comment = fields.Text('PH Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_ph_confirm = fields.Date('PH Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_ph_success= fields.Boolean('PH Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_free_sulphur = fields.Float('Free Sulphur',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_free_sulphur_comment = fields.Text('Free Sulphur Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_free_sulphur_confirm = fields.Date('Free Sulphur Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_free_sulphur_success = fields.Boolean('Free Sulphur Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_total_sulphur = fields.Float('Total Sulphur',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_total_sulphur_comment = fields.Text('Total Sulphur Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_total_sulphur_confirm = fields.Date('Total Sulphur Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_total_sulphur_success = fields.Boolean('Total Sulphur Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_acidity = fields.Float('Tartaric Acidity',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_acidity_comment = fields.Text('Tartaric Acidity Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_acidity_confirm = fields.Date('Tartaric Acidity Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_acidity_success = fields.Boolean('Tartaric Acidity Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_volatility = fields.Float('Volatility',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_volatility_comment = fields.Text('Volatility Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_volatility_confirm = fields.Date('Volatility Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_volatility_success = fields.Boolean('Volatility Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_malic_acid = fields.Float('Malic Acid',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_malic_acid_comment = fields.Text('Malic Acid Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_malic_acid_confirm = fields.Date('Malic Acid Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_malic_acid_success = fields.Boolean('Malic Acid Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_lactic_acid = fields.Float('Lactic Acid',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_lactic_acid_comment = fields.Text('Lactic Acid Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_lactic_acid_confirm = fields.Date('Lactic Acid Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_lactic_acid_success = fields.Boolean('Lactic Acid Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine']
)}, depends=_DEPENDS)
wine_protein_stability = fields.Float('Protein Stability',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_protein_stability_comment = fields.Text('Protein Stability Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_protein_stability_confirm = fields.Date('Protein Stability Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_protein_stability_success = fields.Boolean('Protein Stability Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_stability = fields.Float('Tartaric Stability',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_stability_comment = fields.Text('Tartaric Stability Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_stability_confirm = fields.Date('Tartaric Stability Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tartaric_stability_success = fields.Boolean('Tartaric Stability Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_turbidity = fields.Float('Turbidity',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_turbidity_comment = fields.Text('Turbidity Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_turbidity_confirm = fields.Date('Turbidity Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_turbidity_success = fields.Boolean('Turbidity Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_glucose_fructose = fields.Float('Glucose/Fructose',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_glucose_fructose_comment = fields.Text('Glucose/Fructose Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_glucose_fructose_confirm = fields.Date('Glucose/Fructose Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_glucose_fructose_success = fields.Boolean('Glucose/Fructose Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_color_intensity = fields.Float('Color Intensity',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_color_intensity_comment = fields.Text('Color Intensity Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_color_intensity_confirm = fields.Date('Color Intensity Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_color_intensity_success = fields.Boolean('Color Intensity Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tone = fields.Float('Tone',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tone_comment = fields.Text('Tone Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tone_confirm = fields.Date('Tone Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tone_success = fields.Boolean('Tone Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_clogging = fields.Float('Clogging',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_clogging_comment = fields.Text('Clogging Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_clogging_confirm = fields.Date('Clogging Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_clogging_success = fields.Boolean('Clogging Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['filtered-wine']
)}, depends=_DEPENDS)
wine_overall_impression = fields.Float('Overall Impression',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_overall_impression_comment = fields.Text('Overall Impression Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_overall_impression_confirm = fields.Date('Overall Impression Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_overall_impression_success = fields.Boolean('Overall Impression Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['grape', 'do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_observing_phase = fields.Float('Observing Phase',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_observing_phase_comment = fields.Text('Observing Phase Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_observing_phase_confirm = fields.Date('Observing Phase Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_observing_phase_success = fields.Boolean('Observing Phase Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_smelling_phase = fields.Float('Smelling Phase',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_smelling_phase_comment = fields.Text('Smelling Phase Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_smelling_phase_confirm = fields.Date('Smelling Phase Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_smelling_phase_success = fields.Boolean('Smelling Phase Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tasting_phase = fields.Float('Tasting Phase',
digits=(16, _WINE_DIGITS), readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tasting_phase_comment = fields.Text('Tasting Phase Comment',
states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tasting_phase_confirm = fields.Date('Tasting Phase Confirm', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
wine_tasting_phase_success = fields.Boolean('Tasting Phase Success', readonly=True, states={
'invisible': ~Eval('agronomic_type').in_(
['do-wort', 'not-do-wort', 'unfiltered-wine', 'clarified-wine', 'filtered-wine', 'bottled-wine']
)}, depends=_DEPENDS)
@classmethod
def get_wine_quality_comment(cls, records, name):
pool = Pool()
Translation = pool.get('ir.translation')
res = dict((x.id, None) for x in records)
language = Transaction().language
for record in records:
data = ''
for key in cls._fields.keys():
if (key.startswith('wine_') and key.endswith('_comment')
and key != 'wine_quality_comment'):
if not getattr(record, key):
continue
field_name = '%s,%s' % (cls.__name__, key)
label = (Translation.get_source(field_name, 'field', language)
or getattr(cls, key).string)
data += '<div><b>%s</b><br/>%s</div>' % (label, getattr(record, key))
res[record.id] = data
return res

199
wine.xml Normal file
View File

@ -0,0 +1,199 @@
<tryton>
<data>
<!-- quality.proof data-->
<record model="quality.proof" id="wine_likely_alcohol_content">
<field name="name">Grau esperat</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_botrytis">
<field name="name">Botrytis</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_alcohol_content">
<field name="name">Grau alcohol</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_density">
<field name="name">Densitat</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_temperature">
<field name="name">Temperatura</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_ph">
<field name="name">PH</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_free_sulphur">
<field name="name">Sulfuros lliure</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_total_sulphur">
<field name="name">Sulfurós Total</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_tartaric_acidity">
<field name="name">Acidesa tartàric</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_volatility">
<field name="name">Volatil</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_malic_acid">
<field name="name">Àcid màlic</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_lactic_acid">
<field name="name">Àcil lactica</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_protein_stability">
<field name="name">Estabilitat proteica</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_tartaric_stability">
<field name="name">Estabilitat tartarica</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_turbidity">
<field name="name">Terbolesa</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_glucose_fructose">
<field name="name">Glucosa/fructosa</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_color_intensity">
<field name="name">Intensitat colorant</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_tone">
<field name="name">Tonalitat</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_clogging">
<field name="name">Colmatacio</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_overall_impression">
<field name="name">Impresió general</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_observing_phase">
<field name="name">Fase visual</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_smelling_phase">
<field name="name">Fase olfactiva</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_tasting_phase">
<field name="name">Fase gustativa</field>
<field name="type">quantitative</field>
</record>
<record model="quality.proof" id="wine_notes">
<field name="name">Observacions</field>
<field name="type">quantitative</field>
</record>
<!-- quality.proof.method data-->
<record model="quality.proof.method" id="wine_likely_alcohol_content_method">
<field name="name">Grau esperat</field>
<field name="proof" ref="wine_likely_alcohol_content"/>
</record>
<record model="quality.proof.method" id="wine_botrytis_method">
<field name="name">Botrytis</field>
<field name="proof" ref="wine_botrytis"/>
</record>
<record model="quality.proof.method" id="wine_alcohol_content_method">
<field name="name">Grau alcohol</field>
<field name="proof" ref="wine_alcohol_content"/>
</record>
<record model="quality.proof.method" id="wine_density_method">
<field name="name">Densitat</field>
<field name="proof" ref="wine_density"/>
</record>
<record model="quality.proof.method" id="wine_temperature_method">
<field name="name">Temperatura</field>
<field name="proof" ref="wine_temperature"/>
</record>
<record model="quality.proof.method" id="wine_ph_method">
<field name="name">PH</field>
<field name="proof" ref="wine_ph"/>
</record>
<record model="quality.proof.method" id="wine_free_sulphur_method">
<field name="name">Sulfuros lliure</field>
<field name="proof" ref="wine_free_sulphur"/>
</record>
<record model="quality.proof.method" id="wine_total_sulphur_method">
<field name="name">Sulfurós Total</field>
<field name="proof" ref="wine_total_sulphur"/>
</record>
<record model="quality.proof.method" id="wine_tartaric_acidity_method">
<field name="name">Acidesa tartàric</field>
<field name="proof" ref="wine_tartaric_acidity"/>
</record>
<record model="quality.proof.method" id="wine_volatility_method">
<field name="name">Volatil</field>
<field name="proof" ref="wine_volatility"/>
</record>
<record model="quality.proof.method" id="wine_malic_acid_method">
<field name="name">Àcid màlic</field>
<field name="proof" ref="wine_malic_acid"/>
</record>
<record model="quality.proof.method" id="wine_lactic_acid_method">
<field name="name">Àcil lactica</field>
<field name="proof" ref="wine_lactic_acid"/>
</record>
<record model="quality.proof.method" id="wine_protein_stability_method">
<field name="name">Estabilitat proteica</field>
<field name="proof" ref="wine_protein_stability"/>
</record>
<record model="quality.proof.method" id="wine_tartaric_stability_method">
<field name="name">Estabilitat tartarica</field>
<field name="proof" ref="wine_tartaric_stability"/>
</record>
<record model="quality.proof.method" id="wine_turbidity_method">
<field name="name">Terbolesa</field>
<field name="proof" ref="wine_turbidity"/>
</record>
<record model="quality.proof.method" id="wine_glucose_fructose_method">
<field name="name">Glucosa/fructosa</field>
<field name="proof" ref="wine_glucose_fructose"/>
</record>
<record model="quality.proof.method" id="wine_color_intensity_method">
<field name="name">Intensitat colorant</field>
<field name="proof" ref="wine_color_intensity"/>
</record>
<record model="quality.proof.method" id="wine_tone_method">
<field name="name">Tonalitat</field>
<field name="proof" ref="wine_tone"/>
</record>
<record model="quality.proof.method" id="wine_clogging_method">
<field name="name">Colmatacio</field>
<field name="proof" ref="wine_clogging"/>
</record>
<record model="quality.proof.method" id="wine_overall_impression_method">
<field name="name">Impresió general</field>
<field name="proof" ref="wine_overall_impression"/>
</record>
<record model="quality.proof.method" id="wine_observing_phase_method">
<field name="name">Fase visual</field>
<field name="proof" ref="wine_observing_phase"/>
</record>
<record model="quality.proof.method" id="wine_smelling_phase_method">
<field name="name">Fase olfactiva</field>
<field name="proof" ref="wine_smelling_phase"/>
</record>
<record model="quality.proof.method" id="wine_tasting_phase_method">
<field name="name">Fase gustativa</field>
<field name="proof" ref="wine_tasting_phase"/>
</record>
<record model="quality.proof.method" id="wine_notes_method">
<field name="name">Observacions</field>
<field name="proof" ref="wine_notes"/>
</record>
</data>
</tryton>