This commit is contained in:
Àngel Àlvarez 2021-09-09 12:20:10 +02:00
parent 7488640f32
commit f622e1ce33
5 changed files with 87 additions and 74 deletions

View File

@ -143,7 +143,7 @@ msgid "Irrigation"
msgstr "Irrigació"
msgctxt "field:agronomics.parcel,max_production:"
msgid "Max. Production"
msgid "Max Production"
msgstr "Producció Màxima"
msgctxt "field:agronomics.parcel,plant_number:"
@ -818,17 +818,14 @@ msgctxt "field:product.template,quality_weighing:"
msgid "Quality Weighing"
msgstr "Qualitat pesada"
#, fuzzy
msgctxt "field:product.variety,percent:"
msgid "Percent"
msgstr "Percentatge"
#, fuzzy
msgctxt "field:product.variety,product:"
msgid "Product"
msgstr "Productes"
#, fuzzy
msgctxt "field:product.variety,variety:"
msgid "Variety"
msgstr "Varietat"
@ -853,27 +850,22 @@ msgctxt "field:production,production_template:"
msgid "Production Template"
msgstr "Plantilla de producció"
#, fuzzy
msgctxt "field:production.enology.product,product:"
msgid "Product"
msgstr "Productes"
#, fuzzy
msgctxt "field:production.enology.product,production:"
msgid "Production"
msgstr "Producció"
#, fuzzy
msgctxt "field:production.enology.product,quantity:"
msgid "Quantity"
msgstr "Quantitat"
#, fuzzy
msgctxt "field:production.enology.product,unit_digits:"
msgid "Unit Digits"
msgstr "Dígits de la unitat"
#, fuzzy
msgctxt "field:production.enology.product,uom:"
msgid "Uom"
msgstr "UdM"
@ -886,7 +878,6 @@ msgctxt "field:production.output.distribution,initial_quantity:"
msgid "Initial Quantity"
msgstr "Quantitat inicial"
#, fuzzy
msgctxt "field:production.output.distribution,location:"
msgid "Location"
msgstr "Ubicació"
@ -895,22 +886,18 @@ msgctxt "field:production.output.distribution,produced_quantity:"
msgid "Produced Quantity"
msgstr "Quantitat produia"
#, fuzzy
msgctxt "field:production.output.distribution,product:"
msgid "Template"
msgstr "Plantilla"
#, fuzzy
msgctxt "field:production.output.distribution,production:"
msgid "Production"
msgstr "Producció"
#, fuzzy
msgctxt "field:production.output.distribution,unit_digits:"
msgid "Unit Digits"
msgstr "Dígits de la unitat"
#, fuzzy
msgctxt "field:production.output.distribution,uom:"
msgid "Uom"
msgstr "UdM"
@ -919,17 +906,14 @@ msgctxt "field:production.template,enology_products:"
msgid "Production Template"
msgstr "Plantilla de producció"
#, fuzzy
msgctxt "field:production.template,inputs:"
msgid "Inputs"
msgstr "Entrades"
#, fuzzy
msgctxt "field:production.template,name:"
msgid "Name"
msgstr "Nom"
#, fuzzy
msgctxt "field:production.template,outputs:"
msgid "Outputs"
msgstr "Sortides"
@ -938,17 +922,14 @@ msgctxt "field:production.template,pass_feature:"
msgid "Pass on Feature"
msgstr "Passar propietats"
#, fuzzy
msgctxt "field:production.template,quantity:"
msgid "Quantity"
msgstr "Quantitat"
#, fuzzy
msgctxt "field:production.template,unit_digits:"
msgid "Unit Digits"
msgstr "Dígits de la unitat"
#, fuzzy
msgctxt "field:production.template,uom:"
msgid "Uom"
msgstr "UdM"
@ -958,7 +939,6 @@ msgctxt ""
msgid "Production Template"
msgstr "Plantilla de producció"
#, fuzzy
msgctxt "field:production.template.inputs-product.template,template:"
msgid "Template"
msgstr "Plantilla"
@ -971,17 +951,14 @@ msgctxt "field:production.template.line,production_template:"
msgid "Production Template"
msgstr "Plantilla de producció"
#, fuzzy
msgctxt "field:production.template.line,quantity:"
msgid "Quantity"
msgstr "Quantitat"
#, fuzzy
msgctxt "field:production.template.line,unit_digits:"
msgid "Unit Digits"
msgstr "Dígits de la unitat"
#, fuzzy
msgctxt "field:production.template.line,uom:"
msgid "Uom"
msgstr "UdM"
@ -991,17 +968,14 @@ msgctxt ""
msgid "Production Template"
msgstr "Plantilla de producció"
#, fuzzy
msgctxt "field:production.template.outputs-product.template,template:"
msgid "Product"
msgstr "Productes"
#, fuzzy
msgctxt "field:quality.qualitative.test.line,product:"
msgid "Product"
msgstr "Productes"
#, fuzzy
msgctxt "field:quality.quantitative.test.line,product:"
msgid "Product"
msgstr "Productes"
@ -1022,7 +996,6 @@ msgctxt "model:agronomics.crop,name:"
msgid "Crop"
msgstr "Collita"
#, fuzzy
msgctxt "model:agronomics.denomination_of_origin,name:"
msgid "Denomination of Origin"
msgstr "Denominació Origen"
@ -1115,21 +1088,34 @@ msgctxt "model:ir.action,name:act_plantation_tree"
msgid "Plantation"
msgstr "Plantació"
#, fuzzy
msgctxt "model:ir.action,name:act_product_qualitative_test_lines"
msgid "Qualitative Lines"
msgstr "Línies qualitatives"
#, fuzzy
msgctxt "model:ir.action,name:act_product_quality_test"
msgid "Quality Test"
msgstr "Test de qualitat"
#, fuzzy
msgctxt "model:ir.action,name:act_product_quantitative_test_lines"
msgid "Quantitative Lines"
msgstr "Línia quantitativa"
msgctxt "model:ir.action,name:act_production_enology_product_tree"
msgid "Production Enology Product"
msgstr "Productes Vinícules"
msgctxt "model:ir.action,name:act_production_output_distribution_tree"
msgid "Production Output Distribution"
msgstr ""
msgctxt "model:ir.action,name:act_production_template_line_tree"
msgid "Production Template Line"
msgstr "Línia Plantilla de producció"
msgctxt "model:ir.action,name:act_production_template_tree"
msgid "Production Template"
msgstr "Plantilla de producció"
msgctxt "model:ir.action,name:act_weighing_action"
msgid "Weighing"
msgstr "Pesada"
@ -1163,6 +1149,14 @@ msgstr ""
"Els Beneficiares de les collites \"%(crop)s\" i la plantació "
"\"%(plantation)s\" han de sumar 100."
msgctxt "model:ir.message,text:msg_uom_not_fit"
msgid ""
"Inputs from Production template \"%(producttion)s\" must be of uom "
"\"%(uom)s\" and we have \"%(uoms)s.\" ."
msgstr ""
"Les entrades de la plantilla de producció \"%(production)s\" ha de tenir la "
"uom \"%(uom)s\" i ens trobem \"%(uoms)\"."
msgctxt "model:ir.message,text:msg_variety_limit"
msgid ""
"Product \"%(product)s\" cannot have more than one Variety because of its "
@ -1255,6 +1249,10 @@ msgctxt "model:ir.ui.menu,name:menu_plantation_list"
msgid "Plantation"
msgstr "Plantació"
msgctxt "model:ir.ui.menu,name:menu_production_template_list"
msgid "Production Template"
msgstr "Plantilla de producció"
msgctxt "model:ir.ui.menu,name:menu_weighing_center_list"
msgid "Weighing Center"
msgstr "Centre de pesada"

View File

@ -287,7 +287,7 @@ msgid "Weighing Center"
msgstr "Centro de pesada"
msgctxt "field:agronomics.weighing,weighing_date:"
msgid "Date"
msgid "Sale Date"
msgstr "Fecha"
msgctxt "field:agronomics.weighing,weight:"
@ -818,17 +818,14 @@ msgctxt "field:product.template,quality_weighing:"
msgid "Quality Weighing"
msgstr "Calidad pesada"
#, fuzzy
msgctxt "field:product.variety,percent:"
msgid "Percent"
msgstr "Porcentaje"
#, fuzzy
msgctxt "field:product.variety,product:"
msgid "Product"
msgstr "Productos"
#, fuzzy
msgctxt "field:product.variety,variety:"
msgid "Variety"
msgstr "Variedad"
@ -853,27 +850,22 @@ msgctxt "field:production,production_template:"
msgid "Production Template"
msgstr "Plantilla producción"
#, fuzzy
msgctxt "field:production.enology.product,product:"
msgid "Product"
msgstr "Productos"
#, fuzzy
msgctxt "field:production.enology.product,production:"
msgid "Production"
msgstr "Producciones"
#, fuzzy
msgctxt "field:production.enology.product,quantity:"
msgid "Quantity"
msgstr "Cantidad"
#, fuzzy
msgctxt "field:production.enology.product,unit_digits:"
msgid "Unit Digits"
msgstr "Dígitos unidad"
#, fuzzy
msgctxt "field:production.enology.product,uom:"
msgid "Uom"
msgstr "UdM"
@ -886,7 +878,6 @@ msgctxt "field:production.output.distribution,initial_quantity:"
msgid "Initial Quantity"
msgstr "Cantidad Inicial"
#, fuzzy
msgctxt "field:production.output.distribution,location:"
msgid "Location"
msgstr "Ubicación"
@ -895,41 +886,34 @@ msgctxt "field:production.output.distribution,produced_quantity:"
msgid "Produced Quantity"
msgstr "Cantidad producida"
#, fuzzy
msgctxt "field:production.output.distribution,product:"
msgid "Template"
msgstr "Plantilla"
#, fuzzy
msgctxt "field:production.output.distribution,production:"
msgid "Production"
msgstr "Producciones"
#, fuzzy
msgctxt "field:production.output.distribution,unit_digits:"
msgid "Unit Digits"
msgstr "Dígitos unidad"
#, fuzzy
msgctxt "field:production.output.distribution,uom:"
msgid "Uom"
msgstr "UdM"
msgctxt "field:production.template,enology_products:"
msgid "Production Template"
msgstr "Plantilla producción"
msgid "Complementary Products"
msgstr "Productos complementarios"
#, fuzzy
msgctxt "field:production.template,inputs:"
msgid "Inputs"
msgstr "Entradas"
#, fuzzy
msgctxt "field:production.template,name:"
msgid "Name"
msgstr "Nombre"
#, fuzzy
msgctxt "field:production.template,outputs:"
msgid "Outputs"
msgstr "Salidas"
@ -938,17 +922,14 @@ msgctxt "field:production.template,pass_feature:"
msgid "Pass on Feature"
msgstr "Pasar propiedades"
#, fuzzy
msgctxt "field:production.template,quantity:"
msgid "Quantity"
msgstr "Cantidad"
#, fuzzy
msgctxt "field:production.template,unit_digits:"
msgid "Unit Digits"
msgstr "Dígitos unidad"
#, fuzzy
msgctxt "field:production.template,uom:"
msgid "Uom"
msgstr "UdM"
@ -958,7 +939,6 @@ msgctxt ""
msgid "Production Template"
msgstr "Plantilla producción"
#, fuzzy
msgctxt "field:production.template.inputs-product.template,template:"
msgid "Template"
msgstr "Plantilla"
@ -971,17 +951,14 @@ msgctxt "field:production.template.line,production_template:"
msgid "Production Template"
msgstr "Plantilla producción"
#, fuzzy
msgctxt "field:production.template.line,quantity:"
msgid "Quantity"
msgstr "Cantidad"
#, fuzzy
msgctxt "field:production.template.line,unit_digits:"
msgid "Unit Digits"
msgstr "Dígitos unidad"
#, fuzzy
msgctxt "field:production.template.line,uom:"
msgid "Uom"
msgstr "UdM"
@ -991,17 +968,14 @@ msgctxt ""
msgid "Production Template"
msgstr "Plantilla producción"
#, fuzzy
msgctxt "field:production.template.outputs-product.template,template:"
msgid "Product"
msgstr "Productos"
#, fuzzy
msgctxt "field:quality.qualitative.test.line,product:"
msgid "Product"
msgstr "Productos"
#, fuzzy
msgctxt "field:quality.quantitative.test.line,product:"
msgid "Product"
msgstr "Productos"
@ -1022,7 +996,6 @@ msgctxt "model:agronomics.crop,name:"
msgid "Crop"
msgstr "Cosecha"
#, fuzzy
msgctxt "model:agronomics.denomination_of_origin,name:"
msgid "Denomination of Origin"
msgstr "Denominación de origen"
@ -1115,21 +1088,34 @@ msgctxt "model:ir.action,name:act_plantation_tree"
msgid "Plantation"
msgstr "Plantación"
#, fuzzy
msgctxt "model:ir.action,name:act_product_qualitative_test_lines"
msgid "Qualitative Lines"
msgstr "Líneas cualitativas"
#, fuzzy
msgctxt "model:ir.action,name:act_product_quality_test"
msgid "Quality Test"
msgstr "Test de calidad"
#, fuzzy
msgctxt "model:ir.action,name:act_product_quantitative_test_lines"
msgid "Quantitative Lines"
msgstr "Líneas cuantitativas"
msgctxt "model:ir.action,name:act_production_enology_product_tree"
msgid "Production Enology Product"
msgstr "Productos Vinícolas"
msgctxt "model:ir.action,name:act_production_output_distribution_tree"
msgid "Production Output Distribution"
msgstr ""
msgctxt "model:ir.action,name:act_production_template_line_tree"
msgid "Production Template Line"
msgstr "Línea Plantilla producción"
msgctxt "model:ir.action,name:act_production_template_tree"
msgid "Production Template"
msgstr "Plantilla producción"
msgctxt "model:ir.action,name:act_weighing_action"
msgid "Weighing"
msgstr "Pesada"
@ -1142,7 +1128,6 @@ msgctxt "model:ir.action.act_window.domain,name:act_weighing_domain_all"
msgid "All"
msgstr "Todos"
#, fuzzy
msgctxt "model:ir.action.act_window.domain,name:act_weighing_domain_analysis"
msgid "In Analysis"
msgstr "En Análisis"
@ -1164,6 +1149,14 @@ 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_uom_not_fit"
msgid ""
"Inputs from Production template \"%(producttion)s\" must be of uom "
"\"%(uom)s\" and we have \"%(uoms)s.\" ."
msgstr ""
"Las entradas de la plantilla de producción solo puede contener productos con"
" uom \"%(uom)s\" i nos encontramos \"%(uoms)s\"."
msgctxt "model:ir.message,text:msg_variety_limit"
msgid ""
"Product \"%(product)s\" cannot have more than one Variety because of its "
@ -1256,6 +1249,10 @@ msgctxt "model:ir.ui.menu,name:menu_plantation_list"
msgid "Plantation"
msgstr "Plantación"
msgctxt "model:ir.ui.menu,name:menu_production_template_list"
msgid "Production Template"
msgstr "Plantilla producción"
msgctxt "model:ir.ui.menu,name:menu_weighing_center_list"
msgid "Weighing Center"
msgstr "Centro de pesada"
@ -1306,7 +1303,7 @@ msgstr "Línea Plantilla producción"
msgctxt "model:production.template.outputs-product.template,name:"
msgid "Production Template Inputs- Product Template"
msgstr ""
msgstr "Plantilla producción"
msgctxt "model:quality.proof,name:wine_alcohol_content"
msgid "Grau alcohol"

