parent
c441107a24
commit
8fa3c7ccd0
|
@ -980,7 +980,7 @@ class FemaleCycle(ModelSQL, ModelView):
|
|||
def default_state():
|
||||
return 'unmated'
|
||||
|
||||
@fields.depends('animal', 'ordination_date')
|
||||
@fields.depends('_parent_animal.id', 'animal', 'ordination_date')
|
||||
def on_change_ordination_date(self):
|
||||
if not self.ordination_date or not self.animal:
|
||||
return
|
||||
|
|
|
@ -163,7 +163,7 @@ class AbstractEvent(ModelSQL, ModelView, Workflow):
|
|||
raise NotImplementedError(
|
||||
"Please Implement valid_animal_types() method")
|
||||
|
||||
@fields.depends('animal_type', 'animal')
|
||||
@fields.depends('animal_type', 'animal', '_parent_animal.farm')
|
||||
def on_change_animal(self):
|
||||
if (self.animal_type == 'group' or not self.animal or
|
||||
not self.animal.farm):
|
||||
|
|
|
@ -80,7 +80,7 @@ class FeedEvent(FeedEventMixin, ModelSQL, ModelView, Workflow):
|
|||
if not self.feed_location or not self.feed_location.current_lot:
|
||||
self.feed_product = None
|
||||
self.feed_lot = None
|
||||
self.feed_uom = None
|
||||
self.uom = None
|
||||
return
|
||||
self.feed_product = self.feed_location.current_lot.product
|
||||
self.feed_lot = self.feed_location.current_lot
|
||||
|
|
|
@ -570,18 +570,18 @@ class SemenExtractionDose(ModelSQL, ModelView):
|
|||
return "#%d (%s)" % (self.sequence,
|
||||
self.lot and self.lot.rec_name or self.bom.rec_name)
|
||||
|
||||
@fields.depends('event')
|
||||
@fields.depends('event', '_parent_event.specie')
|
||||
def on_change_with_specie(self, name=None):
|
||||
return self.event and self.event.specie.id or None
|
||||
|
||||
def get_semen_unit_digits(self, name):
|
||||
return self.event and self.event.formula_unit_digits
|
||||
|
||||
@fields.depends('event')
|
||||
@fields.depends('event', '_parent_event.state')
|
||||
def on_change_with_state(self, name=None):
|
||||
return self.event and self.event.state or 'draft'
|
||||
|
||||
@fields.depends('event', 'bom', 'quantity')
|
||||
@fields.depends('_parent_event.specie' ,'event', 'bom', 'quantity')
|
||||
def on_change_with_semen_qty(self, name=None):
|
||||
Uom = Pool().get('product.uom')
|
||||
if not self.event or not self.bom or not self.quantity:
|
||||
|
|
Loading…
Reference in New Issue