diff --git a/mis_builder/tests/test_aep.py b/mis_builder/tests/test_aep.py index 74f2ffebc..da7f1a533 100644 --- a/mis_builder/tests/test_aep.py +++ b/mis_builder/tests/test_aep.py @@ -66,6 +66,7 @@ def setUp(self): amount=300, debit_acc=self.account_ar, credit_acc=self.account_in, + credit_quantity=3, ) # create move in March this year self._create_move( @@ -90,6 +91,7 @@ def setUp(self): self.aep.parse_expr("crdp[700I%]") self.aep.parse_expr("bali[400%]") self.aep.parse_expr("bale[700%]") + self.aep.parse_expr("fldp.quantity[700%]") self.aep.parse_expr("balp[]" "[('account_id.code', '=', '400AR')]") self.aep.parse_expr( "balp[]" "[('account_id.account_type', '=', " " 'asset_receivable')]" @@ -104,17 +106,32 @@ def setUp(self): self.aep.parse_expr("bal_700IN") # deprecated self.aep.parse_expr("bals[700IN]") # deprecated - def _create_move(self, date, amount, debit_acc, credit_acc, post=True): + def _create_move( + self, date, amount, debit_acc, credit_acc, post=True, credit_quantity=0 + ): move = self.move_model.create( { "journal_id": self.journal.id, "date": fields.Date.to_string(date), "line_ids": [ - (0, 0, {"name": "/", "debit": amount, "account_id": debit_acc.id}), ( 0, 0, - {"name": "/", "credit": amount, "account_id": credit_acc.id}, + { + "name": "/", + "debit": amount, + "account_id": debit_acc.id, + }, + ), + ( + 0, + 0, + { + "name": "/", + "credit": amount, + "account_id": credit_acc.id, + "quantity": credit_quantity, + }, ), ], } @@ -193,6 +210,8 @@ def test_aep_basic(self): # check ending balance self.assertEqual(self._eval("bale[400AR]"), 400) self.assertEqual(self._eval("bale[700IN]"), -300) + # check fldp.quantity + self.assertEqual(self._eval("fldp.quantity[700%]"), 3) # let's query for March self._do_queries( @@ -224,6 +243,8 @@ def test_aep_basic(self): self.assertEqual(self._eval("debp[400A%]"), 500) self.assertEqual(self._eval("bal_700IN"), -500) self.assertEqual(self._eval("bals[700IN]"), -800) + # check fldp.quantity + self.assertEqual(self._eval("fldp.quantity[700%]"), 0) # unallocated p&l from previous year self.assertEqual(self._eval("balu[]"), -100)