Add template agronomic type and product.product fields

#044761
This commit is contained in:
jared-nan 2021-07-12 15:58:50 +02:00 committed by GitHub
parent 7c43abc9fd
commit fb8f0222a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 954 additions and 8 deletions

View File

@ -4,6 +4,7 @@
from trytond.pool import Pool
from . import party
from . import plot
from . import product
def register():
@ -19,6 +20,14 @@ def register():
plot.Parcel,
plot.ParcelDo,
plot.Beneficiaries,
product.Certification,
product.Container,
product.Product,
product.ProductCrop,
product.ProductDO,
product.ProductEcological,
product.ProductVariety,
product.Template,
module='agronomics', type_='model')
Pool.register(
module='agronomics', type_='wizard')

View File

@ -14,6 +14,22 @@ msgctxt "field:agronomics.beneficiary,percent:"
msgid "Percent"
msgstr "Percentatge"
msgctxt "field:agronomics.certification,date:"
msgid "Date"
msgstr "Data"
msgctxt "field:agronomics.certification,number:"
msgid "Number"
msgstr "Número"
msgctxt "field:agronomics.container,capacity:"
msgid "Capacity"
msgstr "Capacitat"
msgctxt "field:agronomics.container,name:"
msgid "Name"
msgstr "Nom"
msgctxt "field:agronomics.crop,code:"
msgid "Code"
msgstr "Codi"
@ -146,10 +162,6 @@ msgctxt "field:agronomics.parcel,species:"
msgid "Spices"
msgstr "Espècie"
msgctxt "field:agronomics.parcel,spieces:"
msgid "Spices"
msgstr "Espècie"
msgctxt "field:agronomics.parcel,surface:"
msgid "Surface"
msgstr "Superfície"
@ -198,10 +210,114 @@ msgctxt "field:party.party,plantations:"
msgid "Plantation"
msgstr "Plantacións"
msgctxt "field:product.product,agronomic_type:"
msgid "Agronomic Type"
msgstr "Tipus Agronòmic"
msgctxt "field:product.product,alcohol_volume:"
msgid "Alcohol Volume"
msgstr "Volum Alcohol"
msgctxt "field:product.product,capacity:"
msgid "Capacity"
msgstr "Capacitat"
msgctxt "field:product.product,certification:"
msgid "Certification"
msgstr "Certificació"
msgctxt "field:product.product,container:"
msgid "Container"
msgstr "Envàs"
msgctxt "field:product.product,denominations_of_origin:"
msgid "DOs"
msgstr "DOs"
msgctxt "field:product.product,ecologicals:"
msgid "Ecologicals"
msgstr "Ecológics"
msgctxt "field:product.product,needs_sample:"
msgid "Needs Samples"
msgstr "Necesita mostres"
msgctxt "field:product.product,quality_sample:"
msgid "Quality Sample"
msgstr "Mostra de qualitat"
msgctxt "field:product.product,shipment_in_quality_template:"
msgid "Shipment In Quality Template"
msgstr "Plantilla qualitat albarà entrada"
msgctxt "field:product.product,shipment_out_quality_template:"
msgid "Shipment Out Quality Template"
msgstr "Plantilla qualitat albarà sortida"
msgctxt "field:product.product,varieties:"
msgid "Varieties"
msgstr "Varietats"
msgctxt "field:product.product,vintages:"
msgid "Vintages"
msgstr "Collites"
msgctxt "field:product.product-agronomics.crop,crop:"
msgid "Crop"
msgstr "Collita"
msgctxt "field:product.product-agronomics.crop,product:"
msgid "Product"
msgstr "Productes"
msgctxt "field:product.product-agronomics.denomination_of_origin,do:"
msgid "DO"
msgstr "DO"
msgctxt "field:product.product-agronomics.denomination_of_origin,product:"
msgid "Product"
msgstr "Productes"
msgctxt "field:product.product-agronomics.ecological,ecological:"
msgid "Ecological"
msgstr "Ecològic"
msgctxt "field:product.product-agronomics.ecological,product:"
msgid "Product"
msgstr "Productes"
msgctxt "field:product.product-product.taxon,product:"
msgid "Product"
msgstr "Productes"
msgctxt "field:product.product-product.taxon,variety:"
msgid "Variety"
msgstr "Varietat"
msgctxt "field:product.template,agronomic_type:"
msgid "Agronomic Type"
msgstr "Tipus Agronòmic"
msgctxt "field:product.template,capacity:"
msgid "Capacity"
msgstr "Capacitat"
msgctxt "field:product.template,container:"
msgid "Container"
msgstr "Envàs"
msgctxt "model:agronomics.beneficiary,name:"
msgid "Beneficiaries"
msgstr "Beneficiaris"
msgctxt "model:agronomics.certification,name:"
msgid "Certification"
msgstr "Certificació"
msgctxt "model:agronomics.container,name:"
msgid "Container"
msgstr "Envàs"
msgctxt "model:agronomics.crop,name:"
msgid "Crop"
msgstr "Collita"
@ -238,6 +354,14 @@ msgctxt "model:agronomics.plantation,name:"
msgid "Plantation"
msgstr "Plantació"
msgctxt "model:ir.action,name:act_certification_tree"
msgid "Certification"
msgstr "Certificació"
msgctxt "model:ir.action,name:act_container_tree"
msgid "Container"
msgstr "Envàs"
msgctxt "model:ir.action,name:act_crop_tree"
msgid "Crop"
msgstr "Collita"
@ -278,14 +402,38 @@ msgstr ""
"Els Beneficiares de les collites \"%(crop)s\" i la plantació "
"\"%(plantation)s\" han de sumar 100."
msgctxt "model:ir.message,text:msg_variety_limit"
msgid ""
"Product \"%(product)s\" cannot have more than one Variety because of its "
"agronomic type."
msgstr ""
"El producte \"%(product)s\" no pot tenir més d'una varietat degut al seu "
"tipus agronòmic"
msgctxt "model:ir.message,text:msg_vintage_limit"
msgid ""
"Product \"%(product)s\" cannot have more than one Vintage because of its "
"agronomic type."
msgstr ""
"El producte \"%(product)s\" no pot tenir més d'una collita degut al seu "
"tipus agronòmic"
msgctxt "model:ir.ui.menu,name:menu_agronomics"
msgid "Agronomics"
msgstr "Agronomics"
msgctxt "model:ir.ui.menu,name:menu_certification_list"
msgid "Certification"
msgstr "Certificació"
msgctxt "model:ir.ui.menu,name:menu_configuration"
msgid "Configuration"
msgstr "Configuració"
msgctxt "model:ir.ui.menu,name:menu_container_list"
msgid "Container"
msgstr "Envàs"
msgctxt "model:ir.ui.menu,name:menu_crop_list"
msgid "Crop"
msgstr "Collita"
@ -318,6 +466,22 @@ msgctxt "model:ir.ui.menu,name:menu_plantation_list"
msgid "Plantation"
msgstr "Plantació"
msgctxt "model:product.product-agronomics.crop,name:"
msgid "Product - Crop"
msgstr "Producte - Collita"
msgctxt "model:product.product-agronomics.denomination_of_origin,name:"
msgid "Product - DO"
msgstr "Producte - DO"
msgctxt "model:product.product-agronomics.ecological,name:"
msgid "Product - Ecological"
msgstr "Producte - Ecològic"
msgctxt "model:product.product-product.taxon,name:"
msgid "Product - Variety"
msgstr "Producte - Varietat"
msgctxt "model:res.group,name:group_agronomics"
msgid "Agronomics"
msgstr "Agronomics"
@ -325,3 +489,47 @@ msgstr "Agronomics"
msgctxt "model:res.group,name:group_agronomics_admin"
msgid "Agronomics Administration"
msgstr "Administració Agronomics"
msgctxt "selection:product.product,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vi Embotellat"
msgctxt "selection:product.product,agronomic_type:"
msgid "DO Wort"
msgstr "Most DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Grape"
msgstr "Raïm"
msgctxt "selection:product.product,agronomic_type:"
msgid "Not DO Wort"
msgstr "Most no DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Wine"
msgstr "Vi"
msgctxt "selection:product.template,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vi Embotellat"
msgctxt "selection:product.template,agronomic_type:"
msgid "DO Wort"
msgstr "Most DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Grape"
msgstr "Raïm"
msgctxt "selection:product.template,agronomic_type:"
msgid "Not DO Wort"
msgstr "Most no DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Wine"
msgstr "Vi"
msgctxt "view:product.product:"
msgid "Agronomics"
msgstr "Agronomics"

