UserError table and denomination origin, when do analysis workflow weighing

#159821
This commit is contained in:
Raimon Esteve 2023-07-04 15:36:10 +02:00
parent 9f9bc14e2a
commit 4faf6b6232
1 changed files with 5 additions and 4 deletions

View File

@ -309,6 +309,11 @@ class Weighing(Workflow, ModelSQL, ModelView):
if weighing.not_assigned_weight and not weighing.forced_analysis:
raise UserError(gettext('agronomics.msg_not_assigned_weight',
weighing=weighing.rec_name))
if weighing.table and weighing.denomination_origin:
raise UserError(gettext('agronomics.msg_weighing_with_table_do',
weighing=weighing.rec_name))
product.template = weighing.product
product.denominations_of_origin = weighing.denomination_origin
if weighing.ecological:
@ -537,10 +542,6 @@ class Weighing(Workflow, ModelSQL, ModelView):
if weighing.beneficiaries:
Beneficiary.delete([x for x in weighing.beneficiaries])
if weighing.table and weighing.denomination_origin:
raise UserError(gettext('agronomics.msg_weighing_with_table_do',
weighing=weighing.rec_name))
parcel = weighing.get_parcel()
# Check if all plantations has a parcel in the weighing's crop
for plantation in weighing.plantations: