Commit f60f2922 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use rule's updating testers for getting values instead of getting all possible...

use rule's updating testers for getting values instead of getting all possible properties and categories.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@32282 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 78efcb26
...@@ -36,8 +36,8 @@ from Products.ERP5.Document.Predicate import Predicate ...@@ -36,8 +36,8 @@ from Products.ERP5.Document.Predicate import Predicate
from Products.ERP5.mixin.rule import RuleMixin from Products.ERP5.mixin.rule import RuleMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
from Products.ERP5.Document.PredicateMatrix import PredicateMatrix from Products.ERP5.Document.PredicateMatrix import PredicateMatrix
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate, PredicateMatrix): class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate, PredicateMatrix):
""" """
...@@ -95,7 +95,7 @@ class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicat ...@@ -95,7 +95,7 @@ class InvoiceTransactionRule(RuleMixin, MovementCollectionUpdaterMixin, Predicat
# or destination. # or destination.
return (movement.getSource() is None or movement.getDestination() is None) return (movement.getSource() is None or movement.getDestination() is None)
class InvoiceTransactionRuleMovementGenerator(object): class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
def getGeneratedMovementList(self, context, movement_list=None, def getGeneratedMovementList(self, context, movement_list=None,
rounding=False): rounding=False):
""" """
...@@ -153,7 +153,8 @@ class InvoiceTransactionRuleMovementGenerator(object): ...@@ -153,7 +153,8 @@ class InvoiceTransactionRuleMovementGenerator(object):
# last resort : get the resource from the rule # last resort : get the resource from the rule
resource = accounting_rule_cell_line.getResource() \ resource = accounting_rule_cell_line.getResource() \
or cell.getResource() or cell.getResource()
kw = _getPropertyAndCategoryList(input_movement) # XXX we need business path here?
kw = self._getPropertyAndCategoryList(input_movement, None, rule)
kw.update( kw.update(
delivery=None, delivery=None,
......
...@@ -37,7 +37,6 @@ from Products.ERP5.mixin.rule import RuleMixin ...@@ -37,7 +37,6 @@ from Products.ERP5.mixin.rule import RuleMixin
from Products.ERP5.mixin.movement_collection_updater import \ from Products.ERP5.mixin.movement_collection_updater import \
MovementCollectionUpdaterMixin MovementCollectionUpdaterMixin
from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin from Products.ERP5.mixin.movement_generator import MovementGeneratorMixin
from Products.ERP5.MovementCollectionDiff import _getPropertyAndCategoryList
class PaymentRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate): class PaymentRule(RuleMixin, MovementCollectionUpdaterMixin, Predicate):
""" """
...@@ -102,12 +101,14 @@ class PaymentRuleMovementGenerator(MovementGeneratorMixin): ...@@ -102,12 +101,14 @@ class PaymentRuleMovementGenerator(MovementGeneratorMixin):
XXX This implementation using Business Path, not Payment Condition. XXX This implementation using Business Path, not Payment Condition.
""" """
ret = [] ret = []
rule = context.getSpecialiseValue()
for input_movement, business_path in self \ for input_movement, business_path in self \
._getInputMovementAndPathTupleList(context): ._getInputMovementAndPathTupleList(context):
# Payment Rule does not work with Business Path # Payment Rule does not work with Business Path
if business_path is None: if business_path is None:
continue continue
kw = _getPropertyAndCategoryList(input_movement) kw = self._getPropertyAndCategoryList(input_movement, business_path,
rule)
kw.update({'order':None, 'delivery':None}) kw.update({'order':None, 'delivery':None})
quantity = kw.pop('quantity', 0) quantity = kw.pop('quantity', 0)
efficiency = business_path.getEfficiency() efficiency = business_path.getEfficiency()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment