Commit 56831a07 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

fix typos and cosmetic changes only.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23646 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0d838be4
############################################################################# #############################################################################
# #
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2006-2008 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com> # Rafael Monnerat <rafael@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -35,7 +35,7 @@ from Products.ERP5.Document.PropertyDivergenceTester import \ ...@@ -35,7 +35,7 @@ from Products.ERP5.Document.PropertyDivergenceTester import \
class CategoryDivergenceTester(PropertyDivergenceTester): class CategoryDivergenceTester(PropertyDivergenceTester):
""" """
The purpose of this divergence tester is to check the The purpose of this divergence tester is to check the
consistency between delivery movement and simulation movement consistency between delivery movement and simulation movement
for some specific categories. for some specific categories.
""" """
...@@ -44,7 +44,7 @@ class CategoryDivergenceTester(PropertyDivergenceTester): ...@@ -44,7 +44,7 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
isPortalContent = 1 isPortalContent = 1
isRADContent = 1 isRADContent = 1
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
...@@ -60,7 +60,7 @@ class CategoryDivergenceTester(PropertyDivergenceTester): ...@@ -60,7 +60,7 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
, PropertySheet.DivergenceTester , PropertySheet.DivergenceTester
) )
def explain(self, simulation_movement): def explain(self, simulation_movement):
""" """
This method returns a list of messages that contains This method returns a list of messages that contains
...@@ -83,21 +83,21 @@ class CategoryDivergenceTester(PropertyDivergenceTester): ...@@ -83,21 +83,21 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
delivery_mvt.getPropertyList(tested_property_id) delivery_mvt.getPropertyList(tested_property_id)
simulation_category_list = \ simulation_category_list = \
simulation_movement.getPropertyList(tested_property_id) simulation_movement.getPropertyList(tested_property_id)
# XXX Don't we need to check the order too ? # XXX Don't we need to check the order too ?
delivery_mvt_category_list.sort() delivery_mvt_category_list.sort()
simulation_category_list.sort() simulation_category_list.sort()
if delivery_mvt_category_list != simulation_category_list: if delivery_mvt_category_list != simulation_category_list:
delivery_mvt_category_title_list = [] delivery_mvt_category_title_list = []
for mvt_category in delivery_mvt_category_list: for mvt_category in delivery_mvt_category_list:
category_value = delivery_mvt.resolveCategory(mvt_category) category_value = delivery_mvt.resolveCategory(mvt_category)
if category_value is not None: if category_value is not None:
if category_value.getPortalType() == 'Category': if category_value.getPortalType() == 'Category':
delivery_mvt_category_title_list.append(category_value.getTranslatedTitle()) delivery_mvt_category_title_list.append(category_value.getTranslatedTitle())
else: else:
delivery_mvt_category_title_list.append(category_value.getTitle()) delivery_mvt_category_title_list.append(category_value.getTitle())
simulation_category_title_list = [] simulation_category_title_list = []
for mvt_category in simulation_category_list: for mvt_category in simulation_category_list:
category_value = delivery_mvt.resolveCategory(mvt_category) category_value = delivery_mvt.resolveCategory(mvt_category)
...@@ -106,20 +106,20 @@ class CategoryDivergenceTester(PropertyDivergenceTester): ...@@ -106,20 +106,20 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
simulation_category_title_list.append(category_value.getTranslatedTitle()) simulation_category_title_list.append(category_value.getTranslatedTitle())
else: else:
simulation_category_title_list.append(category_value.getTitle()) simulation_category_title_list.append(category_value.getTitle())
delivery_mvt_property = ' , '.join(delivery_mvt_category_title_list) delivery_mvt_property = ' , '.join(delivery_mvt_category_title_list)
simulation_mvt_property = ' , '.join(simulation_category_title_list) simulation_mvt_property = ' , '.join(simulation_category_title_list)
message = ObjectMessage( message = ObjectMessage(
object_relative_url=delivery_mvt.getRelativeUrl(), object_relative_url=delivery_mvt.getRelativeUrl(),
simulation_movement=simulation_movement, simulation_movement=simulation_movement,
decision_value=delivery_mvt_property , decision_value=delivery_mvt_property ,
prevision_value=simulation_mvt_property, prevision_value=simulation_mvt_property,
tested_property=tested_property_id, tested_property=tested_property_id,
message=tested_property_title, message=tested_property_title,
solver_script_list=solver_script_list solver_script_list=solver_script_list
) )
divergence_message_list.append(message) divergence_message_list.append(message)
return divergence_message_list return divergence_message_list
This diff is collapsed.
############################################################################## ##############################################################################
# #
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2005-2008 Nexedi SA and Contributors. All Rights Reserved.
# Romain Courteaud <romain@nexedi.com> # Romain Courteaud <romain@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -43,38 +43,38 @@ class SelectMovementError(Exception): pass ...@@ -43,38 +43,38 @@ class SelectMovementError(Exception): pass
class DeliveryBuilder(OrderBuilder): class DeliveryBuilder(OrderBuilder):
""" """
Delivery Builder objects allow to gather multiple Simulation Movements Delivery Builder objects allow to gather multiple Simulation Movements
into a single Delivery. into a single Delivery.
The initial quantity property of the Delivery Line is calculated by The initial quantity property of the Delivery Line is calculated by
summing quantities of related Simulation Movements. summing quantities of related Simulation Movements.
Delivery Builders are called for example whenever an order is confirmed. Delivery Builders are called for example whenever an order is confirmed.
They are also called globaly in order to gather any confirmed or above They are also called globaly in order to gather any confirmed or above
Simulation Movement which was not associated to any Delivery Line. Simulation Movement which was not associated to any Delivery Line.
Such movements are called orphaned Simulation Movements. Such movements are called orphaned Simulation Movements.
Delivery Builder objects are provided with a set a parameters to achieve Delivery Builder objects are provided with a set a parameters to achieve
their goal: their goal:
A path definition: source, destination, etc. which defines the general A path definition: source, destination, etc. which defines the general
kind of movements it applies. kind of movements it applies.
simulation_select_method which defines how to query all Simulation simulation_select_method which defines how to query all Simulation
Movements which meet certain criteria (including the above path path Movements which meet certain criteria (including the above path path
definition). definition).
collect_order_list which defines how to group selected movements collect_order_list which defines how to group selected movements
according to gathering rules. according to gathering rules.
delivery_select_method which defines how to select existing Delivery delivery_select_method which defines how to select existing Delivery
which may eventually be updated with selected simulation movements. which may eventually be updated with selected simulation movements.
delivery_module, delivery_type and delivery_line_type which define the delivery_module, delivery_type and delivery_line_type which define the
module and portal types for newly built Deliveries and Delivery Lines. module and portal types for newly built Deliveries and Delivery Lines.
Delivery Builders can also be provided with optional parameters to Delivery Builders can also be provided with optional parameters to
restrict selection to a given root Applied Rule caused by a single Order restrict selection to a given root Applied Rule caused by a single Order
or to Simulation Movements related to a limited set of existing or to Simulation Movements related to a limited set of existing
Deliveries. Deliveries.
""" """
...@@ -103,7 +103,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -103,7 +103,7 @@ class DeliveryBuilder(OrderBuilder):
done before building Delivery. done before building Delivery.
""" """
pass pass
def searchMovementList(self, applied_rule_uid=None,**kw): def searchMovementList(self, applied_rule_uid=None,**kw):
""" """
defines how to query all Simulation Movements which meet certain criteria defines how to query all Simulation Movements which meet certain criteria
...@@ -157,7 +157,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -157,7 +157,7 @@ class DeliveryBuilder(OrderBuilder):
and delivery movement. and delivery movement.
""" """
OrderBuilder._setDeliveryMovementProperties( OrderBuilder._setDeliveryMovementProperties(
self, delivery_movement, self, delivery_movement,
simulation_movement, property_dict, simulation_movement, property_dict,
update_existing_movement=update_existing_movement) update_existing_movement=update_existing_movement)
# Check if simulation movement is not already linked to a existing # Check if simulation movement is not already linked to a existing
...@@ -170,11 +170,11 @@ class DeliveryBuilder(OrderBuilder): ...@@ -170,11 +170,11 @@ class DeliveryBuilder(OrderBuilder):
simulation_movement.edit(delivery_value=delivery_movement) simulation_movement.edit(delivery_value=delivery_movement)
# Simulation consistency propagation # Simulation consistency propagation
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'updateFromSimulation') 'updateFromSimulation')
def updateFromSimulation(self, delivery_relative_url, create_new_delivery=1): def updateFromSimulation(self, delivery_relative_url, create_new_delivery=1):
""" """
Update all lines of this transaction based on movements in the Update all lines of this transaction based on movements in the
simulation related to this transaction. simulation related to this transaction.
""" """
updateFromSimulation = UnrestrictedMethod(self._updateFromSimulation) updateFromSimulation = UnrestrictedMethod(self._updateFromSimulation)
...@@ -194,7 +194,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -194,7 +194,7 @@ class DeliveryBuilder(OrderBuilder):
for simulation_movement in movement.getDeliveryRelatedValueList( for simulation_movement in movement.getDeliveryRelatedValueList(
portal_type="Simulation Movement"): portal_type="Simulation Movement"):
simulation_movement.setDelivery(None) simulation_movement.setDelivery(None)
simulation_movement_list.append(simulation_movement) simulation_movement_list.append(simulation_movement)
# Collect # Collect
root_group = self.collectMovement(simulation_movement_list) root_group = self.collectMovement(simulation_movement_list)
...@@ -259,7 +259,7 @@ class DeliveryBuilder(OrderBuilder): ...@@ -259,7 +259,7 @@ class DeliveryBuilder(OrderBuilder):
rejected_movement_list.extend(group.getMovementList()) rejected_movement_list.extend(group.getMovementList())
movement_group = movement_group.getGroupList()[0] movement_group = movement_group.getGroupList()[0]
property_dict.update(movement_group.getGroupEditDict()) property_dict.update(movement_group.getGroupEditDict())
# Put properties on delivery # Put properties on delivery
delivery.edit(**property_dict) delivery.edit(**property_dict)
......
############################################################################## ##############################################################################
# #
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2005-2008 Nexedi SA and Contributors. All Rights Reserved.
# Romain Courteaud <romain@nexedi.com> # Romain Courteaud <romain@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -42,33 +42,33 @@ class MatrixError(Exception): pass ...@@ -42,33 +42,33 @@ class MatrixError(Exception): pass
class OrderBuilder(XMLObject, Amount, Predicate): class OrderBuilder(XMLObject, Amount, Predicate):
""" """
Order Builder objects allow to gather multiple Simulation Movements Order Builder objects allow to gather multiple Simulation Movements
into a single Delivery. into a single Delivery.
The initial quantity property of the Delivery Line is calculated by The initial quantity property of the Delivery Line is calculated by
summing quantities of related Simulation Movements. summing quantities of related Simulation Movements.
Order Builder objects are provided with a set a parameters to achieve Order Builder objects are provided with a set a parameters to achieve
their goal: their goal:
A path definition: source, destination, etc. which defines the general A path definition: source, destination, etc. which defines the general
kind of movements it applies. kind of movements it applies.
simulation_select_method which defines how to query all Simulation simulation_select_method which defines how to query all Simulation
Movements which meet certain criteria (including the above path path Movements which meet certain criteria (including the above path path
definition). definition).
collect_order_list which defines how to group selected movements collect_order_list which defines how to group selected movements
according to gathering rules. according to gathering rules.
delivery_select_method which defines how to select existing Delivery delivery_select_method which defines how to select existing Delivery
which may eventually be updated with selected simulation movements. which may eventually be updated with selected simulation movements.
delivery_module, delivery_type and delivery_line_type which define the delivery_module, delivery_type and delivery_line_type which define the
module and portal types for newly built Deliveries and Delivery Lines. module and portal types for newly built Deliveries and Delivery Lines.
Order Builders can also be provided with optional parameters to Order Builders can also be provided with optional parameters to
restrict selection to a given root Applied Rule caused by a single Order restrict selection to a given root Applied Rule caused by a single Order
or to Simulation Movements related to a limited set of existing or to Simulation Movements related to a limited set of existing
Deliveries. Deliveries.
""" """
...@@ -90,7 +90,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -90,7 +90,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
, PropertySheet.Comment , PropertySheet.Comment
, PropertySheet.DeliveryBuilder , PropertySheet.DeliveryBuilder
) )
security.declarePublic('build') security.declarePublic('build')
def build(self, applied_rule_uid=None, movement_relative_url_list=None, def build(self, applied_rule_uid=None, movement_relative_url_list=None,
delivery_relative_url_list=None,**kw): delivery_relative_url_list=None,**kw):
...@@ -129,10 +129,10 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -129,10 +129,10 @@ class OrderBuilder(XMLObject, Amount, Predicate):
def callBeforeBuildingScript(self): def callBeforeBuildingScript(self):
""" """
Call a script on the module, for example, to remove some Call a script on the module, for example, to remove some
auto_planned Order. auto_planned Order.
This part can only be done with a script, because user may want This part can only be done with a script, because user may want
to keep existing auto_planned Order, and only update lines in to keep existing auto_planned Order, and only update lines in
them. them.
No activities are used when deleting a object, so, current No activities are used when deleting a object, so, current
implementation should be OK. implementation should be OK.
...@@ -147,9 +147,9 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -147,9 +147,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
""" """
Defines how to query all Simulation Movements which meet certain Defines how to query all Simulation Movements which meet certain
criteria (including the above path path definition). criteria (including the above path path definition).
First, select movement matching to criteria define on First, select movement matching to criteria define on
DeliveryBuilder. DeliveryBuilder.
Then, call script simulation_select_method to restrict Then, call script simulation_select_method to restrict
movement_list. movement_list.
""" """
from Products.ERP5Type.Document import newTempMovement from Products.ERP5Type.Document import newTempMovement
...@@ -175,7 +175,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -175,7 +175,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
if (inventory_item.inventory is not None): if (inventory_item.inventory is not None):
dumb_movement = inventory_item.getObject() dumb_movement = inventory_item.getObject()
# Create temporary movement # Create temporary movement
movement = newTempMovement(self.getPortalObject(), movement = newTempMovement(self.getPortalObject(),
str(id_count)) str(id_count))
id_count += 1 id_count += 1
movement.edit( movement.edit(
...@@ -224,7 +224,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -224,7 +224,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
def collectMovement(self, movement_list): def collectMovement(self, movement_list):
""" """
group movements in the way we want. Thanks to this method, we are able group movements in the way we want. Thanks to this method, we are able
to retrieve movement classed by order, resource, criterion,.... to retrieve movement classed by order, resource, criterion,....
movement_list : the list of movement wich we want to group movement_list : the list of movement wich we want to group
check_list : the list of classes used to group movements. The order check_list : the list of classes used to group movements. The order
...@@ -295,7 +295,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -295,7 +295,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
**kw) **kw)
return delivery_list return delivery_list
def _deliveryGroupProcessing(self, delivery_module, movement_group, def _deliveryGroupProcessing(self, delivery_module, movement_group,
collect_order_list, property_dict, collect_order_list, property_dict,
delivery_to_update_list=None, delivery_to_update_list=None,
activate_kw=None,**kw): activate_kw=None,**kw):
...@@ -321,7 +321,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -321,7 +321,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
activate_kw=activate_kw) activate_kw=activate_kw)
delivery_list.extend(new_delivery_list) delivery_list.extend(new_delivery_list)
else: else:
# Test if we can update a existing delivery, or if we need to create # Test if we can update a existing delivery, or if we need to create
# a new one # a new one
delivery = None delivery = None
for delivery_to_update in delivery_to_update_list: for delivery_to_update in delivery_to_update_list:
...@@ -352,7 +352,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -352,7 +352,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
activate_kw=activate_kw,**kw) activate_kw=activate_kw,**kw)
delivery_list.append(delivery) delivery_list.append(delivery)
return delivery_list return delivery_list
def _deliveryLineGroupProcessing(self, delivery, movement_group, def _deliveryLineGroupProcessing(self, delivery, movement_group,
collect_order_list, property_dict, collect_order_list, property_dict,
activate_kw=None,**kw): activate_kw=None,**kw):
...@@ -403,7 +403,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -403,7 +403,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Then, create delivery movement (delivery cell or complete delivery # Then, create delivery movement (delivery cell or complete delivery
# line) # line)
group_list = movement_group.getGroupList() group_list = movement_group.getGroupList()
# If no group is defined for cell, we need to continue, in order to # If no group is defined for cell, we need to continue, in order to
# save the quantity value # save the quantity value
if list(group_list) != []: if list(group_list) != []:
for group in group_list: for group in group_list:
...@@ -438,9 +438,9 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -438,9 +438,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Get sorted movement for each delivery line # Get sorted movement for each delivery line
for group in movement_group.getGroupList(): for group in movement_group.getGroupList():
self._deliveryCellGroupProcessing( self._deliveryCellGroupProcessing(
delivery_line, delivery_line,
group, group,
collect_order_list[1:], collect_order_list[1:],
property_dict.copy(), property_dict.copy(),
update_existing_line=update_existing_line, update_existing_line=update_existing_line,
activate_kw=activate_kw) activate_kw=activate_kw)
...@@ -473,7 +473,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -473,7 +473,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
cell = delivery_line.getCell(base_id=base_id, *cell_key) cell = delivery_line.getCell(base_id=base_id, *cell_key)
if self.testObjectProperties(cell, property_dict): if self.testObjectProperties(cell, property_dict):
# We update a existing cell # We update a existing cell
# delivery_ratio of new related movement to this cell # delivery_ratio of new related movement to this cell
# must be updated to 0. # must be updated to 0.
update_existing_movement = 1 update_existing_movement = 1
object_to_update = cell object_to_update = cell
...@@ -484,7 +484,7 @@ class OrderBuilder(XMLObject, Amount, Predicate): ...@@ -484,7 +484,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
omit_optional_variation=1) omit_optional_variation=1)
if not delivery_line.hasCell(base_id=base_id, *cell_key): if not delivery_line.hasCell(base_id=base_id, *cell_key):
cell = delivery_line.newCell(base_id=base_id, \ cell = delivery_line.newCell(base_id=base_id, \
portal_type=self.getDeliveryCellPortalType(), portal_type=self.getDeliveryCellPortalType(),
activate_kw=activate_kw,*cell_key) activate_kw=activate_kw,*cell_key)
vcl = movement.getVariationCategoryList() vcl = movement.getVariationCategoryList()
cell._edit(category_list=vcl, cell._edit(category_list=vcl,
......
############################################################################## ##############################################################################
# #
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2006-2008 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com> # Rafael Monnerat <rafael@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -35,7 +35,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Interface ...@@ -35,7 +35,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Interface
class PropertyDivergenceTester(XMLObject): class PropertyDivergenceTester(XMLObject):
""" """
The purpose of this divergence tester is to check the The purpose of this divergence tester is to check the
consistency between delivery movement and simulation movement consistency between delivery movement and simulation movement
for some specific properties. for some specific properties.
""" """
...@@ -44,7 +44,7 @@ class PropertyDivergenceTester(XMLObject): ...@@ -44,7 +44,7 @@ class PropertyDivergenceTester(XMLObject):
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
isPortalContent = 1 isPortalContent = 1
isRADContent = 1 isRADContent = 1
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
...@@ -73,12 +73,12 @@ class PropertyDivergenceTester(XMLObject): ...@@ -73,12 +73,12 @@ class PropertyDivergenceTester(XMLObject):
the divergence of the Delivery Line. the divergence of the Delivery Line.
""" """
divergence_message_list = [] divergence_message_list = []
tested_property = self.getTestedPropertyList() tested_property = self.getTestedPropertyList()
# Get the list of solvers callable in this case # Get the list of solvers callable in this case
solver_script_list = self.getSolverScriptList() solver_script_list = self.getSolverScriptList()
if solver_script_list is None: if solver_script_list is None:
solver_script_list = [] solver_script_list = []
solver_script_list = self._splitStringList(solver_script_list) solver_script_list = self._splitStringList(solver_script_list)
delivery_mvt = simulation_movement.getDeliveryValue() delivery_mvt = simulation_movement.getDeliveryValue()
...@@ -96,13 +96,13 @@ class PropertyDivergenceTester(XMLObject): ...@@ -96,13 +96,13 @@ class PropertyDivergenceTester(XMLObject):
message=tested_property_title, message=tested_property_title,
solver_script_list=solver_script_list solver_script_list=solver_script_list
) )
divergence_message_list.append(message) divergence_message_list.append(message)
return divergence_message_list return divergence_message_list
def _splitStringList(self, string_list): def _splitStringList(self, string_list):
""" """
Convert a list of string with a pipe (ex: ["azert | qsdfg", ] ) Convert a list of string with a pipe (ex: ["azert | qsdfg", ] )
to a list of tuple (ex: [("azert", "qsdfg"), ] ) to a list of tuple (ex: [("azert", "qsdfg"), ] )
""" """
return [tuple([x.strip() for x in x.split('|')]) for x in string_list] return [tuple([x.strip() for x in x.split('|')]) for x in string_list]
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
# Rafael M. Monnerat <rafael@nexedi.com> # Rafael M. Monnerat <rafael@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -35,7 +35,7 @@ from Products.ERP5.Document.PropertyDivergenceTester import \ ...@@ -35,7 +35,7 @@ from Products.ERP5.Document.PropertyDivergenceTester import \
class QuantityDivergenceTester(PropertyDivergenceTester): class QuantityDivergenceTester(PropertyDivergenceTester):
""" """
The purpose of this divergence tester is to check the The purpose of this divergence tester is to check the
consistency between delivery movement and simulation movement consistency between delivery movement and simulation movement
for the property quantity. for the property quantity.
""" """
...@@ -44,14 +44,14 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -44,14 +44,14 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
add_permission = Permissions.AddPortalContent add_permission = Permissions.AddPortalContent
isPortalContent = 1 isPortalContent = 1
isRADContent = 1 isRADContent = 1
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative interfaces # Declarative interfaces
__implements__ = ( Interface.DivergenceTester, ) __implements__ = ( Interface.DivergenceTester, )
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
...@@ -61,7 +61,7 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -61,7 +61,7 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
, PropertySheet.DivergenceTester , PropertySheet.DivergenceTester
) )
def explain(self, simulation_movement): def explain(self, simulation_movement):
""" """
This method returns a list of messages that contains This method returns a list of messages that contains
...@@ -72,11 +72,11 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -72,11 +72,11 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
d_quantity = delivery.getQuantity() d_quantity = delivery.getQuantity()
quantity = simulation_movement.getCorrectedQuantity() quantity = simulation_movement.getCorrectedQuantity()
d_error = simulation_movement.getDeliveryError() d_error = simulation_movement.getDeliveryError()
solver_script_list = self.getSolverScriptList() solver_script_list = self.getSolverScriptList()
if solver_script_list is None: if solver_script_list is None:
solver_script_list = [] solver_script_list = []
message = ObjectMessage(object_relative_url= delivery.getRelativeUrl(), message = ObjectMessage(object_relative_url= delivery.getRelativeUrl(),
simulation_movement = simulation_movement, simulation_movement = simulation_movement,
decision_value = d_quantity , decision_value = d_quantity ,
...@@ -85,8 +85,8 @@ class QuantityDivergenceTester(PropertyDivergenceTester): ...@@ -85,8 +85,8 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
message='Quantity', message='Quantity',
solver_script_list=self._splitStringList(solver_script_list) solver_script_list=self._splitStringList(solver_script_list)
) )
if quantity is None: if quantity is None:
if d_quantity is None: if d_quantity is None:
return [] return []
......
...@@ -1369,7 +1369,7 @@ class ERP5Generator(PortalGenerator): ...@@ -1369,7 +1369,7 @@ class ERP5Generator(PortalGenerator):
addMessageCatalog('default', 'ERP5 Localized Messages', ('en',)) addMessageCatalog('default', 'ERP5 Localized Messages', ('en',))
addMessageCatalog('erp5_ui', 'ERP5 Localized Interface', ('en',)) addMessageCatalog('erp5_ui', 'ERP5 Localized Interface', ('en',))
addMessageCatalog('erp5_content', 'ERP5 Localized Content', ('en',)) addMessageCatalog('erp5_content', 'ERP5 Localized Content', ('en',))
# Add an error_log # Add an error_log
if 'error_log' not in p.objectIds(): if 'error_log' not in p.objectIds():
manage_addErrorLog(p) manage_addErrorLog(p)
......
############################################################################## ##############################################################################
# #
# Copyright (c) 2002, 2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2002-2008 Nexedi SA and Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com> # Sebastien Robin <seb@nexedi.com>
# Yoshinori Okuji <yo@nexedi.com> # Yoshinori Okuji <yo@nexedi.com>
# Romain Courteaud <romain@nexedi.com> # Romain Courteaud <romain@nexedi.com>
......
############################################################################## ##############################################################################
# #
# Copyright (c) 2006 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2006-2008 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com> # Rafael Monnerat <rafael@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -41,6 +41,6 @@ class DivergenceTester: ...@@ -41,6 +41,6 @@ class DivergenceTester:
{ 'id' : 'solver_script', { 'id' : 'solver_script',
'description' : 'List of scripts used to call the solvers', 'description' : 'List of scripts used to call the solvers',
'type' : 'string', 'type' : 'string',
'multivalued' : 1, 'multivalued' : 1,
'mode' : 'w' }, 'mode' : 'w' },
) )
############################################################################## ##############################################################################
# #
# Copyright (c) 2004 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2004-2008 Nexedi SA and Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com> # Sebastien Robin <seb@nexedi.com>
# Jerome Perrin <jerome@nexedi.com> # Jerome Perrin <jerome@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -287,7 +287,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -287,7 +287,7 @@ class TestInvoice(TestInvoiceMixin):
resource_value=resource, resource_value=resource,
quantity=1, quantity=1,
price=2) price=2)
other_entity = self.portal.organisation_module.newContent( other_entity = self.portal.organisation_module.newContent(
portal_type='Organisation', portal_type='Organisation',
title='Other Entity') title='Other Entity')
...@@ -301,7 +301,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -301,7 +301,7 @@ class TestInvoice(TestInvoiceMixin):
delivery_movement = related_applied_rule.contentValues()[0] delivery_movement = related_applied_rule.contentValues()[0]
invoice_applied_rule = delivery_movement.contentValues()[0] invoice_applied_rule = delivery_movement.contentValues()[0]
invoice_movement = invoice_applied_rule.contentValues()[0] invoice_movement = invoice_applied_rule.contentValues()[0]
order_line.setSourceValue(other_entity) order_line.setSourceValue(other_entity)
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
...@@ -497,7 +497,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -497,7 +497,7 @@ class TestInvoice(TestInvoiceMixin):
invoice_transaction_applied_rule = invoice_movement.contentValues()[0] invoice_transaction_applied_rule = invoice_movement.contentValues()[0]
invoice_transaction_movement =\ invoice_transaction_movement =\
invoice_transaction_applied_rule._getOb('income') invoice_transaction_applied_rule._getOb('income')
order_line.setSourceSectionValue(other_entity) order_line.setSourceSectionValue(other_entity)
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
...@@ -655,7 +655,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -655,7 +655,7 @@ class TestInvoice(TestInvoiceMixin):
invoice.confirm() invoice.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = invoice.Invoice_viewAsODT() odt = invoice.Invoice_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
...@@ -719,7 +719,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -719,7 +719,7 @@ class TestInvoice(TestInvoiceMixin):
related_packing_list = order.getCausalityRelatedValue( related_packing_list = order.getCausalityRelatedValue(
portal_type=self.packing_list_portal_type) portal_type=self.packing_list_portal_type)
self.assertNotEquals(related_packing_list, None) self.assertNotEquals(related_packing_list, None)
related_packing_list.start() related_packing_list.start()
related_packing_list.stop() related_packing_list.stop()
get_transaction().commit() get_transaction().commit()
...@@ -733,7 +733,7 @@ class TestInvoice(TestInvoiceMixin): ...@@ -733,7 +733,7 @@ class TestInvoice(TestInvoiceMixin):
portal_type=self.invoice_line_portal_type) portal_type=self.invoice_line_portal_type)
self.assertEquals(1, len(line_list)) self.assertEquals(1, len(line_list))
invoice_line = line_list[0] invoice_line = line_list[0]
self.assertEquals(resource, invoice_line.getResourceValue()) self.assertEquals(resource, invoice_line.getResourceValue())
self.assertEquals(['size'], invoice_line.getVariationBaseCategoryList()) self.assertEquals(['size'], invoice_line.getVariationBaseCategoryList())
self.assertEquals(2, self.assertEquals(2,
...@@ -791,7 +791,7 @@ class TestSaleInvoiceMixin(TestInvoiceMixin, ...@@ -791,7 +791,7 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
invoice_line_portal_type = 'Invoice Line' invoice_line_portal_type = 'Invoice Line'
invoice_cell_portal_type = 'Invoice Cell' invoice_cell_portal_type = 'Invoice Cell'
invoice_transaction_line_portal_type = 'Sale Invoice Transaction Line' invoice_transaction_line_portal_type = 'Sale Invoice Transaction Line'
# default sequence for one line of not varianted resource. # default sequence for one line of not varianted resource.
PACKING_LIST_DEFAULT_SEQUENCE = """ PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateEntities stepCreateEntities
...@@ -1239,7 +1239,7 @@ class TestSaleInvoiceMixin(TestInvoiceMixin, ...@@ -1239,7 +1239,7 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
resource_precision = line.getResourceValue().getQuantityPrecision() resource_precision = line.getResourceValue().getQuantityPrecision()
self.assertEquals(round(line.getQuantity(), resource_precision), self.assertEquals(round(line.getQuantity(), resource_precision),
round(expected_price * line_ratio, resource_precision)) round(expected_price * line_ratio, resource_precision))
def stepCheckInvoiceLineHasReferenceAndIntIndex(self, sequence=None, **kw): def stepCheckInvoiceLineHasReferenceAndIntIndex(self, sequence=None, **kw):
"""Check that the unique invoice line in the invoice has reference and int """Check that the unique invoice line in the invoice has reference and int
index. index.
...@@ -1254,9 +1254,9 @@ class TestSaleInvoiceMixin(TestInvoiceMixin, ...@@ -1254,9 +1254,9 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
def stepCheckPackingListInvoice( def stepCheckPackingListInvoice(
self, sequence=None, sequence_list=None, **kw): self, sequence=None, sequence_list=None, **kw):
""" Checks if the delivery builder is working as expected, """ Checks if the delivery builder is working as expected,
coping the atributes from packing list to invoice.""" coping the atributes from packing list to invoice."""
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
related_invoice_list = packing_list.getCausalityRelatedValueList( related_invoice_list = packing_list.getCausalityRelatedValueList(
portal_type=self.invoice_portal_type) portal_type=self.invoice_portal_type)
self.assertEquals(len(related_invoice_list), 1) self.assertEquals(len(related_invoice_list), 1)
...@@ -2520,7 +2520,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase): ...@@ -2520,7 +2520,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase):
# We could generate a better reference here. # We could generate a better reference here.
self.assertEquals('1', invoice.getReference()) self.assertEquals('1', invoice.getReference())
def test_16_ManuallyAddedMovements(self, quiet=quiet, run=RUN_ALL_TESTS): def test_16_ManuallyAddedMovements(self, quiet=quiet, run=RUN_ALL_TESTS):
""" """
Checks that adding invoice lines and accounting lines to one invoice Checks that adding invoice lines and accounting lines to one invoice
......
############################################################################## ##############################################################################
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
# Copyright (c) 2004, 2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2004-2008 Nexedi SA and Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com> # Sebastien Robin <seb@nexedi.com>
# Romain Courteaud <romain@nexedi.com> # Romain Courteaud <romain@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -571,7 +571,7 @@ class TestOrderMixin: ...@@ -571,7 +571,7 @@ class TestOrderMixin:
self.assertEquals( order.getTotalPrice(fast = 0), self.assertEquals( order.getTotalPrice(fast = 0),
order.getTotalPrice(fast = 1) ) order.getTotalPrice(fast = 1) )
def stepCheckOrderTotalPriceAndQuantityFastParameter(self, def stepCheckOrderTotalPriceAndQuantityFastParameter(self,
sequence=None, sequence_list=None, **kw): sequence=None, sequence_list=None, **kw):
""" """
Check the method getTotalPrice on a order . Check the method getTotalPrice on a order .
...@@ -682,7 +682,7 @@ class TestOrderMixin: ...@@ -682,7 +682,7 @@ class TestOrderMixin:
""" """
self.checkOrderRuleSimulation(rule_id = 'default_order_rule', sequence=sequence, \ self.checkOrderRuleSimulation(rule_id = 'default_order_rule', sequence=sequence, \
sequence_list=sequence_list, **kw) sequence_list=sequence_list, **kw)
def checkOrderRuleSimulation(self, rule_id, sequence=None, sequence_list=None, **kw): def checkOrderRuleSimulation(self, rule_id, sequence=None, sequence_list=None, **kw):
""" """
Test if simulation is matching order, be sure that rule_id is used Test if simulation is matching order, be sure that rule_id is used
...@@ -953,7 +953,7 @@ class TestOrderMixin: ...@@ -953,7 +953,7 @@ class TestOrderMixin:
for applied_rule in related_applied_rule_list.keys(): for applied_rule in related_applied_rule_list.keys():
self.assertTrue(applied_rule.isStable()) self.assertTrue(applied_rule.isStable())
def stepPackingListAdoptPrevision(self,sequence=None, sequence_list=None, def stepPackingListAdoptPrevision(self,sequence=None, sequence_list=None,
**kw): **kw):
""" """
Check if simulation movement are disconnected Check if simulation movement are disconnected
...@@ -998,7 +998,7 @@ class TestOrderMixin: ...@@ -998,7 +998,7 @@ class TestOrderMixin:
variated_order_creation_without_tic = variated_order_line_creation + \ variated_order_creation_without_tic = variated_order_line_creation + \
variated_line_completion_without_tic variated_line_completion_without_tic
def stepCheckCatalogued(self, sequence=None, def stepCheckCatalogued(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Check that order is catalogued Check that order is catalogued
...@@ -1010,10 +1010,10 @@ class TestOrderMixin: ...@@ -1010,10 +1010,10 @@ class TestOrderMixin:
result = sql_connection.manage_test(sql) result = sql_connection.manage_test(sql)
simulation_state_list = [x['simulation_state'] for x in result] simulation_state_list = [x['simulation_state'] for x in result]
self.assertEquals(1, len(simulation_state_list)) self.assertEquals(1, len(simulation_state_list))
self.assertEquals(order.getSimulationState(), self.assertEquals(order.getSimulationState(),
simulation_state_list[0]) simulation_state_list[0])
def stepCheckCataloguedSimulation(self, sequence=None, def stepCheckCataloguedSimulation(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Check that simulation is catalogued Check that simulation is catalogued
...@@ -1027,7 +1027,7 @@ class TestOrderMixin: ...@@ -1027,7 +1027,7 @@ class TestOrderMixin:
result = sql_connection.manage_test(sql) result = sql_connection.manage_test(sql)
simulation_state_list = [x['simulation_state'] for x in result] simulation_state_list = [x['simulation_state'] for x in result]
self.assertEquals(1, len(simulation_state_list)) self.assertEquals(1, len(simulation_state_list))
self.assertEquals(order.getSimulationState(), self.assertEquals(order.getSimulationState(),
simulation_state_list[0]) simulation_state_list[0])
class TestOrder(TestOrderMixin, ERP5TypeTestCase): class TestOrder(TestOrderMixin, ERP5TypeTestCase):
...@@ -1883,7 +1883,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1883,7 +1883,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order_line = order.newContent(portal_type=self.order_line_portal_type) order_line = order.newContent(portal_type=self.order_line_portal_type)
self.assertEquals(1, len(order.getMovementList())) self.assertEquals(1, len(order.getMovementList()))
# If a sub line is created, its parent should not be considered # If a sub line is created, its parent should not be considered
# as a movement # as a movement
sub_order_line = order_line.newContent( sub_order_line = order_line.newContent(
portal_type=self.order_line_portal_type) portal_type=self.order_line_portal_type)
...@@ -1894,7 +1894,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1894,7 +1894,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type=self.order_line_portal_type) portal_type=self.order_line_portal_type)
self.assertEquals(2, len(order.getMovementList())) self.assertEquals(2, len(order.getMovementList()))
# Create recursively sub lines, and check that the ovement number # Create recursively sub lines, and check that the ovement number
# is still the same. # is still the same.
for i in range(5): for i in range(5):
sub_order_line = sub_order_line.newContent( sub_order_line = sub_order_line.newContent(
...@@ -1930,7 +1930,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1930,7 +1930,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
cell_key_list.sort() cell_key_list.sort()
for cell_key in cell_key_list: for cell_key in cell_key_list:
cell = sub_order_line.newCell(base_id=base_id, cell = sub_order_line.newCell(base_id=base_id,
portal_type=self.order_cell_portal_type, portal_type=self.order_cell_portal_type,
*cell_key) *cell_key)
self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList())) self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList()))
...@@ -1944,7 +1944,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -1944,7 +1944,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
cell_key_list.sort() cell_key_list.sort()
for cell_key in cell_key_list: for cell_key in cell_key_list:
cell = order_line.newCell(base_id=base_id, cell = order_line.newCell(base_id=base_id,
portal_type=self.order_cell_portal_type, portal_type=self.order_cell_portal_type,
*cell_key) *cell_key)
self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList())) self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList()))
...@@ -2002,7 +2002,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2002,7 +2002,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
cell_key = order_line.getCellKeyList(base_id=base_id)[0] cell_key = order_line.getCellKeyList(base_id=base_id)[0]
cell = order_line.newCell( cell = order_line.newCell(
base_id=base_id, base_id=base_id,
portal_type=self.order_cell_portal_type, portal_type=self.order_cell_portal_type,
*cell_key) *cell_key)
cell.edit(mapped_value_property_list=['price', 'quantity'], cell.edit(mapped_value_property_list=['price', 'quantity'],
price=3, quantity=4, price=3, quantity=4,
...@@ -2121,7 +2121,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2121,7 +2121,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sub_cell_key = sub_order_line.getCellKeyList(base_id=base_id)[0] sub_cell_key = sub_order_line.getCellKeyList(base_id=base_id)[0]
sub_cell = sub_order_line.newCell( sub_cell = sub_order_line.newCell(
base_id=base_id, base_id=base_id,
portal_type=self.order_cell_portal_type, portal_type=self.order_cell_portal_type,
*cell_key) *cell_key)
sub_cell.edit(mapped_value_property_list=['price', 'quantity'], sub_cell.edit(mapped_value_property_list=['price', 'quantity'],
price=5, quantity=6, price=5, quantity=6,
...@@ -2220,7 +2220,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2220,7 +2220,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
title="Sub Order Line") title="Sub Order Line")
sequence.edit(order_line=order_line) sequence.edit(order_line=order_line)
def test_20_testHierarchicalOrderAppliedRuleGeneration(self, quiet=0, def test_20_testHierarchicalOrderAppliedRuleGeneration(self, quiet=0,
run=run_all_test): run=run_all_test):
""" """
Test generation and update of an hierarchical order applied rule. Test generation and update of an hierarchical order applied rule.
...@@ -2286,7 +2286,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2286,7 +2286,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self) sequence_list.play(self)
def test_order_cell_getTotalPrice(self): def test_order_cell_getTotalPrice(self):
# test getTotalPrice and getTotalQuantity on a line with cells # test getTotalPrice and getTotalQuantity on a line with cells
# More precisely, it tests a previous bug where creating a line with # More precisely, it tests a previous bug where creating a line with
...@@ -2315,7 +2315,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2315,7 +2315,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
self.assertEquals(0, line.getTotalPrice()) self.assertEquals(0, line.getTotalPrice())
self.assertEquals(0, order.getTotalQuantity()) self.assertEquals(0, order.getTotalQuantity())
self.assertEquals(0, order.getTotalPrice()) self.assertEquals(0, order.getTotalPrice())
self.assertTrue(line.hasInRange('size/Baby', base_id='movement')) self.assertTrue(line.hasInRange('size/Baby', base_id='movement'))
cell_baby = line.newCell('size/Baby', base_id='movement', cell_baby = line.newCell('size/Baby', base_id='movement',
portal_type=self.order_cell_portal_type) portal_type=self.order_cell_portal_type)
...@@ -2408,7 +2408,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2408,7 +2408,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm() order.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = order.Order_viewAsODT() odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
...@@ -2440,7 +2440,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2440,7 +2440,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm() order.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = order.Order_viewAsODT() odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
...@@ -2477,7 +2477,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2477,7 +2477,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm() order.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = order.Order_viewAsODT() odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
...@@ -2517,7 +2517,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2517,7 +2517,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm() order.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = order.Order_viewAsODT() odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
...@@ -2559,7 +2559,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2559,7 +2559,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm() order.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = order.Order_viewAsODT() odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
...@@ -2586,7 +2586,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2586,7 +2586,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
destination_section_value=client) destination_section_value=client)
line = order.newContent(portal_type=self.order_line_portal_type, line = order.newContent(portal_type=self.order_line_portal_type,
description='Content') description='Content')
if self.order_line_portal_type not in [x.getId() for x in if self.order_line_portal_type not in [x.getId() for x in
line.allowedContentTypes()]: line.allowedContentTypes()]:
return # skip this test if hierarchical orders are not available (eg. return # skip this test if hierarchical orders are not available (eg.
# for Purchase Order) # for Purchase Order)
...@@ -2598,7 +2598,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase): ...@@ -2598,7 +2598,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm() order.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = order.Order_viewAsODT() odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
......
############################################################################## ##############################################################################
# -*- coding: utf8 -*- # -*- coding: utf8 -*-
# #
# Copyright (c) 2008 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
# Łukasz Nowak <lukasz.nowak@ventis.com.pl> # Łukasz Nowak <lukasz.nowak@ventis.com.pl>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -65,7 +65,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -65,7 +65,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
max_delay = 0.0 max_delay = 0.0
min_flow = 0.0 min_flow = 0.0
def stepClearActivities(self, sequence=None, sequence_list=None, def stepClearActivities(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Clear activity tables Clear activity tables
...@@ -73,7 +73,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -73,7 +73,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
activity_tool = self.getPortal().portal_activities activity_tool = self.getPortal().portal_activities
activity_tool.manageClearActivities(keep=0) activity_tool.manageClearActivities(keep=0)
def stepSetMaxDelayOnResource(self, sequence=None, sequence_list=None, def stepSetMaxDelayOnResource(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Sets max_delay on resource Sets max_delay on resource
...@@ -84,7 +84,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -84,7 +84,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
max_delay = self.max_delay, max_delay = self.max_delay,
) )
def stepSetMinFlowOnResource(self, sequence=None, sequence_list=None, def stepSetMinFlowOnResource(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Sets min_flow on resource Sets min_flow on resource
...@@ -95,7 +95,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -95,7 +95,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
min_flow = self.min_flow, min_flow = self.min_flow,
) )
def stepFillOrderBuilder(self, sequence=None, sequence_list=None, def stepFillOrderBuilder(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Fills Order Builder with proper quantites Fills Order Builder with proper quantites
...@@ -118,7 +118,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -118,7 +118,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
resource_portal_type = self.resource_portal_type, resource_portal_type = self.resource_portal_type,
) )
def stepCheckGeneratedDocumentListVariated(self, sequence=None, sequence_list=None, def stepCheckGeneratedDocumentListVariated(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Checks documents generated by Order Builders with its properties for variated resource Checks documents generated by Order Builders with its properties for variated resource
...@@ -133,9 +133,9 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -133,9 +133,9 @@ class TestOrderBuilderMixin(TestOrderMixin):
1, # XXX 1, # XXX
len(generated_document_list) len(generated_document_list)
) )
order = generated_document_list[0] order = generated_document_list[0]
self.assertEquals( self.assertEquals(
order.getDestinationValue(), order.getDestinationValue(),
organisation organisation
...@@ -174,7 +174,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -174,7 +174,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
len(order_cell_list), len(order_cell_list),
len(self.wanted_quantity_matrix.itervalues()) len(self.wanted_quantity_matrix.itervalues())
) )
for order_cell in order_cell_list: for order_cell in order_cell_list:
self.assertEquals( self.assertEquals(
order_cell.getQuantity(), order_cell.getQuantity(),
...@@ -183,7 +183,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -183,7 +183,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
] ]
) )
def stepCheckGeneratedDocumentList(self, sequence=None, sequence_list=None, def stepCheckGeneratedDocumentList(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Checks documents generated by Order Builders with its properties Checks documents generated by Order Builders with its properties
...@@ -198,9 +198,9 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -198,9 +198,9 @@ class TestOrderBuilderMixin(TestOrderMixin):
1, # XXX 1, # XXX
len(generated_document_list) len(generated_document_list)
) )
order = generated_document_list[0] order = generated_document_list[0]
self.assertEquals( self.assertEquals(
order.getDestinationValue(), order.getDestinationValue(),
organisation organisation
...@@ -233,8 +233,8 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -233,8 +233,8 @@ class TestOrderBuilderMixin(TestOrderMixin):
order_line.getTotalQuantity(), order_line.getTotalQuantity(),
self.wanted_quantity self.wanted_quantity
) )
def stepBuildOrderBuilder(self, sequence=None, sequence_list=None, def stepBuildOrderBuilder(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Invokes build method for Order Builder Invokes build method for Order Builder
...@@ -243,7 +243,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -243,7 +243,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
generated_document_list = order_builder.build() generated_document_list = order_builder.build()
sequence.edit(generated_document_list = generated_document_list) sequence.edit(generated_document_list = generated_document_list)
def stepCreateOrderBuilder(self, sequence=None, sequence_list=None, def stepCreateOrderBuilder(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Creates empty Order Builder Creates empty Order Builder
...@@ -258,7 +258,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -258,7 +258,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
order_builder = order_builder order_builder = order_builder
) )
def stepDecreaseOrganisationResourceQuantityVariated(self, sequence=None, sequence_list=None, def stepDecreaseOrganisationResourceQuantityVariated(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Creates movement with variation from organisation to None. Creates movement with variation from organisation to None.
...@@ -268,7 +268,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -268,7 +268,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
""" """
organisation = sequence.get('organisation') organisation = sequence.get('organisation')
resource = sequence.get('resource') resource = sequence.get('resource')
packing_list_module = self.portal.getDefaultModule( packing_list_module = self.portal.getDefaultModule(
portal_type = self.packing_list_portal_type portal_type = self.packing_list_portal_type
) )
...@@ -288,7 +288,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -288,7 +288,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
packing_list_line.setVariationCategoryList( packing_list_line.setVariationCategoryList(
list(self.decrease_quantity_matrix.iterkeys()) list(self.decrease_quantity_matrix.iterkeys())
) )
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
...@@ -306,7 +306,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -306,7 +306,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
packing_list.confirm() packing_list.confirm()
def stepDecreaseOrganisationResourceQuantity(self, sequence=None, sequence_list=None, def stepDecreaseOrganisationResourceQuantity(self, sequence=None, sequence_list=None,
**kw): **kw):
""" """
Creates movement from organisation to None. Creates movement from organisation to None.
...@@ -316,7 +316,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -316,7 +316,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
""" """
organisation = sequence.get('organisation') organisation = sequence.get('organisation')
resource = sequence.get('resource') resource = sequence.get('resource')
packing_list_module = self.portal.getDefaultModule( packing_list_module = self.portal.getDefaultModule(
portal_type = self.packing_list_portal_type portal_type = self.packing_list_portal_type
) )
...@@ -334,7 +334,7 @@ class TestOrderBuilderMixin(TestOrderMixin): ...@@ -334,7 +334,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
) )
packing_list.confirm() packing_list.confirm()
class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase): class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
""" """
Test Order Builder functionality Test Order Builder functionality
...@@ -369,10 +369,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase): ...@@ -369,10 +369,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.wanted_quantity = 1.0 self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \ self.wanted_start_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff + self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.datetime.earliestTime() \ self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff + self.order_builder_hardcoded_time_diff
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_list.addSequenceString(self.common_sequence_string) sequence_list.addSequenceString(self.common_sequence_string)
...@@ -403,10 +403,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase): ...@@ -403,10 +403,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.wanted_quantity = 1.0 self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \ self.wanted_start_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff + self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.datetime.earliestTime() \ self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff + self.order_builder_hardcoded_time_diff
self.decrease_quantity_matrix = { self.decrease_quantity_matrix = {
'size/Man' : 1.0, 'size/Man' : 1.0,
...@@ -430,10 +430,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase): ...@@ -430,10 +430,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.wanted_quantity = 1.0 self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \ self.wanted_start_date = self.datetime.earliestTime() \
- self.max_delay \ - self.max_delay \
+ self.order_builder_hardcoded_time_diff + self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.datetime.earliestTime() \ self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff + self.order_builder_hardcoded_time_diff
sequence_list = SequenceList() sequence_list = SequenceList()
sequence_list.addSequenceString(self.common_sequence_string) sequence_list.addSequenceString(self.common_sequence_string)
......
############################################################################## ##############################################################################
# #
# Copyright (c) 2004, 2005 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2004-2008 Nexedi SA and Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com> # Sebastien Robin <seb@nexedi.com>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -35,7 +35,7 @@ from testOrder import TestOrderMixin ...@@ -35,7 +35,7 @@ from testOrder import TestOrderMixin
class TestPackingListMixin(TestOrderMixin): class TestPackingListMixin(TestOrderMixin):
""" """
Test business template erp5_trade Test business template erp5_trade
""" """
container_portal_type = 'Container' container_portal_type = 'Container'
container_line_portal_type = 'Container Line' container_line_portal_type = 'Container Line'
...@@ -126,7 +126,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -126,7 +126,7 @@ class TestPackingListMixin(TestOrderMixin):
def enableLightInstall(self): def enableLightInstall(self):
""" """
You can override this. You can override this.
Return if we should do a light install (1) or not (0) Return if we should do a light install (1) or not (0)
""" """
return 1 return 1
...@@ -160,7 +160,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -160,7 +160,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(packing_list.getPriceCurrency(), \ self.assertEquals(packing_list.getPriceCurrency(), \
order.getPriceCurrency()) order.getPriceCurrency())
def stepCheckPackingListIsDivergent(self, sequence=None, sequence_list=None, def stepCheckPackingListIsDivergent(self, sequence=None, sequence_list=None,
packing_list=None,**kw): packing_list=None,**kw):
""" """
Test if packing list is divergent Test if packing list is divergent
...@@ -206,7 +206,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -206,7 +206,7 @@ class TestPackingListMixin(TestOrderMixin):
packing_list = sequence.get('packing_list') packing_list = sequence.get('packing_list')
self.assertFalse(packing_list.isDivergent()) self.assertFalse(packing_list.isDivergent())
def stepChangePackingListLineResource(self, sequence=None, def stepChangePackingListLineResource(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Change the resource of the packing list. Change the resource of the packing list.
...@@ -344,7 +344,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -344,7 +344,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(self.default_quantity, self.assertEquals(self.default_quantity,
simulation_movement.getCorrectedQuantity()) simulation_movement.getCorrectedQuantity())
def stepChangePackingListDestination(self, sequence=None, def stepChangePackingListDestination(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
""" """
Test if packing list is divergent Test if packing list is divergent
...@@ -453,7 +453,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -453,7 +453,7 @@ class TestPackingListMixin(TestOrderMixin):
packing_list_line = sequence.get('packing_list_line') packing_list_line = sequence.get('packing_list_line')
for simulation_line in simulation_line_list: for simulation_line in simulation_line_list:
self.assertEquals(simulation_line.getDeliveryValue(),packing_list_line) self.assertEquals(simulation_line.getDeliveryValue(),packing_list_line)
self.assertEquals(packing_list_line.getCausalityValue(), self.assertEquals(packing_list_line.getCausalityValue(),
simulation_line.getOrderValue()) simulation_line.getOrderValue())
def stepCheckSimulationDisconnected(self,sequence=None, sequence_list=None, **kw): def stepCheckSimulationDisconnected(self,sequence=None, sequence_list=None, **kw):
...@@ -497,7 +497,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -497,7 +497,7 @@ class TestPackingListMixin(TestOrderMixin):
for simulation_line in simulation_line_list: for simulation_line in simulation_line_list:
simulation_line.edit(start_date=self.datetime+15) simulation_line.edit(start_date=self.datetime+15)
def stepAdoptPrevision(self,sequence=None, sequence_list=None, def stepAdoptPrevision(self,sequence=None, sequence_list=None,
packing_list=None,**kw): packing_list=None,**kw):
""" """
Check if simulation movement are disconnected Check if simulation movement are disconnected
...@@ -560,7 +560,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -560,7 +560,7 @@ class TestPackingListMixin(TestOrderMixin):
# self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid()) # self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid())
self.assertEquals(len(delivery_value_list),len(resource_list)) self.assertEquals(len(delivery_value_list),len(resource_list))
def stepAddPackingListContainer(self,sequence=None, def stepAddPackingListContainer(self,sequence=None,
packing_list=None,sequence_list=None, **kw): packing_list=None,sequence_list=None, **kw):
""" """
Check if simulation movement are disconnected Check if simulation movement are disconnected
...@@ -596,7 +596,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -596,7 +596,7 @@ class TestPackingListMixin(TestOrderMixin):
container_line = sequence.get('container_line') container_line = sequence.get('container_line')
container_line.edit(quantity=self.default_quantity-1) container_line.edit(quantity=self.default_quantity-1)
def stepSetContainerLineFullQuantity(self,sequence=None, sequence_list=None, def stepSetContainerLineFullQuantity(self,sequence=None, sequence_list=None,
quantity=None,**kw): quantity=None,**kw):
""" """
Check if simulation movement are disconnected Check if simulation movement are disconnected
...@@ -607,7 +607,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -607,7 +607,7 @@ class TestPackingListMixin(TestOrderMixin):
container_line.edit(quantity=quantity) container_line.edit(quantity=quantity)
container_line.immediateReindexObject() container_line.immediateReindexObject()
def stepSetContainerFullQuantity(self,sequence=None, sequence_list=None, def stepSetContainerFullQuantity(self,sequence=None, sequence_list=None,
quantity=None,**kw): quantity=None,**kw):
""" """
Really fills the container Really fills the container
...@@ -657,7 +657,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -657,7 +657,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(0,packing_list.isPacked()) self.assertEquals(0,packing_list.isPacked())
self.assertEquals('missing',packing_list.getContainerState()) self.assertEquals('missing',packing_list.getContainerState())
def stepCheckPackingListIsPacked(self,sequence=None, sequence_list=None, def stepCheckPackingListIsPacked(self,sequence=None, sequence_list=None,
packing_list=None,**kw): packing_list=None,**kw):
""" """
Check that the number of objects in containers are Check that the number of objects in containers are
...@@ -690,7 +690,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -690,7 +690,7 @@ class TestPackingListMixin(TestOrderMixin):
else: else:
currency = currency_module._getOb('EUR') currency = currency_module._getOb('EUR')
sequence.edit(currency=currency) sequence.edit(currency=currency)
def stepSetOrderPriceCurrency(self, sequence, **kw) : def stepSetOrderPriceCurrency(self, sequence, **kw) :
"""Set the price currency of the order. """Set the price currency of the order.
...@@ -703,7 +703,7 @@ class TestPackingListMixin(TestOrderMixin): ...@@ -703,7 +703,7 @@ class TestPackingListMixin(TestOrderMixin):
order.setPriceCurrency(currency.getRelativeUrl()) order.setPriceCurrency(currency.getRelativeUrl())
class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
run_all_test = 1 run_all_test = 1
...@@ -940,7 +940,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -940,7 +940,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
' '
# XXX Check if there is a new packing list created # XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string) sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet) sequence_list.play(self, quiet=quiet)
def test_10_PackingListIncreaseQuantity(self, quiet=quiet, run=run_all_test): def test_10_PackingListIncreaseQuantity(self, quiet=quiet, run=run_all_test):
...@@ -1037,7 +1037,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -1037,7 +1037,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
pl = self.getPortal().getDefaultModule(self.packing_list_portal_type pl = self.getPortal().getDefaultModule(self.packing_list_portal_type
).newContent(portal_type=self.packing_list_portal_type) ).newContent(portal_type=self.packing_list_portal_type)
self.failUnless(hasattr(pl, 'getPriceCurrency')) self.failUnless(hasattr(pl, 'getPriceCurrency'))
def test_PackingList_viewAsODT(self): def test_PackingList_viewAsODT(self):
# tests packing list printout # tests packing list printout
resource = self.portal.getDefaultModule( resource = self.portal.getDefaultModule(
...@@ -1063,14 +1063,14 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) : ...@@ -1063,14 +1063,14 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
packing_list.confirm() packing_list.confirm()
get_transaction().commit() get_transaction().commit()
self.tic() self.tic()
odt = packing_list.PackingList_viewAsODT() odt = packing_list.PackingList_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator() odf_validator = Validator()
err_list = odf_validator.validate(odt) err_list = odf_validator.validate(odt)
if err_list: if err_list:
self.fail(''.join(err_list)) self.fail(''.join(err_list))
class TestPurchasePackingListMixin(TestPackingListMixin): class TestPurchasePackingListMixin(TestPackingListMixin):
"""Mixing class with steps to test purchase packing lists. """Mixing class with steps to test purchase packing lists.
...@@ -1085,7 +1085,7 @@ class TestPurchasePackingListMixin(TestPackingListMixin): ...@@ -1085,7 +1085,7 @@ class TestPurchasePackingListMixin(TestPackingListMixin):
container_portal_type = None container_portal_type = None
container_line_portal_type = None container_line_portal_type = None
container_cell_portal_type = None container_cell_portal_type = None
# all steps related to packing and container does not apply on purchase # all steps related to packing and container does not apply on purchase
def ignored_step(self, **kw): def ignored_step(self, **kw):
return return
......
This diff is collapsed.
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
############################################################################## ##############################################################################
# #
# Copyright (c) 2008 Nexedi SARL and Contributors. All Rights Reserved. # Copyright (c) 2008 Nexedi SA and Contributors. All Rights Reserved.
# Łukasz Nowak <lukasz.nowak@ventis.com.pl> # Łukasz Nowak <lukasz.nowak@ventis.com.pl>
# #
# WARNING: This program as such is intended to be used by professional # WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential # programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs # consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial # End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software # guarantees and support are strongly adviced to contract a Free Software
# Service Company # Service Company
# #
# This program is Free Software; you can redistribute it and/or # This program is Free Software; you can redistribute it and/or
...@@ -153,7 +153,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking ...@@ -153,7 +153,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking
def stepDecreaseProducedDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw): def stepDecreaseProducedDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw):
packing_list = sequence.get('produced_delivery_packing_list') packing_list = sequence.get('produced_delivery_packing_list')
for line in packing_list.getMovementList(): for line in packing_list.getMovementList():
line.edit( line.edit(
quantity = line.getQuantity() - 1.0 quantity = line.getQuantity() - 1.0
...@@ -161,7 +161,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking ...@@ -161,7 +161,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking
def stepDecreaseSupplyDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw): def stepDecreaseSupplyDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw):
packing_list = sequence.get('supply_delivery_packing_list') packing_list = sequence.get('supply_delivery_packing_list')
for line in packing_list.getMovementList(): for line in packing_list.getMovementList():
line.edit( line.edit(
quantity = line.getQuantity() - 1.0 quantity = line.getQuantity() - 1.0
...@@ -208,7 +208,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking ...@@ -208,7 +208,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking
supply_movement.getSimulationState(), supply_movement.getSimulationState(),
supply_delivery_packing_list.getSimulationState() supply_delivery_packing_list.getSimulationState()
) )
self.assertEquals( self.assertEquals(
produced_movement.getSimulationState(), produced_movement.getSimulationState(),
produced_report.getSimulationState() produced_report.getSimulationState()
...@@ -403,7 +403,7 @@ class TestProductionDelivery(TestProductionPackingReportListMixin): ...@@ -403,7 +403,7 @@ class TestProductionDelivery(TestProductionPackingReportListMixin):
self.transformation_portal_type, self.transformation_portal_type,
self.resource_portal_type,) self.resource_portal_type,)
def test_01_sourcingDelivery(self, quiet=0, def test_01_sourcingDelivery(self, quiet=0,
run=run_all_test): run=run_all_test):
""" """
Test for sourcing type of delivery (Production Report and Production Packing Lists). Test for sourcing type of delivery (Production Report and Production Packing Lists).
......
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