View File

@ -14,6 +14,22 @@ msgctxt "field:agronomics.beneficiary,percent:"
msgid "Percent"
msgstr "Porcentaje"
msgctxt "field:agronomics.certification,date:"
msgid "Date"
msgstr "Fecha"
msgctxt "field:agronomics.certification,number:"
msgid "Number"
msgstr "Número"
msgctxt "field:agronomics.container,capacity:"
msgid "Capacity"
msgstr "Capacidad"
msgctxt "field:agronomics.container,name:"
msgid "Name"
msgstr "Nombre"
msgctxt "field:agronomics.crop,code:"
msgid "Code"
msgstr "Código"
@ -146,10 +162,6 @@ msgctxt "field:agronomics.parcel,species:"
msgid "Spices"
msgstr "Especie"
msgctxt "field:agronomics.parcel,spieces:"
msgid "Spices"
msgstr "Especie"
msgctxt "field:agronomics.parcel,surface:"
msgid "Surface"
msgstr "Superficie"
@ -198,10 +210,114 @@ msgctxt "field:party.party,plantations:"
msgid "Plantation"
msgstr "Plantaciónes"
msgctxt "field:product.product,agronomic_type:"
msgid "Agronomic Type"
msgstr "Tipo Agronómico"
msgctxt "field:product.product,alcohol_volume:"
msgid "Alcohol Volume"
msgstr "Volumen Alcohol"
msgctxt "field:product.product,capacity:"
msgid "Capacity"
msgstr "Capacidad"
msgctxt "field:product.product,certification:"
msgid "Certification"
msgstr "Certificación"
msgctxt "field:product.product,container:"
msgid "Container"
msgstr "Envase"
msgctxt "field:product.product,denominations_of_origin:"
msgid "DOs"
msgstr "DOs"
msgctxt "field:product.product,ecologicals:"
msgid "Ecologicals"
msgstr "Ecológicos"
msgctxt "field:product.product,needs_sample:"
msgid "Needs Samples"
msgstr "Requiere muestras"
msgctxt "field:product.product,quality_sample:"
msgid "Quality Sample"
msgstr "Muestra de calidad"
msgctxt "field:product.product,shipment_in_quality_template:"
msgid "Shipment In Quality Template"
msgstr "Plantilla calidad albarán de entrada"
msgctxt "field:product.product,shipment_out_quality_template:"
msgid "Shipment Out Quality Template"
msgstr "Plantilla calidad albarán de salida"
msgctxt "field:product.product,varieties:"
msgid "Varieties"
msgstr "Variedades"
msgctxt "field:product.product,vintages:"
msgid "Vintages"
msgstr "Cosechas"
msgctxt "field:product.product-agronomics.crop,crop:"
msgid "Crop"
msgstr "Cosecha"
msgctxt "field:product.product-agronomics.crop,product:"
msgid "Product"
msgstr "Productos"
msgctxt "field:product.product-agronomics.denomination_of_origin,do:"
msgid "DO"
msgstr "DO"
msgctxt "field:product.product-agronomics.denomination_of_origin,product:"
msgid "Product"
msgstr "Productos"
msgctxt "field:product.product-agronomics.ecological,ecological:"
msgid "Ecological"
msgstr "Ecológico"
msgctxt "field:product.product-agronomics.ecological,product:"
msgid "Product"
msgstr "Productos"
msgctxt "field:product.product-product.taxon,product:"
msgid "Product"
msgstr "Productos"
msgctxt "field:product.product-product.taxon,variety:"
msgid "Variety"
msgstr "Variedad"
msgctxt "field:product.template,agronomic_type:"
msgid "Agronomic Type"
msgstr "Tipo Agronómico"
msgctxt "field:product.template,capacity:"
msgid "Capacity"
msgstr "Capacidad"
msgctxt "field:product.template,container:"
msgid "Container"
msgstr "Envase"
msgctxt "model:agronomics.beneficiary,name:"
msgid "Beneficiaries"
msgstr "Beneficiarios"
msgctxt "model:agronomics.certification,name:"
msgid "Certification"
msgstr "Certificación"
msgctxt "model:agronomics.container,name:"
msgid "Container"
msgstr "Envase"
msgctxt "model:agronomics.crop,name:"
msgid "Crop"
msgstr "Cosecha"
@ -238,6 +354,14 @@ msgctxt "model:agronomics.plantation,name:"
msgid "Plantation"
msgstr "Plantación"
msgctxt "model:ir.action,name:act_certification_tree"
msgid "Certification"
msgstr "Certificación"
msgctxt "model:ir.action,name:act_container_tree"
msgid "Container"
msgstr "Envase"
msgctxt "model:ir.action,name:act_crop_tree"
msgid "Crop"
msgstr "Cosecha"
@ -278,14 +402,38 @@ msgstr ""
"Los beneficiarios de la cosecha \"%(crop)s\" y de la plantación "
"\"%(plantation)s\" han de sumar 100."
msgctxt "model:ir.message,text:msg_variety_limit"
msgid ""
"Product \"%(product)s\" cannot have more than one Variety because of its "
"agronomic type."
msgstr ""
"El producto \"%(product)s\" no puede tener más de una variedad debido a su "
"Tipo Agronómico"
msgctxt "model:ir.message,text:msg_vintage_limit"
msgid ""
"Product \"%(product)s\" cannot have more than one Vintage because of its "
"agronomic type."
msgstr ""
"El producto \"%(product)s\" no puede tener más de una cosecha debido a su "
"Tipo Agronómico"
msgctxt "model:ir.ui.menu,name:menu_agronomics"
msgid "Agronomics"
msgstr "Agronomics"
msgctxt "model:ir.ui.menu,name:menu_certification_list"
msgid "Certification"
msgstr "Certificación"
msgctxt "model:ir.ui.menu,name:menu_configuration"
msgid "Configuration"
msgstr "Configuración"
msgctxt "model:ir.ui.menu,name:menu_container_list"
msgid "Container"
msgstr "Envase"
msgctxt "model:ir.ui.menu,name:menu_crop_list"
msgid "Crop"
msgstr "Cosecha"
@ -318,6 +466,22 @@ msgctxt "model:ir.ui.menu,name:menu_plantation_list"
msgid "Plantation"
msgstr "Plantación"
msgctxt "model:product.product-agronomics.crop,name:"
msgid "Product - Crop"
msgstr "Producto - Cosecha"
msgctxt "model:product.product-agronomics.denomination_of_origin,name:"
msgid "Product - DO"
msgstr "Producto - DO"
msgctxt "model:product.product-agronomics.ecological,name:"
msgid "Product - Ecological"
msgstr "Producto - Ecológico"
msgctxt "model:product.product-product.taxon,name:"
msgid "Product - Variety"
msgstr "Producto - Variedad"
msgctxt "model:res.group,name:group_agronomics"
msgid "Agronomics"
msgstr "Agronomics"
@ -325,3 +489,47 @@ msgstr "Agronomics"
msgctxt "model:res.group,name:group_agronomics_admin"
msgid "Agronomics Administration"
msgstr "Agronomics Administración"
msgctxt "selection:product.product,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vino Embotellado"
msgctxt "selection:product.product,agronomic_type:"
msgid "DO Wort"
msgstr "Mosto DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Grape"
msgstr "Uva"
msgctxt "selection:product.product,agronomic_type:"
msgid "Not DO Wort"
msgstr "Mosto no DO"
msgctxt "selection:product.product,agronomic_type:"
msgid "Wine"
msgstr "Vino"
msgctxt "selection:product.template,agronomic_type:"
msgid "Bottled Wine"
msgstr "Vino Embotellado"
msgctxt "selection:product.template,agronomic_type:"
msgid "DO Wort"
msgstr "Mosto DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Grape"
msgstr "Uva"
msgctxt "selection:product.template,agronomic_type:"
msgid "Not DO Wort"
msgstr "Mosto no DO"
msgctxt "selection:product.template,agronomic_type:"
msgid "Wine"
msgstr "Vino"
msgctxt "view:product.product:"
msgid "Agronomics"
msgstr "Agronomics"

View File

@ -6,5 +6,11 @@ this repository contains the full copyright notices and license terms. -->
<record model="ir.message" id="msg_beneficiaris_percent">
<field name="text">Beneficiaris of Crop "%(crop)s" and Plantation "%(plantation)s" must sum 100.</field>
</record>
<record model="ir.message" id="msg_vintage_limit">
<field name="text">Product "%(product)s" cannot have more than one Vintage because of its agronomic type.</field>
</record>
<record model="ir.message" id="msg_variety_limit">
<field name="text">Product "%(product)s" cannot have more than one Variety because of its agronomic type.</field>
</record>
</data>
</tryton>

142
plot.xml
View File

@ -400,6 +400,148 @@
<field name="name">beneficiary_list</field>
</record>
<record model="ir.model.access" id="access_enclosure">
<field name="model" search="[('model', '=', 'agronomics.enclosure')]"/>
<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_enclosure_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.enclosure')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_crop">
<field name="model" search="[('model', '=', 'agronomics.crop')]"/>
<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_crop_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.crop')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_denomination_of_origin">
<field name="model" search="[('model', '=', 'agronomics.denomination_of_origin')]"/>
<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_denomination_of_origin_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.denomination_of_origin')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_max_production_allowed">
<field name="model" search="[('model', '=', 'agronomics.max.production.allowed')]"/>
<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_max_production_allowed_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.max.production.allowed')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_irrigation">
<field name="model" search="[('model', '=', 'agronomics.irrigation')]"/>
<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_irrigation_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.irrigation')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_plantation">
<field name="model" search="[('model', '=', 'agronomics.plantation')]"/>
<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_plantation_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.plantation')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_ecological">
<field name="model" search="[('model', '=', 'agronomics.ecological')]"/>
<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_ecological_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.ecological')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_parcel">
<field name="model" search="[('model', '=', 'agronomics.parcel')]"/>
<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_parcel_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.parcel')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_beneficiary">
<field name="model" search="[('model', '=', 'agronomics.beneficiary')]"/>
<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_beneficiary_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.beneficiary')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>

