lims_industry: sample entries: calculate received volume

This commit is contained in:
Adrián Bernardi 2020-06-10 12:25:11 -03:00
parent b11df1d823
commit b1c652dd3a
2 changed files with 15 additions and 6 deletions

View file

@ -246,6 +246,13 @@ class CreateSampleStart(metaclass=PoolMeta):
def on_change_label(self):
self.labels = self.label
@fields.depends('packages_quantity', 'package_type')
def on_change_with_ind_volume(self, name=None):
if (self.packages_quantity and
self.package_type and self.package_type.capacity):
return (self.packages_quantity * self.package_type.capacity)
return None
class CreateSample(metaclass=PoolMeta):
__name__ = 'lims.create_sample'

View file

@ -28,19 +28,21 @@
<label name="label"/>
<field name="label"/>
<field name="labels" colspan="4" invisible="1"/>
<group col="4" colspan="2" id="sampling1">
<group col="6" colspan="4" id="sampling">
<label name="ind_sampling_date"/>
<field name="ind_sampling_date"/>
<label name="ind_volume"/>
<field name="ind_volume"/>
</group>
<group col="4" colspan="2" id="sampling2">
<field name="ind_sampling_date" xexpand="0"/>
<label name="sampling_type"/>
<field name="sampling_type"/>
<label name="missing_data"/>
<field name="missing_data" xexpand="0"/>
</group>
</xpath>
<xpath
expr="/form/notebook/page[@id='general']/group[@id='zone']"
position="replace">
<label name="ind_volume"/>
<field name="ind_volume"/>
</xpath>
<xpath
expr="/form/notebook/page[@id='general']/group[@id='labels']"
position="replace">