From 4faf6b62324d9559700015b8ef41fb58e90a1bec Mon Sep 17 00:00:00 2001 From: Raimon Esteve Date: Tue, 4 Jul 2023 15:36:10 +0200 Subject: [PATCH] UserError table and denomination origin, when do analysis workflow weighing #159821 --- weighing.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/weighing.py b/weighing.py index 0d94585..4d4b806 100644 --- a/weighing.py +++ b/weighing.py @@ -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: