Add current cycle state to animal's lists
This commit is contained in:
parent
2c255bee32
commit
5d11286643
19
animal.py
19
animal.py
|
@ -31,6 +31,12 @@ ANIMAL_ORIGIN = [
|
|||
('purchased', 'Purchased'),
|
||||
('raised', 'Raised'),
|
||||
]
|
||||
FEMALE_CICLE_STATES = [
|
||||
('mated', 'Mated'),
|
||||
('pregnant', 'Pregnant'),
|
||||
('lactating', 'Lactating'),
|
||||
('unmated', 'Unmated'),
|
||||
]
|
||||
|
||||
|
||||
class Tag(ModelSQL, ModelView):
|
||||
|
@ -583,6 +589,9 @@ class Female:
|
|||
current_cycle = fields.Many2One('farm.animal.female_cycle',
|
||||
'Current Cycle', readonly=True, states=_STATES_FEMALE_FIELD,
|
||||
depends=_DEPENDS_FEMALE_FIELD)
|
||||
current_cycle_state = fields.Selection([(None, '')] + FEMALE_CICLE_STATES,
|
||||
'Current Cycle State', readonly=True, states=_STATES_FEMALE_FIELD,
|
||||
depends=_DEPENDS_FEMALE_FIELD)
|
||||
state = fields.Selection([
|
||||
(None, ''),
|
||||
('prospective', 'Prospective'),
|
||||
|
@ -635,6 +644,8 @@ class Female:
|
|||
def update_current_cycle(self):
|
||||
current_cycle = self.cycles and self.cycles[-1].id or None
|
||||
self.current_cycle = current_cycle
|
||||
self.current_cycle_state = (current_cycle.state
|
||||
if current_cycle else None)
|
||||
self.save()
|
||||
return current_cycle
|
||||
|
||||
|
@ -840,12 +851,8 @@ class FemaleCycle(ModelSQL, ModelView):
|
|||
sequence = fields.Integer('Num. cycle', required=True)
|
||||
ordination_date = fields.DateTime('Date for ordination', required=True,
|
||||
readonly=True)
|
||||
state = fields.Selection([
|
||||
('mated', 'Mated'),
|
||||
('pregnant', 'Pregnant'),
|
||||
('lactating', 'Lactating'),
|
||||
('unmated', 'Unmated'),
|
||||
], 'State', readonly=True, required=True)
|
||||
state = fields.Selection(FEMALE_CICLE_STATES, 'State', readonly=True,
|
||||
required=True)
|
||||
# Female events fields
|
||||
insemination_events = fields.One2Many('farm.insemination.event',
|
||||
'female_cycle', 'Inseminations')
|
||||
|
|
|
@ -716,6 +716,10 @@ msgctxt "field:farm.animal,current_cycle:"
|
|||
msgid "Current Cycle"
|
||||
msgstr "Cicle actual"
|
||||
|
||||
msgctxt "field:farm.animal,current_cycle_state:"
|
||||
msgid "Current Cycle State"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "field:farm.animal,current_weight:"
|
||||
msgid "Current Weight"
|
||||
msgstr ""
|
||||
|
@ -4590,6 +4594,29 @@ msgctxt "selection:farm.abort.event,state:"
|
|||
msgid "Validated"
|
||||
msgstr "Validat"
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid ""
|
||||
msgstr " "
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Lactating"
|
||||
msgstr "En lactància"
|
||||
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Mated"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Pregnant"
|
||||
msgstr "Embarasada"
|
||||
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Unmated"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:farm.animal,origin:"
|
||||
msgid "Purchased"
|
||||
msgstr "Comprat"
|
||||
|
@ -5287,10 +5314,6 @@ msgctxt "view:farm.semen_extraction.event:"
|
|||
msgid "Calculate Doses"
|
||||
msgstr "Calcula dosis"
|
||||
|
||||
msgctxt "view:farm.semen_extraction.event:"
|
||||
msgid "Dose Deliveries"
|
||||
msgstr "Enviaments de dosis"
|
||||
|
||||
msgctxt "view:farm.semen_extraction.event:"
|
||||
msgid "Extraction & Quality Test"
|
||||
msgstr ""
|
||||
|
|
|
@ -875,6 +875,10 @@ msgctxt "field:farm.animal,current_cycle:"
|
|||
msgid "Current Cycle"
|
||||
msgstr "Ciclo actual"
|
||||
|
||||
msgctxt "field:farm.animal,current_cycle_state:"
|
||||
msgid "Current Cycle State"
|
||||
msgstr "Estado ciclo actual"
|
||||
|
||||
msgctxt "field:farm.animal,current_weight:"
|
||||
msgid "Current Weight"
|
||||
msgstr "Peso actual"
|
||||
|
@ -4768,6 +4772,22 @@ msgctxt "selection:farm.abort.event,state:"
|
|||
msgid "Validated"
|
||||
msgstr "Validado"
|
||||
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Lactating"
|
||||
msgstr "Lactante"
|
||||
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Mated"
|
||||
msgstr "Inseminada"
|
||||
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Pregnant"
|
||||
msgstr "Preñada"
|
||||
|
||||
msgctxt "selection:farm.animal,current_cycle_state:"
|
||||
msgid "Unmated"
|
||||
msgstr "Sin inseminar"
|
||||
|
||||
msgctxt "selection:farm.animal,origin:"
|
||||
msgid "Purchased"
|
||||
msgstr "Comprado"
|
||||
|
@ -4776,10 +4796,6 @@ msgctxt "selection:farm.animal,origin:"
|
|||
msgid "Raised"
|
||||
msgstr "Criado"
|
||||
|
||||
msgctxt "selection:farm.animal,purpose:"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:farm.animal,purpose:"
|
||||
msgid "Replacement"
|
||||
msgstr "Reemplazo"
|
||||
|
@ -4804,10 +4820,6 @@ msgctxt "selection:farm.animal,sex:"
|
|||
msgid "Undetermined"
|
||||
msgstr "No determinado"
|
||||
|
||||
msgctxt "selection:farm.animal,state:"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:farm.animal,state:"
|
||||
msgid "Mated"
|
||||
msgstr "Inseminada"
|
||||
|
@ -5124,10 +5136,6 @@ msgctxt "selection:farm.move.event,state:"
|
|||
msgid "Validated"
|
||||
msgstr "Validado"
|
||||
|
||||
msgctxt "selection:farm.move.event,weight_record:"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:farm.move.event,weight_record:"
|
||||
msgid "Animal Weight"
|
||||
msgstr "Peso del animal"
|
||||
|
@ -5280,10 +5288,6 @@ msgctxt "selection:farm.weaning.event,state:"
|
|||
msgid "Validated"
|
||||
msgstr "Validado"
|
||||
|
||||
msgctxt "selection:stock.lot,animal_type:"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
||||
msgctxt "selection:stock.lot,animal_type:"
|
||||
msgid "Female"
|
||||
msgstr "Hembra"
|
||||
|
@ -5460,10 +5464,6 @@ msgctxt "view:farm.semen_extraction.event:"
|
|||
msgid "Calculate Doses"
|
||||
msgstr "Calcular dosis"
|
||||
|
||||
msgctxt "view:farm.semen_extraction.event:"
|
||||
msgid "Dose Deliveries"
|
||||
msgstr "Entregas dosis"
|
||||
|
||||
msgctxt "view:farm.semen_extraction.event:"
|
||||
msgid "Extraction & Quality Test"
|
||||
msgstr "Extracción & Test de calidad"
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<field name="last_extraction"/>
|
||||
<field name="days_from_insemination"/>
|
||||
<field name="days_from_farrowing"/>
|
||||
<field name="current_cycle_state"/>
|
||||
<field name="state"/>
|
||||
<field name="tags" tree_invisible="1"/>
|
||||
</tree>
|
||||
|
|
Loading…
Reference in New Issue