Modify weighing form, Reset weight and tara in forced analysis copy

This commit is contained in:
Jared Esparza 2022-02-23 10:19:25 +01:00
parent e1381615c8
commit 58b900e5d0
2 changed files with 7 additions and 2 deletions

View File

@ -34,11 +34,13 @@
<page name="plantations">
<field name="plantations" colspan="4"/>
<field name="denomination_origin" colspan="4"/>
<field name="parcels" colspan="4"/>
</page>
<page name="beneficiaries">
<field name="beneficiaries" colspan="4"/>
</page>
<page string="Parcel Distribution" id="parcel_distribution" >
<field name="parcels" colspan="4"/>
</page>
</notebook>
<label name="state"/>
<field name="state"/>

View File

@ -367,10 +367,13 @@ class Weighing(Workflow, ModelSQL, ModelView):
def force_analysis(cls, weighings):
to_copy_values = {}
for weighing in weighings:
to_copy_values[weighing.id] = {'netweight': weighing.not_assigned_weight}
to_copy_values[weighing.id] = {
'netweight': weighing.not_assigned_weight}
cls.copy(weighings, default={
'netweight': lambda d: (
to_copy_values[d['id']]['netweight']),
'weight': None,
'tara': None,
})
for weighing in weighings:
weighing.forced_analysis = True