View File

@ -12,5 +12,8 @@ this repository contains the full copyright notices and license terms. -->
<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>
<record model="ir.message" id="msg_uom_not_fit">
<field name="text">Inputs from Production template "%(producttion)s" must be of uom "%(uom)s" and we have "%(uoms)s." .</field>
</record>
</data>
</tryton>

View File

@ -12,6 +12,19 @@
<field name="inherit" ref="product.template_view_tree"/>
</record>
<!-- Product Variety-->
<record model="ir.ui.view" id="product_variety_view_form">
<field name="model">product.variety</field>
<field name="type">form</field>
<field name="name">product_variety_form</field>
</record>
<record model="ir.ui.view" id="product_variety_view_list">
<field name="model">product.variety</field>
<field name="type">tree</field>
<field name="priority">10</field>
<field name="name">product_variety_list</field>
</record>
<!-- Product Variant-->
<record model="ir.ui.view" id="product_view_form">
<field name="model">product.product</field>

View File

@ -2,7 +2,7 @@
# 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, Bool
from trytond.pyson import Eval, Bool, If
from trytond.exceptions import UserError
from trytond.i18n import gettext
from decimal import Decimal
@ -27,7 +27,7 @@ class ProductionTemplate(ModelSQL, ModelView):
'production_template', 'template', "Outputs")
enology_products = fields.One2Many('production.template.line',
'production_template', 'Production Template')
'production_template', 'Complementary Products')
pass_feature = fields.Boolean('Pass on Feature')
@fields.depends('uom')
@ -41,7 +41,8 @@ class ProductionTemplate(ModelSQL, ModelView):
for record in records:
category_uom = record.uom.category
uoms = [i.default_uom.category for i in record.inputs]
if not all(uoms+[category_uom]):
uoms.append(category_uom)
if len(list(set(uoms))) > 1:
raise UserError(gettext('agronomics.msg_uom_not_fit',
production=record.rec_name,
uom=record.uom.rec_name,
@ -106,10 +107,11 @@ class Production(metaclass=PoolMeta):
enology_products = fields.One2Many('production.enology.product',
'production', "Enology Products",
domain=[('product', 'in', Eval('allowed_enology_products')),
('product.quantity', '>', 0)],
If((Eval('state').in_(['waiting', 'draft'])),
('product.quantity', '>', 0), ())],
states={
'invisible': ~Bool(Eval('production_template'))
}, depends=['allowed_enology_products'])
}, depends=['allowed_enology_products', 'state'])
output_distribution = fields.One2Many('production.output.distribution',
'production', 'Output Distribution',
# domain=[('product', 'in', Eval('allowed_ouput_products'))],
@ -163,14 +165,14 @@ class Production(metaclass=PoolMeta):
move.production_input = production
moves.append(move)
input_quantity += Uom.compute_qty(enology.uom, enology.quantity,
production.production_template.uom)
production.production_template.uom, round=True)
enology_products = (production.production_template and
production.production_template.enology_products or [])
for enology in enology_products:
quantity = Uom.compute_qty(enology.uom, enology.quantity,
production.production_template.uom)
production.production_template.uom, round=True)
ratio = quantity / (input_quantity or 1)
qty = Decimal(str(input_quantity*ratio))
qty = enology.uom.round(input_quantity*ratio)
move = production._move(production.picking_location,
production.location,
production.company,