Merge branch '6.0' into 046447
This commit is contained in:
commit
3d07d83738
|
@ -1544,6 +1544,14 @@ msgstr ""
|
||||||
"El pes en \"%(weighing)s\" no està totalment distibuit i no s'ha forçat "
|
"El pes en \"%(weighing)s\" no està totalment distibuit i no s'ha forçat "
|
||||||
"l'anàlisi"
|
"l'anàlisi"
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_parcel_without_current_crop"
|
||||||
|
msgid ""
|
||||||
|
"The plantation \"%(plantation)s\" in the weighing \"%(weighing)s\" has no "
|
||||||
|
"parcel of the weighing's crop."
|
||||||
|
msgstr ""
|
||||||
|
"La plantació \"%(plantation)s\" en la pesada \"%(weighing)s\" no te una "
|
||||||
|
"parcel·la amb la collita de la pesada"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_uom_not_fit"
|
msgctxt "model:ir.message,text:msg_uom_not_fit"
|
||||||
msgid ""
|
msgid ""
|
||||||
"Inputs from Production template \"%(production)s\" must be of uom "
|
"Inputs from Production template \"%(production)s\" must be of uom "
|
||||||
|
|
|
@ -1545,6 +1545,14 @@ msgstr ""
|
||||||
"El peso en \"%(weighin)s\" no está totalmente distribuido i no se ha forzado"
|
"El peso en \"%(weighin)s\" no está totalmente distribuido i no se ha forzado"
|
||||||
" el anàlisis"
|
" el anàlisis"
|
||||||
|
|
||||||
|
msgctxt "model:ir.message,text:msg_parcel_without_current_crop"
|
||||||
|
msgid ""
|
||||||
|
"The plantation \"%(plantation)s\" in the weighing \"%(weighing)s\" has no "
|
||||||
|
"parcel of the weighing's crop."
|
||||||
|
msgstr ""
|
||||||
|
"La plantación \"%(plantation)s\" en la pesada \"%(weighing)s\" no tiene una "
|
||||||
|
"parcela con la cosecha de la pesada"
|
||||||
|
|
||||||
msgctxt "model:ir.message,text:msg_uom_not_fit"
|
msgctxt "model:ir.message,text:msg_uom_not_fit"
|
||||||
msgid ""
|
msgid ""
|
||||||
"Inputs from Production template \"%(production)s\" must be of uom "
|
"Inputs from Production template \"%(production)s\" must be of uom "
|
||||||
|
|
|
@ -48,5 +48,8 @@ this repository contains the full copyright notices and license terms. -->
|
||||||
<record model="ir.message" id="msg_location_no_configured">
|
<record model="ir.message" id="msg_location_no_configured">
|
||||||
<field name="text">The weighing center "%(center)s" dont have a to location configured.</field>
|
<field name="text">The weighing center "%(center)s" dont have a to location configured.</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record model="ir.message" id="msg_parcel_without_current_crop">
|
||||||
|
<field name="text">The plantation "%(plantation)s" in the weighing "%(weighing)s" has no parcel of the weighing's crop.</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</tryton>
|
</tryton>
|
||||||
|
|
|
@ -17,7 +17,10 @@ class ProductionTemplate(ModelSQL, ModelView):
|
||||||
__name__ = 'production.template'
|
__name__ = 'production.template'
|
||||||
|
|
||||||
name = fields.Char('Name', required=True)
|
name = fields.Char('Name', required=True)
|
||||||
uom = fields.Many2One('product.uom', 'Uom', required=True)
|
uom = fields.Many2One('product.uom', 'Uom',
|
||||||
|
states = {
|
||||||
|
'required': True
|
||||||
|
})
|
||||||
unit_digits = fields.Function(fields.Integer('Unit Digits'),
|
unit_digits = fields.Function(fields.Integer('Unit Digits'),
|
||||||
'on_change_with_unit_digits')
|
'on_change_with_unit_digits')
|
||||||
quantity = fields.Float('Quantity',
|
quantity = fields.Float('Quantity',
|
||||||
|
@ -43,6 +46,21 @@ class ProductionTemplate(ModelSQL, ModelView):
|
||||||
'production.cost_price.distribution.template',
|
'production.cost_price.distribution.template',
|
||||||
'production_template', "Cost Distribution Templates")
|
'production_template', "Cost Distribution Templates")
|
||||||
transfer_wine_aging = fields.Boolean("Transfer Wine Aging")
|
transfer_wine_aging = fields.Boolean("Transfer Wine Aging")
|
||||||
|
inputs_products = fields.Function(fields.One2Many('product.product', None,
|
||||||
|
'Products'), 'get_products', searcher='search_input_products')
|
||||||
|
|
||||||
|
def get_products(self, name=None):
|
||||||
|
products = []
|
||||||
|
for template in self.inputs:
|
||||||
|
products += template.products
|
||||||
|
return [x.id for x in products]
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def search_input_products(cls, name, clause):
|
||||||
|
Inputs = Pool().get('production.template.inputs-product.template')
|
||||||
|
product = clause[-1]
|
||||||
|
inputs = Inputs.search([('template.products', '=', product)])
|
||||||
|
return [('id', 'in', [x.production_template.id for x in inputs])]
|
||||||
|
|
||||||
@fields.depends('uom')
|
@fields.depends('uom')
|
||||||
def on_change_with_unit_digits(self, name=None):
|
def on_change_with_unit_digits(self, name=None):
|
||||||
|
@ -58,6 +76,8 @@ class ProductionTemplate(ModelSQL, ModelView):
|
||||||
record.check_cost_distribution()
|
record.check_cost_distribution()
|
||||||
|
|
||||||
def check_input_uoms(self):
|
def check_input_uoms(self):
|
||||||
|
if not self.uom:
|
||||||
|
return
|
||||||
category_uom = self.uom.category
|
category_uom = self.uom.category
|
||||||
uoms = [i.default_uom.category for i in self.inputs]
|
uoms = [i.default_uom.category for i in self.inputs]
|
||||||
uoms.append(category_uom)
|
uoms.append(category_uom)
|
||||||
|
|
|
@ -162,7 +162,8 @@ class QualityTest(metaclass=PoolMeta):
|
||||||
if not key:
|
if not key:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
values[key] = round(line.value, _WINE_DIGITS)
|
if line.value:
|
||||||
|
values[key] = round(line.value, _WINE_DIGITS)
|
||||||
values[key + '_comment'] = line.internal_description
|
values[key + '_comment'] = line.internal_description
|
||||||
values[key + '_confirm'] = today
|
values[key + '_confirm'] = today
|
||||||
values[key + '_success'] = line.success
|
values[key + '_success'] = line.success
|
||||||
|
|
19
weighing.py
19
weighing.py
|
@ -206,12 +206,18 @@ class Weighing(Workflow, ModelSQL, ModelView):
|
||||||
return crop[0].id
|
return crop[0].id
|
||||||
|
|
||||||
def get_parcel(self):
|
def get_parcel(self):
|
||||||
|
crop = self.on_change_with_crop()
|
||||||
if not self.plantations:
|
if not self.plantations:
|
||||||
return
|
return
|
||||||
plantation = self.plantations[0].plantation
|
plantation = self.plantations[0].plantation
|
||||||
if not plantation or not plantation.parcels:
|
if not plantation or not plantation.parcels:
|
||||||
return
|
return
|
||||||
return plantation.parcels[0]
|
res = None
|
||||||
|
for parcel in plantation.parcels:
|
||||||
|
if parcel.crop.id == crop:
|
||||||
|
res = parcel
|
||||||
|
break
|
||||||
|
return res
|
||||||
|
|
||||||
@fields.depends('plantations')
|
@fields.depends('plantations')
|
||||||
def on_change_with_variety(self):
|
def on_change_with_variety(self):
|
||||||
|
@ -529,6 +535,17 @@ class Weighing(Workflow, ModelSQL, ModelView):
|
||||||
Beneficiary.delete([x for x in weighing.beneficiaries])
|
Beneficiary.delete([x for x in weighing.beneficiaries])
|
||||||
|
|
||||||
parcel = weighing.get_parcel()
|
parcel = weighing.get_parcel()
|
||||||
|
|
||||||
|
# Check if all plantations has a parcel in the weighing's crop
|
||||||
|
for plantation in weighing.plantations:
|
||||||
|
plantation = plantation.plantation
|
||||||
|
for parcel in plantation.parcels:
|
||||||
|
if parcel.crop == weighing.crop:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
raise UserError(gettext('agronomics.msg_parcel_without_current_crop',
|
||||||
|
weighing=weighing.rec_name, plantation=plantation.code))
|
||||||
|
|
||||||
if not parcel:
|
if not parcel:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue