diff --git a/__init__.py b/__init__.py index ee9cb6d..1860311 100644 --- a/__init__.py +++ b/__init__.py @@ -38,6 +38,7 @@ def register(): weighing.Weighing, weighing.WeighingPlantation, weighing.WeighingDo, + weighing.WeighingParcel, quality.Configuration, quality.ConfigurationCompany, quality.ProductQualitySample, diff --git a/message.xml b/message.xml index 4f54a39..9256c1b 100644 --- a/message.xml +++ b/message.xml @@ -36,6 +36,9 @@ this repository contains the full copyright notices and license terms. --> The move cannot be done because the amount of the move exceeds the set maximum amount. + + The weighin weight is not distributed and its not being forced to analysis + diff --git a/plot.py b/plot.py index 956c9d1..678f0ad 100644 --- a/plot.py +++ b/plot.py @@ -110,6 +110,16 @@ class Parcel(ModelSQL, ModelView): beneficiaries = fields.One2Many('agronomics.beneficiary', 'parcel', 'Beneficiaries') all_do = fields.Function(fields.Char('All DO'), 'get_all_do') + weighings = fields.One2Many('agronomics.weighing-agronomics.parcel', + 'parcel', 'Weighings') + bought_quantity = fields.Function( + fields.Float("Bought Quantity", digits=(16, 2)), 'get_bought_quantity') + remaining_quantity = fields.Function( + fields.Float("Remainig Quantity", digits=(16, 2)), 'get_remaining_quantity') + + def get_rec_name(self, name): + if self.plantation and self.crop: + return self.plantation.code + ' - ' + self.crop.rec_name @classmethod def validate(cls, records): @@ -138,6 +148,12 @@ class Parcel(ModelSQL, ModelView): return round(float(min([x.max_production for x in max_production]) )*self.surface, 2) + def get_bought_quantity(self, name): + return sum([w.netweight for w in self.weighings if not w.table]) + + def get_remaining_quantity(self, name): + return (self.max_production or 0) - (self.bought_quantity or 0) + class ParcelDo(ModelSQL): "Parcel - Denomination Origin" diff --git a/view/parcel_form.xml b/view/parcel_form.xml index 5883ba5..ac1ecac 100644 --- a/view/parcel_form.xml +++ b/view/parcel_form.xml @@ -25,9 +25,14 @@