142
product.py Normal file
View File

@ -0,0 +1,142 @@
# 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.model import ModelSQL, ModelView, fields
from trytond.pool import PoolMeta, Pool
from trytond.pyson import Eval
from trytond.exceptions import UserError
from trytond.i18n import gettext
class Certification(ModelSQL, ModelView):
"Certification"
__name__ = 'agronomics.certification'
_rec_name = 'number'
number = fields.Char('Number')
date = fields.Date('Date')
def get_rec_name(self, name):
return self.number
class Container(ModelSQL, ModelView):
"Container"
__name__ = 'agronomics.container'
name = fields.Char('Name')
capacity = fields.Numeric('Capacity', digits=(16, 2))
class Template(metaclass=PoolMeta):
__name__ = 'product.template'
agronomic_type = fields.Selection([
(None, ''),
('grape', "Grape"),
('do-wort', "DO Wort"),
('not-do-wort', "Not DO Wort"),
('wine', "Wine"),
('bottled-wine', "Bottled Wine"),
], "Agronomic Type", select=True)
container = fields.Many2One('agronomics.container', 'Container',
states={
'invisible': Eval('agronomic_type') != 'bottled-wine',
}, depends=['agronomic_type'])
capacity = fields.Function(fields.Numeric('Capacity', digits=(16, 2),
states={
'invisible': Eval('agronomic_type') != 'bottled-wine',
}, depends=['agronomic_type']), 'get_capacity',
searcher='search_capacity')
def get_capacity(self, name):
if self.container:
return self.container.capacity
@classmethod
def search_capacity(cls, name, clause):
return [('container.capacity',) + tuple(clause[1:])]
class Product(metaclass=PoolMeta):
__name__ = 'product.product'
vintages = fields.Many2Many('product.product-agronomics.crop', 'product',
'crop', 'Vintages')
varieties = fields.Many2Many('product.product-product.taxon', 'product',
'variety', 'Varieties')
denominations_of_origin = fields.Many2Many(
'product.product-agronomics.denomination_of_origin', 'product',
'do', 'DOs',
states={
'invisible': Eval('agronomic_type').in_(
['not-do-wort']
)
}, depends=['agronomic_type'])
ecologicals = fields.Many2Many('product.product-agronomics.ecological',
'product', 'ecological', 'Ecologicals')
quality_sample = fields.Many2One('quality.sample', 'Quality Sample',
states={
'invisible': ~ Eval('agronomic_type').in_(
['wine', 'bottled-wine']
)
}, depends=['agronomic_type'])
certification = fields.Many2One('agronomics.certification',
'Certification', states={
'invisible': ~ Eval('agronomic_type').in_(
['wine', 'bottled-wine']
)
}, depends=['agronomic_type'])
alcohol_volume = fields.Numeric('Alcohol Volume', digits=(16, 2), states={
'invisible': ~ Eval('agronomic_type').in_(
['wine', 'bottled-wine']
)}, depends=['agronomic_type'])
@classmethod
def validate(cls, products):
for product in products:
if (product.agronomic_type in
['grape', 'do-wort', 'not-do-wort', 'bottled-wine']):
if len(product.vintages) > 1:
raise UserError(gettext('agronomics.msg_vintage_limit',
product=product.rec_name))
if (product.agronomic_type in
['grape']):
if len(product.varieties) > 1:
raise UserError(gettext('agronomics.msg_variety_limit',
product=product.rec_name))
class ProductCrop(ModelSQL):
"Product - Crop"
__name__ = 'product.product-agronomics.crop'
product = fields.Many2One('product.product', 'Product',
ondelete='CASCADE', select=True, required=True)
crop = fields.Many2One('agronomics.crop', 'Crop',
ondelete='CASCADE', select=True, required=True)
class ProductVariety(ModelSQL):
"Product - Variety"
__name__ = 'product.product-product.taxon'
product = fields.Many2One('product.product', 'Product',
ondelete='CASCADE', select=True, required=True)
variety = fields.Many2One('product.taxon', 'Variety',
ondelete='CASCADE', select=True, required=True)
class ProductDO(ModelSQL):
"Product - DO"
__name__ = 'product.product-agronomics.denomination_of_origin'
product = fields.Many2One('product.product', 'Product',
ondelete='CASCADE', select=True, required=True)
do = fields.Many2One('agronomics.denomination_of_origin', 'DO',
ondelete='CASCADE', select=True, required=True)
class ProductEcological(ModelSQL):
"Product - Ecological"
__name__ = 'product.product-agronomics.ecological'
product = fields.Many2One('product.product', 'Product',
ondelete='CASCADE', select=True, required=True)
ecological = fields.Many2One('agronomics.ecological', 'Ecological',
ondelete='CASCADE', select=True, required=True)

159
product.xml Normal file
View File

@ -0,0 +1,159 @@
<tryton>
<data>
<!-- Product Template-->
<record model="ir.ui.view" id="template_view_form">
<field name="model">product.template</field>
<field name="name">template_form</field>
<field name="inherit" ref="product.template_view_form"/>
</record>
<record model="ir.ui.view" id="template_view_tree">
<field name="model">product.template</field>
<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>
<field name="name">product_form</field>
<field name="inherit" ref="product.product_view_form"/>
</record>
<record model="ir.ui.view" id="product_view_tree">
<field name="model">product.product</field>
<field name="name">product_list</field>
<field name="inherit" ref="product.product_view_tree"/>
</record>
<!-- Certification -->
<record model="ir.ui.view" id="certification_view_form">
<field name="model">agronomics.certification</field>
<field name="type">form</field>
<field name="name">certification_form</field>
</record>
<record model="ir.ui.view" id="certification_view_tree">
<field name="model">agronomics.certification</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">certification_list</field>
</record>
<record model="ir.action.act_window" id="act_certification_tree">
<field name="name">Certification</field>
<field name="res_model">agronomics.certification</field>
</record>
<record model="ir.action.act_window.view" id="act_certification_tree_view">
<field name="sequence" eval="10"/>
<field name="view" ref="certification_view_tree"/>
<field name="act_window" ref="act_certification_tree"/>
</record>
<record model="ir.action.act_window.view" id="act_certification_form_view">
<field name="sequence" eval="20"/>
<field name="view" ref="certification_view_form"/>
<field name="act_window" ref="act_certification_tree"/>
</record>
<menuitem parent="menu_agronomics" sequence="1"
action="act_certification_tree" id="menu_certification_list"/>
<record model="ir.ui.menu-res.group"
id="menu_certification_list_group_agronomics">
<field name="menu" ref="menu_certification_list"/>
<field name="group" ref="group_agronomics"/>
</record>
<record model="ir.ui.menu-res.group"
id="menu_certification_list_group_agronomics_admin">
<field name="menu" ref="menu_certification_list"/>
<field name="group" ref="group_agronomics_admin"/>
</record>
<!-- Container -->
<record model="ir.ui.view" id="container_view_form">
<field name="model">agronomics.container</field>
<field name="type">form</field>
<field name="name">container_form</field>
</record>
<record model="ir.ui.view" id="container_view_tree">
<field name="model">agronomics.container</field>
<field name="type">tree</field>
<field name="priority" eval="20"/>
<field name="name">container_list</field>
</record>
<record model="ir.action.act_window" id="act_container_tree">
<field name="name">Container</field>
<field name="res_model">agronomics.container</field>
</record>
<record model="ir.action.act_window.view" id="act_container_tree_view">
<field name="sequence" eval="10"/>
<field name="view" ref="container_view_tree"/>
<field name="act_window" ref="act_container_tree"/>
</record>
<record model="ir.action.act_window.view" id="act_container_form_view">
<field name="sequence" eval="20"/>
<field name="view" ref="container_view_form"/>
<field name="act_window" ref="act_container_tree"/>
</record>
<menuitem parent="menu_agronomics" sequence="1"
action="act_container_tree" id="menu_container_list"/>
<record model="ir.ui.menu-res.group"
id="menu_container_list_group_agronomics">
<field name="menu" ref="menu_container_list"/>
<field name="group" ref="group_agronomics"/>
</record>
<record model="ir.ui.menu-res.group"
id="menu_container_list_group_agronomics_admin">
<field name="menu" ref="menu_container_list"/>
<field name="group" ref="group_agronomics_admin"/>
</record>
<record model="ir.model.access" id="access_certification">
<field name="model" search="[('model', '=', 'agronomics.certification')]"/>
<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_certification_agronomics_admin">
<field name="model" search="[('model', '=', 'agronomics.certification')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<record model="ir.model.access" id="access_certification_product_admin">
<field name="model" search="[('model', '=', 'agronomics.certification')]"/>
<field name="group" ref="product.group_product_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<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">
<field name="model" search="[('model', '=', 'agronomics.container')]"/>
<field name="group" ref="agronomics.group_agronomics_admin"/>
<field name="perm_read" eval="True"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
<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"/>
<field name="perm_write" eval="True"/>
<field name="perm_create" eval="True"/>
<field name="perm_delete" eval="True"/>
</record>
</data>
</tryton>

View File

@ -4,7 +4,9 @@ depends:
party
product_classification
product_classification_taxonomic
quality_control_sample
xml:
plot.xml
party.xml
message.xml
product.xml

View File

@ -0,0 +1,6 @@
<form>
<label name="number"/>
<field name="number"/>
<label name="date"/>
<field name="date"/>
</form>

View File

@ -0,0 +1,4 @@
<tree>
<field name="number"/>
<field name="date"/>
</tree>

6
view/container_form.xml Normal file
View File

@ -0,0 +1,6 @@
<form>
<label name="name"/>
<field name="name"/>
<label name="capacity"/>
<field name="capacity"/>
</form>

4
view/container_list.xml Normal file
View File

@ -0,0 +1,4 @@
<tree>
<field name="name"/>
<field name="capacity"/>
</tree>

20
view/product_form.xml Normal file
View File

@ -0,0 +1,20 @@
<data>
<xpath expr="/form/notebook" position="inside">
<page string="Agronomics" id="agrnomics">
<field name="vintages" colspan="2"/>
<field name="varieties" colspan="2"/>
<field name="denominations_of_origin" colspan="2"/>
<field name="ecologicals" colspan="2"/>
<label name="quality_sample"/>
<field name="quality_sample"/>
<label name="certification"/>
<field name="certification"/>
<label name="alcohol_volume"/>
<field name="alcohol_volume"/>
<label name="container"/>
<field name="container"/>
<label name="capacity"/>
<field name="capacity"/>
</page>
</xpath>
</data>

