diff --git a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/SimulationMovement_testInvoicingRule.xml b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/SimulationMovement_testInvoicingRule.xml index e1ead93f2a37575ddfce39151f7d5954403a2cf8..91ef01bbdb3f3d29bad815664341f1490452df11 100644 --- a/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/SimulationMovement_testInvoicingRule.xml +++ b/bt5/erp5_invoicing/SkinTemplateItem/portal_skins/erp5_invoicing/SimulationMovement_testInvoicingRule.xml @@ -58,7 +58,12 @@ parent = movement.getParentValue()\n if parent.getPortalType() == \'Applied Rule\':\n parent_rule = parent.getSpecialiseValue()\n - if parent_rule.getPortalType() not in [\'Order Rule\', \'Delivery Rule\']:\n + parent_rule_portal_type = parent_rule.getPortalType()\n + if parent_rule_portal_type not in [\'Order Rule\', \'Delivery Rule\', \'Delivering Simulation Rule\']:\n + return False\n + # XXX can we create invoicing rule for Production Order?\n + if parent_rule_portal_type in [\'Delivering Simulation Rule\',] and \\\n + parent_rule.getParentValue().getParentValue().getPortalType() not in [\'Order Simulation Rule\']:\n return False\n \n source_section = movement.getSourceSection()\n @@ -110,6 +115,7 @@ return True\n <string>_getattr_</string> <string>parent</string> <string>parent_rule</string> + <string>parent_rule_portal_type</string> <string>False</string> <string>source_section</string> <string>destination_section</string> diff --git a/bt5/erp5_invoicing/bt/revision b/bt5/erp5_invoicing/bt/revision index b6e81543f7a3a86729eb8267696ac7b869355551..b99877a597907968a7f18a0383ece82f077280a8 100644 --- a/bt5/erp5_invoicing/bt/revision +++ b/bt5/erp5_invoicing/bt/revision @@ -1 +1 @@ -330 \ No newline at end of file +331 \ No newline at end of file diff --git a/product/ERP5/Document/AppliedRule.py b/product/ERP5/Document/AppliedRule.py index 2820f635d1e50adaef36e289b55fab49694bb46c..e903e58ff22f835c62d192cccd21ee52d4abfe92 100644 --- a/product/ERP5/Document/AppliedRule.py +++ b/product/ERP5/Document/AppliedRule.py @@ -209,6 +209,7 @@ class AppliedRule(XMLObject): .getRootSpecialiseValue(portal_type_list) if specialise_value is not None: return specialise_value + # 'order' category is deprecated. it is kept for compatibility. if order is not None: specialise_value = order.getExplanationValue() \ .getRootSpecialiseValue(portal_type_list) diff --git a/product/ERP5/Document/CausalityAssignmentMovementGroup.py b/product/ERP5/Document/CausalityAssignmentMovementGroup.py index aee5e1eaa6058b3baa452db27840123b99fcbde2..ffd7db0e521986de609b93b053e82046dcff9f9e 100644 --- a/product/ERP5/Document/CausalityAssignmentMovementGroup.py +++ b/product/ERP5/Document/CausalityAssignmentMovementGroup.py @@ -58,11 +58,13 @@ class CausalityAssignmentMovementGroup(MovementGroup): property_dict = {} parent = movement # Go upper into the simulation tree in order to find an order link - while parent.getOrderValue() is None and not(parent.isRootAppliedRule()): + while not parent.isRootAppliedRule(): parent = parent.getParentValue() causality_list = property_dict.get('causality_list', []) - for order_movement in parent.getOrderList(): - if order_movement not in causality_list: - causality_list.append(order_movement) + # 'order' category is deprecated. it is kept for compatibility. + movement_list = parent.getOrderList() or parent.getDeliveryList() + for delivery_movement in movement_list: + if delivery_movement not in causality_list: + causality_list.append(delivery_movement) property_dict['causality_list'] = causality_list return property_dict diff --git a/product/ERP5/Document/DeliveryRule.py b/product/ERP5/Document/DeliveryRule.py index 45dcef633c6ee240e2f0a841400820e169d5eb74..c152ffb46782b01c7b484a95a7f5517efec34924 100644 --- a/product/ERP5/Document/DeliveryRule.py +++ b/product/ERP5/Document/DeliveryRule.py @@ -197,6 +197,7 @@ class DeliveryRule(Rule): def _getExpandablePropertyUpdateDict(self, applied_rule, movement, business_path, current_property_dict): """Delivery specific update dict""" + # 'order' category is deprecated. it is kept for compatibility. return { 'order': movement.getRelativeUrl(), 'delivery': movement.getRelativeUrl(), diff --git a/product/ERP5/Document/InvoiceTransactionRule.py b/product/ERP5/Document/InvoiceTransactionRule.py index 627d402932ba6ec55f8b4482acf9a1a714514b25..b533a3c0ac994e468c1618fb8a1a3739aa2d79ad 100644 --- a/product/ERP5/Document/InvoiceTransactionRule.py +++ b/product/ERP5/Document/InvoiceTransactionRule.py @@ -89,6 +89,7 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): delivery = simulation_movement.getDeliveryValue() if delivery is not None: resource = delivery.getProperty('price_currency', None) + # 'order' category is deprecated. it is kept for compatibility. if (resource is None) and \ (simulation_movement.getParentValue().getParentValue() \ == portal_simulation) : diff --git a/product/ERP5/Document/Movement.py b/product/ERP5/Document/Movement.py index 38365762ccaf880d5f15014e2048324279de1999..db2adc5766984f37d4e691e269d99feccf44f631 100644 --- a/product/ERP5/Document/Movement.py +++ b/product/ERP5/Document/Movement.py @@ -595,6 +595,7 @@ class Movement(XMLObject, Amount): security.declareProtected( Permissions.AccessContentsInformation, 'isSimulated') def isSimulated(self): + # 'order' category is deprecated. it is kept for compatibility. return (len(self.getDeliveryRelatedValueList()) > 0) or\ (len(self.getOrderRelatedValueList()) > 0) @@ -605,6 +606,7 @@ class Movement(XMLObject, Amount): """ Returns the quantity of related order(s) """ + # XXX deprecated return self.getQuantity() security.declareProtected( Permissions.AccessContentsInformation, @@ -629,6 +631,7 @@ class Movement(XMLObject, Amount): """ Returns the list of start date of related order(s) """ + # XXX deprecated return [self.getStartDate()] security.declareProtected( Permissions.AccessContentsInformation, @@ -653,6 +656,7 @@ class Movement(XMLObject, Amount): """ Returns the list of stop date of related order(s) """ + # XXX deprecated return [self.getStopDate()] security.declareProtected( Permissions.AccessContentsInformation, @@ -677,6 +681,7 @@ class Movement(XMLObject, Amount): """ Returns the source of related orders """ + # XXX deprecated return self.getSourceList() security.declareProtected( Permissions.AccessContentsInformation, @@ -701,6 +706,7 @@ class Movement(XMLObject, Amount): """ Returns the destination of related orders """ + # XXX deprecated return self.getDestinationList() security.declareProtected( Permissions.AccessContentsInformation, @@ -725,6 +731,7 @@ class Movement(XMLObject, Amount): """ Returns the source_section of related orders """ + # XXX deprecated return self.getSourceSectionList() security.declareProtected( Permissions.AccessContentsInformation, @@ -749,6 +756,7 @@ class Movement(XMLObject, Amount): """ Returns the destination_section of related orders """ + # XXX deprecated return self.getDestinationSectionList() security.declareProtected( Permissions.AccessContentsInformation, diff --git a/product/ERP5/Document/Order.py b/product/ERP5/Document/Order.py index ec2c6a8ded7e69baf529b2417f48e01042cb71b4..b5c8a61c7ce82564ff340559b21195b45e9b10b8 100644 --- a/product/ERP5/Document/Order.py +++ b/product/ERP5/Document/Order.py @@ -125,21 +125,28 @@ class Order(Delivery): """ Warning: does not work if it was not catalogued immediately """ + # 'order' category is deprecated. it is kept for compatibility. for my_simulation_movement in self.getOrderRelatedValueList( - portal_type='Simulation Movement'): + portal_type='Simulation Movement') or \ + self.getDeliveryRelatedValueList( + portal_type='Simulation Movement'): # And apply getattr(my_simulation_movement, method_id)(**kw) for m in self.contentValues(filter={'portal_type': \ self.getPortalMovementTypeList()}): # Find related in simulation for my_simulation_movement in m.getOrderRelatedValueList( - portal_type='Simulation Movement'): + portal_type='Simulation Movement') or \ + m.getDeliveryRelatedValueList( + portal_type='Simulation Movement'): # And apply getattr(my_simulation_movement, method_id)(**kw) for c in m.contentValues(filter={'portal_type': self.getPortalMovementTypeList()}): for my_simulation_movement in c.getOrderRelatedValueList( - portal_type='Simulation Movement'): + portal_type='Simulation Movement') or \ + c.getDeliveryRelatedValueList( + portal_type='Simulation Movement'): # And apply getattr(my_simulation_movement, method_id)(**kw) @@ -156,14 +163,21 @@ class Order(Delivery): Returns simulation movements related to a cell or line of this order """ - result = self.getOrderRelatedValueList(portal_type='Simulation Movement') + # XXX The name should be getDeliveryRelatedMovementList, but this + # method seems to be not used at all. + result = self.getOrderRelatedValueList( + portal_type='Simulation Movement') or \ + self.getDeliveryRelatedValueList(portal_type='Simulation Movement') for m in self.contentValues(filter={'portal_type': \ self.getPortalMovementTypeList()}): # Find related in simulation - result += m.getOrderRelatedValueList(portal_type='Simulation Movement') + result += m.getOrderRelatedValueList( + portal_type='Simulation Movement') or \ + m.getDeliveryRelatedValueList(portal_type='Simulation Movement') for c in m.contentValues(filter={'portal_type': 'Delivery Cell'}): - result += c.getOrderRelatedValueList( \ - portal_type='Simulation Movement') + result += c.getOrderRelatedValueList( + portal_type='Simulation Movement') or \ + c.getDeliveryRelatedValueList(portal_type='Simulation Movement') return result def manage_beforeDelete(self, item, container): diff --git a/product/ERP5/Document/OrderLine.py b/product/ERP5/Document/OrderLine.py index 1230fd1e61c7786c269488a725d5c224a7c01ebe..e4ce6c9085bae6cd484a60e5c5284e2e74645604 100644 --- a/product/ERP5/Document/OrderLine.py +++ b/product/ERP5/Document/OrderLine.py @@ -67,14 +67,17 @@ class OrderLine(DeliveryLine): """ Warning: does not work if it was not catalogued immediately """ + # XXX This method seems to be not used at all. # Find related in simulation for my_simulation_movement in self.getOrderRelatedValueList( - portal_type = 'Simulation Movement'): + portal_type = 'Simulation Movement') or \ + self.getDeliveryRelatedValueList(portal_type = 'Simulation Movement'): # And apply getattr(my_simulation_movement, method_id)() for c in self.contentValues(filter={'portal_type': 'Delivery Cell'}): for my_simulation_movement in c.getOrderRelatedValueList( - portal_type = 'Simulation Movement'): + portal_type = 'Simulation Movement') or \ + c.getDeliveryRelatedValueList(portal_type = 'Simulation Movement'): # And apply getattr(my_simulation_movement, method_id)() diff --git a/product/ERP5/Document/PaymentRule.py b/product/ERP5/Document/PaymentRule.py index 90fd08da153018df23b431ae32ac37ba74997262..dd3021b90d9f2ad967621245038900dad8562c81 100644 --- a/product/ERP5/Document/PaymentRule.py +++ b/product/ERP5/Document/PaymentRule.py @@ -65,6 +65,7 @@ class PaymentRule(Rule): if payment_condition_list: return payment_condition_list + # 'order' category is deprecated. it is kept for compatibility. order_movement = movement.getOrderValue() if order_movement is not None: explanation = order_movement.getExplanationValue() diff --git a/product/ERP5/Document/RequirementMovementGroup.py b/product/ERP5/Document/RequirementMovementGroup.py index bcfd9d30d26b624a6839466d8655cb85621cda3a..9c4fa70322ff859061fea488bef8a28d3267c02d 100644 --- a/product/ERP5/Document/RequirementMovementGroup.py +++ b/product/ERP5/Document/RequirementMovementGroup.py @@ -43,7 +43,10 @@ class RequirementMovementGroup(MovementGroup): return True, property_dict def _getRequirementList(self, movement): + # 'order' category is deprecated. it is kept for compatibility. order_value = movement.getOrderValue() + if order_value is None: + order_value = movement.getDeliveryValue() requirement_list = [] if order_value is not None: if 'Line' in order_value.getPortalType(): diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 4a3a5fa08d4b6f5c3eb0ae0d929139fc335ff274..b3ffa39e2e34cdbcd9aa1ae934f2429f8b9b968a 100644 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -165,6 +165,7 @@ class SimulationMovement(Movement, PropertyRecordableMixin): delivery = self.getDeliveryValue() if delivery is not None: return delivery.getSimulationState() + # 'order' category is deprecated. it is kept for compatibility. order = self.getOrderValue() if order is not None: return order.getSimulationState() @@ -186,6 +187,7 @@ class SimulationMovement(Movement, PropertyRecordableMixin): delivery = self.getDeliveryValue() if delivery is not None: return delivery.getTranslatedSimulationStateTitle() + # 'order' category is deprecated. it is kept for compatibility. order = self.getOrderValue() if order is not None: return order.getTranslatedSimulationStateTitle() @@ -331,16 +333,24 @@ class SimulationMovement(Movement, PropertyRecordableMixin): security.declareProtected( Permissions.AccessContentsInformation, 'getOrderStartDate') def getOrderStartDate(self): + # 'order' category is deprecated. it is kept for compatibility. order_value = self.getOrderValue() if order_value is not None: return order_value.getStartDate() + delivery_value = self.getDeliveryValue() + if delivery_value is not None: + return delivery_value.getStartDate() security.declareProtected( Permissions.AccessContentsInformation, 'getOrderStopDate') def getOrderStopDate(self): + # 'order' category is deprecated. it is kept for compatibility. order_value = self.getOrderValue() if order_value is not None: return order_value.getStopDate() + delivery_value = self.getDeliveryValue() + if delivery_value is not None: + return delivery_value.getStopDate() security.declareProtected( Permissions.AccessContentsInformation, 'getDeliveryStartDateList') diff --git a/product/ERP5/Document/TaxLineDeliveryMovementGroup.py b/product/ERP5/Document/TaxLineDeliveryMovementGroup.py index 70469935646f148ef317d25abf88fc1a0d3d742b..50f2a9e3c704f614bea069294459c04cbb5fb5b6 100644 --- a/product/ERP5/Document/TaxLineDeliveryMovementGroup.py +++ b/product/ERP5/Document/TaxLineDeliveryMovementGroup.py @@ -99,7 +99,10 @@ class TaxLineDeliveryMovementGroup(MovementGroup): # in case of invoice rule (ie. starting from Invoice) if delivery_line is None: + # 'order' category is deprecated. it is kept for compatibility. delivery_line = applied_rule.getParentValue().getOrderValue() + if delivery_line is not None: + delivery_line = applied_rule.getParentValue().getDeliveryValue() # in case of invoicing rule (ie. starting from Order) if delivery_line is None: diff --git a/product/ERP5/Document/TransformationModelRule.py b/product/ERP5/Document/TransformationModelRule.py index 92a37f9d2b5e9a87fa26cfc11ef8816ac8949efa..928c0c02e14e11cb0387b78267216a86180162fc 100644 --- a/product/ERP5/Document/TransformationModelRule.py +++ b/product/ERP5/Document/TransformationModelRule.py @@ -145,7 +145,10 @@ class TransformationModelRuleMixin(Base): if movement is None and applied_rule is not None: movement = applied_rule.getParentValue() + # 'order' category is deprecated. it is kept for compatibility. order_movement = movement.getRootSimulationMovement().getOrderValue() + if order_movement is None: + order_movement = movement.getRootSimulationMovement().getDeliveryValue() explanation = self.getExplanationValue(movement=movement, applied_rule=applied_rule) # find the line of order recursively @@ -196,8 +199,12 @@ class TransformationModelRuleMixin(Base): if applied_rule is not None: return applied_rule.getRootAppliedRule().getCausalityValue() else: - return movement.getRootSimulationMovement()\ - .getOrderValue().getExplanationValue() + root_simulation_movement = movement.getRootSimulationMovement() + # 'order' category is deprecated. it is kept for compatibility. + order = root_simulation_movement.getOrderValue() + if order is None: + order = root_simulation_movement.getDeliveryValue() + return order.getExplanationValue() def getHeadProductionPathValueList(self, transformation, business_process): """ diff --git a/product/ERP5/Document/TransformationSourcingRule.py b/product/ERP5/Document/TransformationSourcingRule.py index af2ae61c0c7e438f2859d4f9c42d8edb5d102dbe..a37645da82a0662bfaaf38d6106050716db40c61 100644 --- a/product/ERP5/Document/TransformationSourcingRule.py +++ b/product/ERP5/Document/TransformationSourcingRule.py @@ -107,8 +107,11 @@ class TransformationSourcingRuleMixin(ExtensionClass.Base): """ Get transformation related to used by the applied rule. """ - production_order_movement = movement.getRootSimulationMovement().\ - getOrderValue() + root_simulation_movement = movement.getRootSimulationMovement() + # 'order' category is deprecated. it is kept for compatibility. + production_order_movement = root_simulation_movement.getOrderValue() + if production_order_movement is None: + production_order_movement = root_simulation_movement.getDeliveryValue() # XXX Acquisition can be use instead parent_uid = production_order_movement.getParentUid() explanation_uid = production_order_movement.getExplanationUid() diff --git a/product/ERP5/TargetSolver/SplitAndDefer.py b/product/ERP5/TargetSolver/SplitAndDefer.py index ac4da9e14c1f78be89b07429afb848455636ee5d..6d7edc5aade0636983e6b269575cdf6ffcfc511b 100644 --- a/product/ERP5/TargetSolver/SplitAndDefer.py +++ b/product/ERP5/TargetSolver/SplitAndDefer.py @@ -77,6 +77,7 @@ class SplitAndDefer(CopyToTarget): id=new_id, quantity=movement_quantity - new_movement_quantity, activate_kw=self.activate_kw, + # 'order' category is deprecated. it is kept for compatibility. order=simulation_movement.getOrder(), **self.additional_parameters ) @@ -110,6 +111,8 @@ class SplitAndDefer(CopyToTarget): efficiency=simulation_movement.getEfficiency(), start_date=simulation_movement.getStartDate(), stop_date=simulation_movement.getStopDate(), + # 'order' category is deprecated. it is kept for + # compatibility. order=simulation_movement.getOrder(), resource=simulation_movement.getResource(), diff --git a/product/ERP5/TargetSolver/SplitQuantity.py b/product/ERP5/TargetSolver/SplitQuantity.py index 08f2a50794779ea166448336935badbd21e35a34..4e5b9e596f9480df657e1a0ea656a7d4ea2b3631 100644 --- a/product/ERP5/TargetSolver/SplitQuantity.py +++ b/product/ERP5/TargetSolver/SplitQuantity.py @@ -57,6 +57,7 @@ class SplitQuantity(CopyToTarget): start_date=simulation_movement.getStartDate(), stop_date=simulation_movement.getStopDate(), # XXX resource + # 'order' category is deprecated. it is kept for compatibility. order = simulation_movement.getOrder(), quantity = self.quantity, source = simulation_movement.getSource(),