Removed quantity from female cycle doens't make sense until animals are weaned

This commit is contained in:
Sergi Almacellas Abellana 2015-05-05 17:14:32 +02:00
parent 9a0031604f
commit 853a244780
3 changed files with 10 additions and 9 deletions

View File

@ -1004,6 +1004,8 @@ class FemaleCycle(ModelSQL, ModelView):
return self.weaning_event and self.weaning_event.quantity or 0
def get_removed(self, name):
if not self.weaning_event:
return None
return self.live + self.fostered - self.weaned
def get_lactating_days(self, name):

View File

@ -300,6 +300,7 @@ validate them and check females state and female's live values::
True
>>> females[0].current_cycle.live
6
>>> females[0].current_cycle.removed
>>> females[-1].current_cycle.live == (6 + len(females) - 1)
True
@ -336,6 +337,8 @@ the weaning event doesn't have female, weaned nor lost moves::
u'unmated'
>>> female1.current_cycle.weaned
6
>>> female1.current_cycle.removed
0
>>> female1.current_cycle.weaning_event.female_move
>>> female1.current_cycle.weaning_event.weaned_move
>>> female1.current_cycle.weaning_event.lost_move
@ -382,6 +385,8 @@ the weaning event has female and lost moves but not weaned group move::
u'unmated'
>>> female2.current_cycle.weaned
6
>>> female2.current_cycle.removed
1
>>> female2.current_cycle.weaning_event.female_move.state
u'done'
>>> female2.current_cycle.weaning_event.weaned_move

View File

@ -25,23 +25,17 @@ SCENARIOS = [
class FarmTestCase(unittest.TestCase):
'''
Test Farm module.
'''
'Test Farm module'
def setUp(self):
trytond.tests.test_tryton.install_module('farm')
def test0005views(self):
'''
Test views.
'''
'Test views'
test_view('farm')
def test0006depends(self):
'''
Test depends.
'''
'Test depends'
test_depends()