13
view/product_list.xml Normal file
View File

@ -0,0 +1,13 @@
<data>
<xpath expr="/tree" position="inside">
<field name="vintages" tree_invisible="1"/>
<field name="varieties" tree_invisible="1"/>
<field name="denominations_of_origin" tree_invisible="1"/>
<field name="ecologicals" tree_invisible="1"/>
<field name="quality_sample" tree_invisible="1"/>
<field name="certification" tree_invisible="1"/>
<field name="alcohol_volume" tree_invisible="1"/>
<field name="container" tree_invisible="1"/>
<field name="capacity" tree_invisible="1"/>
</xpath>
</data>

10
view/template_form.xml Normal file
View File

@ -0,0 +1,10 @@
<data>
<xpath expr="/form/notebook/page[@id='general']/field[@name='cost_price_method']" position="after">
<label name="agronomic_type"/>
<field name="agronomic_type"/>
<label name="container"/>
<field name="container"/>
<label name="capacity"/>
<field name="capacity"/>
</xpath>
</data>

7
view/template_list.xml Normal file
View File

@ -0,0 +1,7 @@
<data>
<xpath expr="/tree" position="inside">
<field name="agronomic_type" tree_invisible="1"/>
<field name="container" tree_invisible="1"/>
<field name="capacity" tree_invisible="1"/>
</xpath>
</data>