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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -35,7 +35,7 @@ from Products.ERP5.Document.PropertyDivergenceTester import \
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
for some specific categories.
"""
......@@ -44,7 +44,7 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......@@ -60,7 +60,7 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
, PropertySheet.DivergenceTester
)
def explain(self, simulation_movement):
"""
This method returns a list of messages that contains
......@@ -83,21 +83,21 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
delivery_mvt.getPropertyList(tested_property_id)
simulation_category_list = \
simulation_movement.getPropertyList(tested_property_id)
# XXX Don't we need to check the order too ?
delivery_mvt_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 = []
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.getPortalType() == 'Category':
delivery_mvt_category_title_list.append(category_value.getTranslatedTitle())
else:
delivery_mvt_category_title_list.append(category_value.getTitle())
simulation_category_title_list = []
for mvt_category in simulation_category_list:
category_value = delivery_mvt.resolveCategory(mvt_category)
......@@ -106,20 +106,20 @@ class CategoryDivergenceTester(PropertyDivergenceTester):
simulation_category_title_list.append(category_value.getTranslatedTitle())
else:
simulation_category_title_list.append(category_value.getTitle())
delivery_mvt_property = ' , '.join(delivery_mvt_category_title_list)
simulation_mvt_property = ' , '.join(simulation_category_title_list)
message = ObjectMessage(
object_relative_url=delivery_mvt.getRelativeUrl(),
object_relative_url=delivery_mvt.getRelativeUrl(),
simulation_movement=simulation_movement,
decision_value=delivery_mvt_property ,
prevision_value=simulation_mvt_property,
tested_property=tested_property_id,
tested_property=tested_property_id,
message=tested_property_title,
solver_script_list=solver_script_list
)
divergence_message_list.append(message)
divergence_message_list.append(message)
return divergence_message_list
##############################################################################
#
# Copyright (c) 2002, 2005 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2002-2008 Nexedi SA and Contributors. All Rights Reserved.
# Jean-Paul Smets-Solanes <jp@nexedi.com>
# Romain Courteaud <romain@nexedi.com>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -140,7 +140,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['portal_type'] = self.getPortalTaxMovementTypeList()
return total_price + self.getTotalPrice(fast=fast, src__=src__, **kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getTotalQuantity')
def getTotalQuantity(self, fast=0, src__=0, **kw):
""" Returns the total quantity of this order.
......@@ -294,7 +294,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
return 0
# else Do we need to create a simulation movement ? XXX probably not
return 1
security.declareProtected(Permissions.View, 'isDivergent')
def isDivergent(self, fast=0, **kw):
"""
......@@ -440,7 +440,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
resource_dict[r] = 1
return resource_dict.keys()
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getInventory')
def getInventory(self, **kw):
"""
......@@ -449,7 +449,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventory')
def getCurrentInventory(self, **kw):
"""
......@@ -458,7 +458,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getCurrentInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getAvailableInventory')
def getAvailableInventory(self, **kw):
"""
......@@ -468,7 +468,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getAvailableInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventory')
def getFutureInventory(self, **kw):
"""
......@@ -477,7 +477,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getFutureInventory(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryList')
def getInventoryList(self, **kw):
"""
......@@ -486,7 +486,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryList')
def getCurrentInventoryList(self, **kw):
"""
......@@ -495,7 +495,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getCurrentInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryList')
def getFutureInventoryList(self, **kw):
"""
......@@ -504,7 +504,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getFutureInventoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryStat')
def getInventoryStat(self, **kw):
"""
......@@ -513,7 +513,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryStat')
def getCurrentInventoryStat(self, **kw):
"""
......@@ -522,7 +522,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getCurrentInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryStat')
def getFutureInventoryStat(self, **kw):
"""
......@@ -531,7 +531,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getFutureInventoryStat(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryChart')
def getInventoryChart(self, **kw):
"""
......@@ -540,7 +540,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getCurrentInventoryChart')
def getCurrentInventoryChart(self, **kw):
"""
......@@ -549,7 +549,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getCurrentInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getFutureInventoryChart')
def getFutureInventoryChart(self, **kw):
"""
......@@ -558,7 +558,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getFutureInventoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryHistoryList')
def getInventoryHistoryList(self, **kw):
"""
......@@ -567,7 +567,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getInventoryHistoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getInventoryHistoryChart')
def getInventoryHistoryChart(self, **kw):
"""
......@@ -576,7 +576,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getInventoryHistoryChart(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getMovementHistoryList')
def getMovementHistoryList(self, **kw):
"""
......@@ -585,7 +585,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
kw['resource'] = self._getMovementResourceList()
return self.portal_simulation.getMovementHistoryList(**kw)
security.declareProtected(Permissions.AccessContentsInformation,
security.declareProtected(Permissions.AccessContentsInformation,
'getMovementHistoryStat')
def getMovementHistoryStat(self, **kw):
"""
......@@ -607,7 +607,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
# """
# kw['category'] = self._getMovementResourceList()
# return self.portal_simulation.getInventoryAssetPrice(**kw)
#
#
# security.declareProtected(Permissions.AccessContentsInformation, 'getFutureInventoryAssetPrice')
# def getFutureInventoryAssetPrice(self, **kw):
# """
......@@ -615,7 +615,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
# """
# kw['category'] = self._getMovementResourceList()
# return self.portal_simulation.getFutureInventoryAssetPrice(**kw)
#
#
# security.declareProtected(Permissions.AccessContentsInformation, 'getCurrentInventoryAssetPrice')
# def getCurrentInventoryAssetPrice(self, **kw):
# """
......@@ -623,7 +623,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
# """
# kw['category'] = self._getMovementResourceList()
# return self.portal_simulation.getCurrentInventoryAssetPrice(**kw)
#
#
# security.declareProtected(Permissions.AccessContentsInformation, 'getAvailableInventoryAssetPrice')
# def getAvailableInventoryAssetPrice(self, **kw):
# """
......@@ -704,8 +704,8 @@ class Delivery(XMLObject, ImmobilisationDelivery):
portal_type='Applied Rule')
my_applied_rule = None
if len(my_applied_rule_list) == 0:
if self.isSimulated():
# No need to create a DeliveryRule
if self.isSimulated():
# No need to create a DeliveryRule
# if we are already in the simulation process
pass
else:
......@@ -743,7 +743,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
def expand(self, *args,**kw):
"""
Reexpand applied rule
Also reexpand all rules related to movements
"""
expand = UnrestrictedMethod(self._expand)
......@@ -820,7 +820,7 @@ class Delivery(XMLObject, ImmobilisationDelivery):
# (e.g. item)
if hasattr(causality, 'getRootCausalityValueList'):
tmp_causality_list = causality.getRootCausalityValueList()
initial_list.extend([x for x in tmp_causality_list
initial_list.extend([x for x in tmp_causality_list
if x not in initial_list])
return initial_list
......
##############################################################################
#
# 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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -43,38 +43,38 @@ class SelectMovementError(Exception): pass
class DeliveryBuilder(OrderBuilder):
"""
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
summing quantities of related Simulation Movements.
Delivery Builders are called for example whenever an order is confirmed.
They are also called globaly in order to gather any confirmed or above
Simulation Movement which was not associated to any Delivery Line.
They are also called globaly in order to gather any confirmed or above
Simulation Movement which was not associated to any Delivery Line.
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:
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.
simulation_select_method which defines how to query all Simulation
Movements which meet certain criteria (including the above path path
simulation_select_method which defines how to query all Simulation
Movements which meet certain criteria (including the above path path
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.
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.
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.
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
or to Simulation Movements related to a limited set of existing
or to Simulation Movements related to a limited set of existing
Deliveries.
"""
......@@ -103,7 +103,7 @@ class DeliveryBuilder(OrderBuilder):
done before building Delivery.
"""
pass
def searchMovementList(self, applied_rule_uid=None,**kw):
"""
defines how to query all Simulation Movements which meet certain criteria
......@@ -157,7 +157,7 @@ class DeliveryBuilder(OrderBuilder):
and delivery movement.
"""
OrderBuilder._setDeliveryMovementProperties(
self, delivery_movement,
self, delivery_movement,
simulation_movement, property_dict,
update_existing_movement=update_existing_movement)
# Check if simulation movement is not already linked to a existing
......@@ -170,11 +170,11 @@ class DeliveryBuilder(OrderBuilder):
simulation_movement.edit(delivery_value=delivery_movement)
# Simulation consistency propagation
security.declareProtected(Permissions.ModifyPortalContent,
security.declareProtected(Permissions.ModifyPortalContent,
'updateFromSimulation')
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.
"""
updateFromSimulation = UnrestrictedMethod(self._updateFromSimulation)
......@@ -194,7 +194,7 @@ class DeliveryBuilder(OrderBuilder):
for simulation_movement in movement.getDeliveryRelatedValueList(
portal_type="Simulation Movement"):
simulation_movement.setDelivery(None)
simulation_movement_list.append(simulation_movement)
simulation_movement_list.append(simulation_movement)
# Collect
root_group = self.collectMovement(simulation_movement_list)
......@@ -259,7 +259,7 @@ class DeliveryBuilder(OrderBuilder):
rejected_movement_list.extend(group.getMovementList())
movement_group = movement_group.getGroupList()[0]
property_dict.update(movement_group.getGroupEditDict())
# Put properties on delivery
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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -42,33 +42,33 @@ class MatrixError(Exception): pass
class OrderBuilder(XMLObject, Amount, Predicate):
"""
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
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:
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.
simulation_select_method which defines how to query all Simulation
Movements which meet certain criteria (including the above path path
simulation_select_method which defines how to query all Simulation
Movements which meet certain criteria (including the above path path
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.
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.
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.
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
or to Simulation Movements related to a limited set of existing
or to Simulation Movements related to a limited set of existing
Deliveries.
"""
......@@ -90,7 +90,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
, PropertySheet.Comment
, PropertySheet.DeliveryBuilder
)
security.declarePublic('build')
def build(self, applied_rule_uid=None, movement_relative_url_list=None,
delivery_relative_url_list=None,**kw):
......@@ -129,10 +129,10 @@ class OrderBuilder(XMLObject, Amount, Predicate):
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.
This part can only be done with a script, because user may want
to keep existing auto_planned Order, and only update lines in
This part can only be done with a script, because user may want
to keep existing auto_planned Order, and only update lines in
them.
No activities are used when deleting a object, so, current
implementation should be OK.
......@@ -147,9 +147,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
"""
Defines how to query all Simulation Movements which meet certain
criteria (including the above path path definition).
First, select movement matching to criteria define on
First, select movement matching to criteria define on
DeliveryBuilder.
Then, call script simulation_select_method to restrict
Then, call script simulation_select_method to restrict
movement_list.
"""
from Products.ERP5Type.Document import newTempMovement
......@@ -175,7 +175,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
if (inventory_item.inventory is not None):
dumb_movement = inventory_item.getObject()
# Create temporary movement
movement = newTempMovement(self.getPortalObject(),
movement = newTempMovement(self.getPortalObject(),
str(id_count))
id_count += 1
movement.edit(
......@@ -224,7 +224,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
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,....
movement_list : the list of movement wich we want to group
check_list : the list of classes used to group movements. The order
......@@ -295,7 +295,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
**kw)
return delivery_list
def _deliveryGroupProcessing(self, delivery_module, movement_group,
def _deliveryGroupProcessing(self, delivery_module, movement_group,
collect_order_list, property_dict,
delivery_to_update_list=None,
activate_kw=None,**kw):
......@@ -321,7 +321,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
activate_kw=activate_kw)
delivery_list.extend(new_delivery_list)
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
delivery = None
for delivery_to_update in delivery_to_update_list:
......@@ -352,7 +352,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
activate_kw=activate_kw,**kw)
delivery_list.append(delivery)
return delivery_list
def _deliveryLineGroupProcessing(self, delivery, movement_group,
collect_order_list, property_dict,
activate_kw=None,**kw):
......@@ -403,7 +403,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Then, create delivery movement (delivery cell or complete delivery
# line)
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
if list(group_list) != []:
for group in group_list:
......@@ -438,9 +438,9 @@ class OrderBuilder(XMLObject, Amount, Predicate):
# Get sorted movement for each delivery line
for group in movement_group.getGroupList():
self._deliveryCellGroupProcessing(
delivery_line,
group,
collect_order_list[1:],
delivery_line,
group,
collect_order_list[1:],
property_dict.copy(),
update_existing_line=update_existing_line,
activate_kw=activate_kw)
......@@ -473,7 +473,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
cell = delivery_line.getCell(base_id=base_id, *cell_key)
if self.testObjectProperties(cell, property_dict):
# 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.
update_existing_movement = 1
object_to_update = cell
......@@ -484,7 +484,7 @@ class OrderBuilder(XMLObject, Amount, Predicate):
omit_optional_variation=1)
if not delivery_line.hasCell(base_id=base_id, *cell_key):
cell = delivery_line.newCell(base_id=base_id, \
portal_type=self.getDeliveryCellPortalType(),
portal_type=self.getDeliveryCellPortalType(),
activate_kw=activate_kw,*cell_key)
vcl = movement.getVariationCategoryList()
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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -35,7 +35,7 @@ from Products.ERP5Type import Permissions, PropertySheet, Interface
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
for some specific properties.
"""
......@@ -44,7 +44,7 @@ class PropertyDivergenceTester(XMLObject):
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
......@@ -73,12 +73,12 @@ class PropertyDivergenceTester(XMLObject):
the divergence of the Delivery Line.
"""
divergence_message_list = []
tested_property = self.getTestedPropertyList()
tested_property = self.getTestedPropertyList()
# Get the list of solvers callable in this case
solver_script_list = self.getSolverScriptList()
if solver_script_list is None:
solver_script_list = []
solver_script_list = []
solver_script_list = self._splitStringList(solver_script_list)
delivery_mvt = simulation_movement.getDeliveryValue()
......@@ -96,13 +96,13 @@ class PropertyDivergenceTester(XMLObject):
message=tested_property_title,
solver_script_list=solver_script_list
)
divergence_message_list.append(message)
divergence_message_list.append(message)
return divergence_message_list
def _splitStringList(self, string_list):
"""
Convert a list of string with a pipe (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]
......@@ -4,10 +4,10 @@
# Rafael M. Monnerat <rafael@nexedi.com>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -35,7 +35,7 @@ from Products.ERP5.Document.PropertyDivergenceTester import \
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
for the property quantity.
"""
......@@ -44,14 +44,14 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative interfaces
# Declarative interfaces
__implements__ = ( Interface.DivergenceTester, )
# Declarative properties
property_sheets = ( PropertySheet.Base
......@@ -61,7 +61,7 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
, PropertySheet.DivergenceTester
)
def explain(self, simulation_movement):
"""
This method returns a list of messages that contains
......@@ -72,11 +72,11 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
d_quantity = delivery.getQuantity()
quantity = simulation_movement.getCorrectedQuantity()
d_error = simulation_movement.getDeliveryError()
solver_script_list = self.getSolverScriptList()
if solver_script_list is None:
solver_script_list = []
message = ObjectMessage(object_relative_url= delivery.getRelativeUrl(),
simulation_movement = simulation_movement,
decision_value = d_quantity ,
......@@ -85,8 +85,8 @@ class QuantityDivergenceTester(PropertyDivergenceTester):
message='Quantity',
solver_script_list=self._splitStringList(solver_script_list)
)
if quantity is None:
if d_quantity is None:
return []
......
......@@ -1369,7 +1369,7 @@ class ERP5Generator(PortalGenerator):
addMessageCatalog('default', 'ERP5 Localized Messages', ('en',))
addMessageCatalog('erp5_ui', 'ERP5 Localized Interface', ('en',))
addMessageCatalog('erp5_content', 'ERP5 Localized Content', ('en',))
# Add an error_log
if 'error_log' not in p.objectIds():
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>
# Yoshinori Okuji <yo@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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -41,6 +41,6 @@ class DivergenceTester:
{ 'id' : 'solver_script',
'description' : 'List of scripts used to call the solvers',
'type' : 'string',
'multivalued' : 1,
'multivalued' : 1,
'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>
# Jerome Perrin <jerome@nexedi.com>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -287,7 +287,7 @@ class TestInvoice(TestInvoiceMixin):
resource_value=resource,
quantity=1,
price=2)
other_entity = self.portal.organisation_module.newContent(
portal_type='Organisation',
title='Other Entity')
......@@ -301,7 +301,7 @@ class TestInvoice(TestInvoiceMixin):
delivery_movement = related_applied_rule.contentValues()[0]
invoice_applied_rule = delivery_movement.contentValues()[0]
invoice_movement = invoice_applied_rule.contentValues()[0]
order_line.setSourceValue(other_entity)
get_transaction().commit()
self.tic()
......@@ -497,7 +497,7 @@ class TestInvoice(TestInvoiceMixin):
invoice_transaction_applied_rule = invoice_movement.contentValues()[0]
invoice_transaction_movement =\
invoice_transaction_applied_rule._getOb('income')
order_line.setSourceSectionValue(other_entity)
get_transaction().commit()
self.tic()
......@@ -655,7 +655,7 @@ class TestInvoice(TestInvoiceMixin):
invoice.confirm()
get_transaction().commit()
self.tic()
odt = invoice.Invoice_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......@@ -719,7 +719,7 @@ class TestInvoice(TestInvoiceMixin):
related_packing_list = order.getCausalityRelatedValue(
portal_type=self.packing_list_portal_type)
self.assertNotEquals(related_packing_list, None)
related_packing_list.start()
related_packing_list.stop()
get_transaction().commit()
......@@ -733,7 +733,7 @@ class TestInvoice(TestInvoiceMixin):
portal_type=self.invoice_line_portal_type)
self.assertEquals(1, len(line_list))
invoice_line = line_list[0]
self.assertEquals(resource, invoice_line.getResourceValue())
self.assertEquals(['size'], invoice_line.getVariationBaseCategoryList())
self.assertEquals(2,
......@@ -791,7 +791,7 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
invoice_line_portal_type = 'Invoice Line'
invoice_cell_portal_type = 'Invoice Cell'
invoice_transaction_line_portal_type = 'Sale Invoice Transaction Line'
# default sequence for one line of not varianted resource.
PACKING_LIST_DEFAULT_SEQUENCE = """
stepCreateEntities
......@@ -1239,7 +1239,7 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
resource_precision = line.getResourceValue().getQuantityPrecision()
self.assertEquals(round(line.getQuantity(), resource_precision),
round(expected_price * line_ratio, resource_precision))
def stepCheckInvoiceLineHasReferenceAndIntIndex(self, sequence=None, **kw):
"""Check that the unique invoice line in the invoice has reference and int
index.
......@@ -1254,9 +1254,9 @@ class TestSaleInvoiceMixin(TestInvoiceMixin,
def stepCheckPackingListInvoice(
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."""
packing_list = sequence.get('packing_list')
packing_list = sequence.get('packing_list')
related_invoice_list = packing_list.getCausalityRelatedValueList(
portal_type=self.invoice_portal_type)
self.assertEquals(len(related_invoice_list), 1)
......@@ -2520,7 +2520,7 @@ class TestSaleInvoice(TestSaleInvoiceMixin, ERP5TypeTestCase):
# We could generate a better reference here.
self.assertEquals('1', invoice.getReference())
def test_16_ManuallyAddedMovements(self, quiet=quiet, run=RUN_ALL_TESTS):
"""
Checks that adding invoice lines and accounting lines to one invoice
......
##############################################################################
# -*- 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>
# Romain Courteaud <romain@nexedi.com>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -571,7 +571,7 @@ class TestOrderMixin:
self.assertEquals( order.getTotalPrice(fast = 0),
order.getTotalPrice(fast = 1) )
def stepCheckOrderTotalPriceAndQuantityFastParameter(self,
def stepCheckOrderTotalPriceAndQuantityFastParameter(self,
sequence=None, sequence_list=None, **kw):
"""
Check the method getTotalPrice on a order .
......@@ -682,7 +682,7 @@ class TestOrderMixin:
"""
self.checkOrderRuleSimulation(rule_id = 'default_order_rule', sequence=sequence, \
sequence_list=sequence_list, **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
......@@ -953,7 +953,7 @@ class TestOrderMixin:
for applied_rule in related_applied_rule_list.keys():
self.assertTrue(applied_rule.isStable())
def stepPackingListAdoptPrevision(self,sequence=None, sequence_list=None,
def stepPackingListAdoptPrevision(self,sequence=None, sequence_list=None,
**kw):
"""
Check if simulation movement are disconnected
......@@ -998,7 +998,7 @@ class TestOrderMixin:
variated_order_creation_without_tic = variated_order_line_creation + \
variated_line_completion_without_tic
def stepCheckCatalogued(self, sequence=None,
def stepCheckCatalogued(self, sequence=None,
sequence_list=None, **kw):
"""
Check that order is catalogued
......@@ -1010,10 +1010,10 @@ class TestOrderMixin:
result = sql_connection.manage_test(sql)
simulation_state_list = [x['simulation_state'] for x in result]
self.assertEquals(1, len(simulation_state_list))
self.assertEquals(order.getSimulationState(),
self.assertEquals(order.getSimulationState(),
simulation_state_list[0])
def stepCheckCataloguedSimulation(self, sequence=None,
def stepCheckCataloguedSimulation(self, sequence=None,
sequence_list=None, **kw):
"""
Check that simulation is catalogued
......@@ -1027,7 +1027,7 @@ class TestOrderMixin:
result = sql_connection.manage_test(sql)
simulation_state_list = [x['simulation_state'] for x in result]
self.assertEquals(1, len(simulation_state_list))
self.assertEquals(order.getSimulationState(),
self.assertEquals(order.getSimulationState(),
simulation_state_list[0])
class TestOrder(TestOrderMixin, ERP5TypeTestCase):
......@@ -1883,7 +1883,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order_line = order.newContent(portal_type=self.order_line_portal_type)
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
sub_order_line = order_line.newContent(
portal_type=self.order_line_portal_type)
......@@ -1894,7 +1894,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
portal_type=self.order_line_portal_type)
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.
for i in range(5):
sub_order_line = sub_order_line.newContent(
......@@ -1930,7 +1930,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
cell_key_list.sort()
for cell_key in cell_key_list:
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)
self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList()))
......@@ -1944,7 +1944,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
cell_key_list.sort()
for cell_key in cell_key_list:
cell = order_line.newCell(base_id=base_id,
portal_type=self.order_cell_portal_type,
portal_type=self.order_cell_portal_type,
*cell_key)
self.assertEquals(2-1+len(cell_key_list), len(order.getMovementList()))
......@@ -2002,7 +2002,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
cell_key = order_line.getCellKeyList(base_id=base_id)[0]
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.edit(mapped_value_property_list=['price', 'quantity'],
price=3, quantity=4,
......@@ -2121,7 +2121,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sub_cell_key = sub_order_line.getCellKeyList(base_id=base_id)[0]
sub_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)
sub_cell.edit(mapped_value_property_list=['price', 'quantity'],
price=5, quantity=6,
......@@ -2220,7 +2220,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
title="Sub 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):
"""
Test generation and update of an hierarchical order applied rule.
......@@ -2286,7 +2286,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self)
def test_order_cell_getTotalPrice(self):
# test getTotalPrice and getTotalQuantity on a line with cells
# More precisely, it tests a previous bug where creating a line with
......@@ -2315,7 +2315,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
self.assertEquals(0, line.getTotalPrice())
self.assertEquals(0, order.getTotalQuantity())
self.assertEquals(0, order.getTotalPrice())
self.assertTrue(line.hasInRange('size/Baby', base_id='movement'))
cell_baby = line.newCell('size/Baby', base_id='movement',
portal_type=self.order_cell_portal_type)
......@@ -2408,7 +2408,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm()
get_transaction().commit()
self.tic()
odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......@@ -2440,7 +2440,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm()
get_transaction().commit()
self.tic()
odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......@@ -2477,7 +2477,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm()
get_transaction().commit()
self.tic()
odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......@@ -2517,7 +2517,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm()
get_transaction().commit()
self.tic()
odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......@@ -2559,7 +2559,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm()
get_transaction().commit()
self.tic()
odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......@@ -2586,7 +2586,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
destination_section_value=client)
line = order.newContent(portal_type=self.order_line_portal_type,
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()]:
return # skip this test if hierarchical orders are not available (eg.
# for Purchase Order)
......@@ -2598,7 +2598,7 @@ class TestOrder(TestOrderMixin, ERP5TypeTestCase):
order.confirm()
get_transaction().commit()
self.tic()
odt = order.Order_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
......
##############################################################################
# -*- 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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -65,7 +65,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
max_delay = 0.0
min_flow = 0.0
def stepClearActivities(self, sequence=None, sequence_list=None,
def stepClearActivities(self, sequence=None, sequence_list=None,
**kw):
"""
Clear activity tables
......@@ -73,7 +73,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
activity_tool = self.getPortal().portal_activities
activity_tool.manageClearActivities(keep=0)
def stepSetMaxDelayOnResource(self, sequence=None, sequence_list=None,
def stepSetMaxDelayOnResource(self, sequence=None, sequence_list=None,
**kw):
"""
Sets max_delay on resource
......@@ -84,7 +84,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
max_delay = self.max_delay,
)
def stepSetMinFlowOnResource(self, sequence=None, sequence_list=None,
def stepSetMinFlowOnResource(self, sequence=None, sequence_list=None,
**kw):
"""
Sets min_flow on resource
......@@ -95,7 +95,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
min_flow = self.min_flow,
)
def stepFillOrderBuilder(self, sequence=None, sequence_list=None,
def stepFillOrderBuilder(self, sequence=None, sequence_list=None,
**kw):
"""
Fills Order Builder with proper quantites
......@@ -118,7 +118,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
resource_portal_type = self.resource_portal_type,
)
def stepCheckGeneratedDocumentListVariated(self, sequence=None, sequence_list=None,
def stepCheckGeneratedDocumentListVariated(self, sequence=None, sequence_list=None,
**kw):
"""
Checks documents generated by Order Builders with its properties for variated resource
......@@ -133,9 +133,9 @@ class TestOrderBuilderMixin(TestOrderMixin):
1, # XXX
len(generated_document_list)
)
order = generated_document_list[0]
self.assertEquals(
order.getDestinationValue(),
organisation
......@@ -174,7 +174,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
len(order_cell_list),
len(self.wanted_quantity_matrix.itervalues())
)
for order_cell in order_cell_list:
self.assertEquals(
order_cell.getQuantity(),
......@@ -183,7 +183,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
]
)
def stepCheckGeneratedDocumentList(self, sequence=None, sequence_list=None,
def stepCheckGeneratedDocumentList(self, sequence=None, sequence_list=None,
**kw):
"""
Checks documents generated by Order Builders with its properties
......@@ -198,9 +198,9 @@ class TestOrderBuilderMixin(TestOrderMixin):
1, # XXX
len(generated_document_list)
)
order = generated_document_list[0]
self.assertEquals(
order.getDestinationValue(),
organisation
......@@ -233,8 +233,8 @@ class TestOrderBuilderMixin(TestOrderMixin):
order_line.getTotalQuantity(),
self.wanted_quantity
)
def stepBuildOrderBuilder(self, sequence=None, sequence_list=None,
def stepBuildOrderBuilder(self, sequence=None, sequence_list=None,
**kw):
"""
Invokes build method for Order Builder
......@@ -243,7 +243,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
generated_document_list = order_builder.build()
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):
"""
Creates empty Order Builder
......@@ -258,7 +258,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
order_builder = order_builder
)
def stepDecreaseOrganisationResourceQuantityVariated(self, sequence=None, sequence_list=None,
def stepDecreaseOrganisationResourceQuantityVariated(self, sequence=None, sequence_list=None,
**kw):
"""
Creates movement with variation from organisation to None.
......@@ -268,7 +268,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
"""
organisation = sequence.get('organisation')
resource = sequence.get('resource')
packing_list_module = self.portal.getDefaultModule(
portal_type = self.packing_list_portal_type
)
......@@ -288,7 +288,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
packing_list_line.setVariationCategoryList(
list(self.decrease_quantity_matrix.iterkeys())
)
get_transaction().commit()
self.tic()
......@@ -306,7 +306,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
packing_list.confirm()
def stepDecreaseOrganisationResourceQuantity(self, sequence=None, sequence_list=None,
def stepDecreaseOrganisationResourceQuantity(self, sequence=None, sequence_list=None,
**kw):
"""
Creates movement from organisation to None.
......@@ -316,7 +316,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
"""
organisation = sequence.get('organisation')
resource = sequence.get('resource')
packing_list_module = self.portal.getDefaultModule(
portal_type = self.packing_list_portal_type
)
......@@ -334,7 +334,7 @@ class TestOrderBuilderMixin(TestOrderMixin):
)
packing_list.confirm()
class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
"""
Test Order Builder functionality
......@@ -369,10 +369,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.wanted_quantity = 1.0
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.order_builder_hardcoded_time_diff
+ self.order_builder_hardcoded_time_diff
sequence_list = SequenceList()
sequence_list.addSequenceString(self.common_sequence_string)
......@@ -403,10 +403,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.wanted_quantity = 1.0
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.order_builder_hardcoded_time_diff
+ self.order_builder_hardcoded_time_diff
self.decrease_quantity_matrix = {
'size/Man' : 1.0,
......@@ -430,10 +430,10 @@ class TestOrderBuilder(TestOrderBuilderMixin, ERP5TypeTestCase):
self.wanted_quantity = 1.0
self.wanted_start_date = self.datetime.earliestTime() \
- self.max_delay \
+ self.order_builder_hardcoded_time_diff
+ self.order_builder_hardcoded_time_diff
self.wanted_stop_date = self.datetime.earliestTime() \
+ self.order_builder_hardcoded_time_diff
+ self.order_builder_hardcoded_time_diff
sequence_list = SequenceList()
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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -35,7 +35,7 @@ from testOrder import TestOrderMixin
class TestPackingListMixin(TestOrderMixin):
"""
Test business template erp5_trade
Test business template erp5_trade
"""
container_portal_type = 'Container'
container_line_portal_type = 'Container Line'
......@@ -126,7 +126,7 @@ class TestPackingListMixin(TestOrderMixin):
def enableLightInstall(self):
"""
You can override this.
You can override this.
Return if we should do a light install (1) or not (0)
"""
return 1
......@@ -160,7 +160,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(packing_list.getPriceCurrency(), \
order.getPriceCurrency())
def stepCheckPackingListIsDivergent(self, sequence=None, sequence_list=None,
def stepCheckPackingListIsDivergent(self, sequence=None, sequence_list=None,
packing_list=None,**kw):
"""
Test if packing list is divergent
......@@ -206,7 +206,7 @@ class TestPackingListMixin(TestOrderMixin):
packing_list = sequence.get('packing_list')
self.assertFalse(packing_list.isDivergent())
def stepChangePackingListLineResource(self, sequence=None,
def stepChangePackingListLineResource(self, sequence=None,
sequence_list=None, **kw):
"""
Change the resource of the packing list.
......@@ -344,7 +344,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(self.default_quantity,
simulation_movement.getCorrectedQuantity())
def stepChangePackingListDestination(self, sequence=None,
def stepChangePackingListDestination(self, sequence=None,
sequence_list=None, **kw):
"""
Test if packing list is divergent
......@@ -453,7 +453,7 @@ class TestPackingListMixin(TestOrderMixin):
packing_list_line = sequence.get('packing_list_line')
for simulation_line in simulation_line_list:
self.assertEquals(simulation_line.getDeliveryValue(),packing_list_line)
self.assertEquals(packing_list_line.getCausalityValue(),
self.assertEquals(packing_list_line.getCausalityValue(),
simulation_line.getOrderValue())
def stepCheckSimulationDisconnected(self,sequence=None, sequence_list=None, **kw):
......@@ -497,7 +497,7 @@ class TestPackingListMixin(TestOrderMixin):
for simulation_line in simulation_line_list:
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):
"""
Check if simulation movement are disconnected
......@@ -560,7 +560,7 @@ class TestPackingListMixin(TestOrderMixin):
# self.assertNotEquals(new_packing_list.getUid(),packing_list.getUid())
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):
"""
Check if simulation movement are disconnected
......@@ -596,7 +596,7 @@ class TestPackingListMixin(TestOrderMixin):
container_line = sequence.get('container_line')
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):
"""
Check if simulation movement are disconnected
......@@ -607,7 +607,7 @@ class TestPackingListMixin(TestOrderMixin):
container_line.edit(quantity=quantity)
container_line.immediateReindexObject()
def stepSetContainerFullQuantity(self,sequence=None, sequence_list=None,
def stepSetContainerFullQuantity(self,sequence=None, sequence_list=None,
quantity=None,**kw):
"""
Really fills the container
......@@ -657,7 +657,7 @@ class TestPackingListMixin(TestOrderMixin):
self.assertEquals(0,packing_list.isPacked())
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):
"""
Check that the number of objects in containers are
......@@ -690,7 +690,7 @@ class TestPackingListMixin(TestOrderMixin):
else:
currency = currency_module._getOb('EUR')
sequence.edit(currency=currency)
def stepSetOrderPriceCurrency(self, sequence, **kw) :
"""Set the price currency of the order.
......@@ -703,7 +703,7 @@ class TestPackingListMixin(TestOrderMixin):
order.setPriceCurrency(currency.getRelativeUrl())
class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
run_all_test = 1
......@@ -940,7 +940,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
'
# XXX Check if there is a new packing list created
sequence_list.addSequenceString(sequence_string)
sequence_list.play(self, quiet=quiet)
def test_10_PackingListIncreaseQuantity(self, quiet=quiet, run=run_all_test):
......@@ -1037,7 +1037,7 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
pl = self.getPortal().getDefaultModule(self.packing_list_portal_type
).newContent(portal_type=self.packing_list_portal_type)
self.failUnless(hasattr(pl, 'getPriceCurrency'))
def test_PackingList_viewAsODT(self):
# tests packing list printout
resource = self.portal.getDefaultModule(
......@@ -1063,14 +1063,14 @@ class TestPackingList(TestPackingListMixin, ERP5TypeTestCase) :
packing_list.confirm()
get_transaction().commit()
self.tic()
odt = packing_list.PackingList_viewAsODT()
from Products.ERP5OOo.tests.utils import Validator
odf_validator = Validator()
err_list = odf_validator.validate(odt)
if err_list:
self.fail(''.join(err_list))
class TestPurchasePackingListMixin(TestPackingListMixin):
"""Mixing class with steps to test purchase packing lists.
......@@ -1085,7 +1085,7 @@ class TestPurchasePackingListMixin(TestPackingListMixin):
container_portal_type = None
container_line_portal_type = None
container_cell_portal_type = None
# all steps related to packing and container does not apply on purchase
def ignored_step(self, **kw):
return
......
##############################################################################
#
# Copyright (c) 2007 Nexedi SARL and Contributors. All Rights Reserved.
# Copyright (c) 2007-2008 Nexedi SA and Contributors. All Rights Reserved.
# Fabien Morin <fabien.morin@gmail.com>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -30,17 +30,17 @@
TODO:
- review naming of new methods
- in the test test_04_paySheetCalculation, add sub_object (annotation_line,
ratio_line and payment conditioni), and verify that before the script
'PaySheetTransaction_applyModel' is called, subobjects are not in the
- in the test test_04_paySheetCalculation, add sub_object (annotation_line,
ratio_line and payment conditioni), and verify that before the script
'PaySheetTransaction_applyModel' is called, subobjects are not in the
paysheet, and after that there are copied in.
- use ratio settings and test it (there is a method getRatioQuantityList, see
the file Document/PaySheetTransaction.py)
- test with bonus which participate on the base_salary and see if the
- test with bonus which participate on the base_salary and see if the
contribution are applied on the real base_salary or on the base_salary + bonus
(it should).
WARNING:
WARNING:
- current API naming may change although model should be stable.
"""
......@@ -402,7 +402,7 @@ class TestPayrollMixin(ERP5ReportTestCase):
values = [[[1000, 1], [1000, 1]], [[2000, None], [None, 0.5]]]
next, two representations to well understand :
'employee_share', 'employer_share'
[[ 1470, None ], [ 2100, None ]]
'salary_range/france/forfait'
......@@ -411,7 +411,7 @@ class TestPayrollMixin(ERP5ReportTestCase):
[ [ None, 0.01 ], [ None, 0.02 ],[ None, 0.01 ], [ None, 0.02 ] ]
'salary_range/france/tranche_a''salary_range/france/tranche_b'
'''
# verify if category used in this model line are selected in the resource
resource_list = resource.getVariationCategoryList(base=1)
msg='%r != %r' % (resource_list, variation_category_list)
......@@ -517,7 +517,7 @@ class TestPayroll(TestPayrollMixin):
if hasattr(self.paysheet_model_module, self.model_id):
self.paysheet_model_module.manage_delObjects([self.model_id])
model_count_before_add = \
len(self.paysheet_model_module.contentValues(portal_type=\
self.paysheet_model_portal_type))
......@@ -745,7 +745,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEqual(paysheet_line_count_before_calculation, 0)
self.assertEqual(paysheet_line_count_after_calculation,
pay_sheet_line_count)
# check the amount in the cells of the created paysheet lines
for pay_sheet_line in pay_sheet_line_list:
service = pay_sheet_line.getResourceId()
......@@ -777,10 +777,10 @@ class TestPayroll(TestPayrollMixin):
- a model can have some DATA's
- a model can inherite from another, that's mean :
o At the calculation step, each DATA of the parent model will be
checked : the DATA with a REFERENCE that's already in the child
checked : the DATA with a REFERENCE that's already in the child
model will not entered in the calcul. The other will.
o This will be repeated on each parent model and on each parent of
the parent model,... until there is no parent model to inherite
o This will be repeated on each parent model and on each parent of
the parent model,... until there is no parent model to inherite
(or until a max loop number has been reached).
'''
# create 3 models
......@@ -939,7 +939,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEqual(len(number_of_different_references), 11) # here, there is
# 8 differents annotation lines, and with the 3 ones have been had before
# that's make 11 !
# check the model number
self.assertEqual(len(model_reference_dict), 6) # there is 7 model, but the
# model_d is not take into account because it have no annotation line wich
......@@ -1001,7 +1001,7 @@ class TestPayroll(TestPayrollMixin):
# get a list of all this subObjects:
sub_object_list = paysheet.getInheritedObjectValueList(portal_type_list)
self.assertEqual(len(sub_object_list), 11)
def test_07_model_getCell(self):
'''
Model objects have a overload method called getCell. This method first
......@@ -1049,7 +1049,7 @@ class TestPayroll(TestPayrollMixin):
self.addSlice(model_country, 'salary_range/%s' % \
self.france_settings_slice_c, 4, 5)
# inherite from each other
model_employee.setSpecialiseValueList((model_company, model_company_alt))
model_company.setSpecialiseValue(model_country)
......@@ -1143,7 +1143,7 @@ class TestPayroll(TestPayrollMixin):
base_id='cell')
cell.setQuantityRangeMin(1)
cell.setQuantityRangeMax(2)
# model 2 gets cell values from model 1 (see test_07_model_getCell)
self.assertEquals(1,
model_2.getCell('salary_range/france/tranche_a').getQuantityRangeMin())
......@@ -1198,7 +1198,7 @@ class TestPayroll(TestPayrollMixin):
cell1.setVariationCategoryList(('tax_category/employer_share',))
cell1.setPrice(4)
cell1.setQuantity(5)
movement_list = pay_sheet.PaySheetTransaction_getMovementList()
self.assertEquals(1, len(movement_list))
movement = movement_list[0]
......@@ -1229,7 +1229,7 @@ class TestPayroll(TestPayrollMixin):
cell.setPrice(1)
pay_sheet = self.createPaySheet(self.model)
# PaySheetTransaction_getEditableObjectLineList is the script used as list
# method to display editable lines in the dialog listbox
editable_line_list = pay_sheet\
......@@ -1241,7 +1241,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEquals('paysheet_model_module/model_one/line',
editable_line.model_line)
self.assertEquals(None, editable_line.salary_range_relative_url)
# PaySheetTransaction_createAllPaySheetLineList is the script used to create line and cells in the
# paysheet using the listbox input
pay_sheet.PaySheetTransaction_createAllPaySheetLineList(
......@@ -1259,7 +1259,7 @@ class TestPayroll(TestPayrollMixin):
self.assertNotEquals(None, cell)
self.assertEquals(1, cell.getPrice())
self.assertEquals(2, cell.getQuantity())
# if the script is called again, previous content is erased.
pay_sheet.PaySheetTransaction_createAllPaySheetLineList(
listbox=[dict(listbox_key='0',
......@@ -1276,7 +1276,7 @@ class TestPayroll(TestPayrollMixin):
self.assertNotEquals(None, cell)
self.assertEquals(0.5, cell.getPrice())
self.assertEquals(10, cell.getQuantity())
# If the user enters a null quantity, the line will not be created
pay_sheet.PaySheetTransaction_createAllPaySheetLineList(
listbox=[dict(listbox_key='0',
......@@ -1326,7 +1326,7 @@ class TestPayroll(TestPayrollMixin):
cell.setPrice(1)
pay_sheet = self.createPaySheet(self.model)
# PaySheetTransaction_getEditableObjectLineList is the script used as list
# method to display editable lines in the dialog listbox
editable_line_list = pay_sheet\
......@@ -1338,7 +1338,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEquals('paysheet_model_module/model_one/line2',
editable_line.model_line)
self.assertEquals(None, editable_line.salary_range_relative_url)
# PaySheetTransaction_createAllPaySheetLineList is the script used to create line and cells in the
# paysheet using the listbox input
pay_sheet.PaySheetTransaction_createAllPaySheetLineList(
......@@ -1357,7 +1357,7 @@ class TestPayroll(TestPayrollMixin):
self.assertNotEquals(None, cell)
self.assertEquals(1, cell.getPrice())
self.assertEquals(100, cell.getQuantity())
pay_sheet_line2 = [l for l in pay_sheet_line_list
if l.getIntIndex() == 2][0]
self.assertEquals(self.labour, pay_sheet_line2.getResourceValue())
......@@ -1384,7 +1384,7 @@ class TestPayroll(TestPayrollMixin):
self.assertNotEquals(None, cell)
self.assertEquals(1, cell.getPrice())
self.assertEquals(100, cell.getQuantity())
pay_sheet_line2 = [l for l in pay_sheet_line_list
if l.getIntIndex() == 2][0]
self.assertEquals(self.labour, pay_sheet_line2.getResourceValue())
......@@ -1393,7 +1393,7 @@ class TestPayroll(TestPayrollMixin):
self.assertNotEquals(None, cell)
self.assertEquals(0.6, cell.getPrice())
self.assertEquals(10, cell.getQuantity())
# If the user enters a null quantity, the line will not be created
pay_sheet.PaySheetTransaction_createAllPaySheetLineList(
listbox=[dict(listbox_key='0',
......@@ -1429,7 +1429,7 @@ class TestPayroll(TestPayrollMixin):
cell.setQuantity(5)
pay_sheet = self.createPaySheet(self.model)
pay_sheet.PaySheetTransaction_createAllPaySheetLineList()
pay_sheet_line_list = pay_sheet.contentValues(portal_type='Pay Sheet Line')
self.assertEquals(1, len(pay_sheet_line_list))
......@@ -1440,7 +1440,7 @@ class TestPayroll(TestPayrollMixin):
self.assertNotEquals(None, cell)
self.assertEquals(1, cell.getPrice())
self.assertEquals(5, cell.getQuantity())
def test_createPaySheetLineZeroPrice(self):
# test the creation of lines when the price is set to zero: the line should
# not be created.
......@@ -1459,11 +1459,11 @@ class TestPayroll(TestPayrollMixin):
cell.setPrice(0)
pay_sheet = self.createPaySheet(self.model)
pay_sheet.PaySheetTransaction_createAllPaySheetLineList()
pay_sheet_line_list = pay_sheet.contentValues(portal_type='Pay Sheet Line')
self.assertEquals(0, len(pay_sheet_line_list))
def test_paysheet_consistency(self):
# minimal test for checkConsistency on a Pay Sheet Transaction and its
# subdocuments (may have to be updated when we'll add more constraints).
......@@ -1475,7 +1475,7 @@ class TestPayroll(TestPayrollMixin):
paysheet.newContent(portal_type='Pay Sheet Model Ratio Line')
paysheet.newContent(portal_type='Payment Condition')
self.assertEquals([], paysheet.checkConsistency())
def test_paysheet_model_consistency(self):
# minimal test for checkConsistency on a Pay Sheet Model and its
# subdocuments (may have to be updated when we'll add more constraints).
......@@ -1520,7 +1520,7 @@ class TestPayroll(TestPayrollMixin):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=model)
paysheet.PaySheetTransaction_applyModel()
self.assertEquals(employee, paysheet.getSourceSectionValue())
self.assertEquals(employer, paysheet.getDestinationSectionValue())
......@@ -1544,7 +1544,7 @@ class TestPayroll(TestPayrollMixin):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=other_model)
paysheet.PaySheetTransaction_applyModel()
self.assertEquals(employee, paysheet.getSourceSectionValue())
self.assertEquals(employer, paysheet.getDestinationSectionValue())
......@@ -1583,7 +1583,7 @@ class TestPayroll(TestPayrollMixin):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=employee_model)
paysheet.PaySheetTransaction_applyModel()
self.assertEquals(employee, paysheet.getSourceSectionValue())
self.assertEquals(employer, paysheet.getDestinationSectionValue())
......@@ -1639,7 +1639,7 @@ class TestPayroll(TestPayrollMixin):
paysheet = self.portal.accounting_module.newContent(
portal_type='Pay Sheet Transaction',
specialise_value=model)
paysheet.PaySheetTransaction_applyModel()
paysheet.createPaySheetLineList()
paysheet_line_list = paysheet.contentValues(portal_type='Pay Sheet Line')
......@@ -1653,7 +1653,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEquals(['tax_category/employee_share'],
paysheet_line.getVariationCategoryList())
def test_PayrollTaxesReport(self):
eur = self.portal.currency_module.EUR
payroll_service = self.portal.payroll_service_module.newContent(
......@@ -1760,19 +1760,19 @@ class TestPayroll(TestPayrollMixin):
get_transaction().commit()
self.tic()
# set request variables and render
# set request variables and render
request_form = self.portal.REQUEST
request_form['at_date'] = DateTime(2006, 2, 2)
request_form['section_category'] = 'group/demo_group'
request_form['simulation_state'] = ['draft', 'planned']
request_form['resource'] = payroll_service.getRelativeUrl()
request_form['mirror_section'] = provider.getRelativeUrl()
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountingTransactionModule_viewPaySheetLineReport')
self.assertEquals(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEquals(2, len(data_line_list))
......@@ -1781,7 +1781,7 @@ class TestPayroll(TestPayrollMixin):
# precision is 3
precision = self.portal.REQUEST.get('precision')
self.assertEquals(3, precision)
self.checkLineProperties(data_line_list[0],
id=1,
employee_career_reference='E1',
......@@ -1798,14 +1798,14 @@ class TestPayroll(TestPayrollMixin):
employee_share=3000 * .50,
employer_share=3000 * .40,
total=(3000 * .50 + 3000 * .40))
# stat line
# stat line
self.checkLineProperties(line_list[-1],
base=3000 + 2000,
employee_share=(3000 + 2000) * .50,
employer_share=(3000 + 2000) * .40,
total=((3000 + 2000) * .50 + (3000 + 2000) * .40))
def test_PayrollTaxesReportDifferentSalaryRange(self):
eur = self.portal.currency_module.EUR
payroll_service = self.portal.payroll_service_module.newContent(
......@@ -1949,23 +1949,23 @@ class TestPayroll(TestPayrollMixin):
get_transaction().commit()
self.tic()
# set request variables and render
# set request variables and render
request_form = self.portal.REQUEST
request_form['at_date'] = DateTime(2006, 2, 2)
request_form['section_category'] = 'group/demo_group'
request_form['simulation_state'] = ['draft', 'planned']
request_form['resource'] = payroll_service.getRelativeUrl()
request_form['mirror_section'] = provider.getRelativeUrl()
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountingTransactionModule_viewPaySheetLineReport')
self.assertEquals(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEquals(6, len(data_line_list))
self.checkLineProperties(data_line_list[0],
id=1,
employee_career_reference='E1',
......@@ -2014,7 +2014,7 @@ class TestPayroll(TestPayrollMixin):
#total=(3500 * .20 + 3500 * .32),
)
# stat line
# stat line
self.checkLineProperties(line_list[-1],
base=2000 + 3500,
employee_share=(2000 * .50 + 3500 * .20),
......@@ -2147,17 +2147,17 @@ class TestPayroll(TestPayrollMixin):
get_transaction().commit()
self.tic()
# set request variables and render
# set request variables and render
request_form = self.portal.REQUEST
request_form['at_date'] = DateTime(2006, 2, 2)
request_form['section_category'] = 'group/demo_group'
request_form['simulation_state'] = ['draft', 'planned']
report_section_list = self.getReportSectionList(
self.portal.accounting_module,
'AccountingTransactionModule_viewNetSalaryReport')
self.assertEquals(1, len(report_section_list))
line_list = self.getListBoxLineList(report_section_list[0])
data_line_list = [l for l in line_list if l.isDataLine()]
self.assertEquals(2, len(data_line_list))
......@@ -2166,7 +2166,7 @@ class TestPayroll(TestPayrollMixin):
# precision is 3
precision = self.portal.REQUEST.get('precision')
self.assertEquals(3, precision)
self.checkLineProperties(data_line_list[0],
employee_career_reference='E1',
employee_title='Employee One',
......@@ -2177,7 +2177,7 @@ class TestPayroll(TestPayrollMixin):
employee_title='Employee Two',
employee_bank_account='Bank 2',
total_price=3000 - (3000 * .5),)
# stat line
# stat line
self.checkLineProperties(
line_list[-1],
total_price=3000 + 2000 - (2000 * .5) - (3000 * .5))
......@@ -2333,7 +2333,7 @@ class TestPayroll(TestPayrollMixin):
destination_section_value=employer,
source_section_value=employee,
start_date=DateTime(2006, 1, 1),)
# base salary = 2000
line = ps.newContent(portal_type='Pay Sheet Line',
title='Base salary',
......@@ -2354,7 +2354,7 @@ class TestPayroll(TestPayrollMixin):
mapped_value_property_list=('price',
'quantity'),)
cell_employer.edit(price=1, quantity=2000, tax_category='employer_share')
# base_salary += 100 (bonus)
line = ps.newContent(portal_type='Pay Sheet Line',
title='Bonus',
......@@ -2397,7 +2397,7 @@ class TestPayroll(TestPayrollMixin):
'quantity'),)
cell_employer.edit(price=-1, quantity=50, tax_category='employer_share')
# tax1 = 10% for employee ( 205 )
# tax1 = 10% for employee ( 205 )
# 20% for employer ( 410 )
line = ps.newContent(portal_type='Pay Sheet Line',
title='Tax 1',
......@@ -2424,11 +2424,11 @@ class TestPayroll(TestPayrollMixin):
get_transaction().commit()
self.tic()
related_applied_rule = ps.getCausalityRelatedValue(
portal_type='Applied Rule')
self.assertNotEquals(related_applied_rule, None)
# build accounting lines
ps.confirm()
ps.start()
......@@ -2438,7 +2438,7 @@ class TestPayroll(TestPayrollMixin):
accounting_line_list = ps.contentValues(
portal_type='Pay Sheet Transaction Line')
self.assertEquals(len(accounting_line_list), 4)
line = [l for l in accounting_line_list
if l.getDestinationValue() == account_payroll_wages_expense][0]
self.assertEquals(2050, line.getDestinationDebit())
......@@ -2449,7 +2449,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEquals(2050 - 205, line.getDestinationCredit())
self.assertEquals(employer, line.getDestinationSectionValue())
self.assertEquals(employee, line.getSourceSectionValue())
line = [l for l in accounting_line_list
if l.getDestinationValue() == account_payroll_taxes_expense][0]
self.assertEquals(410, line.getDestinationDebit())
......@@ -2460,7 +2460,7 @@ class TestPayroll(TestPayrollMixin):
self.assertEquals(410 + 205, line.getDestinationCredit())
self.assertEquals(employer, line.getDestinationSectionValue())
self.assertEquals(provider, line.getSourceSectionValue())
import unittest
......
# -*- 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>
#
# 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
# 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
#
# This program is Free Software; you can redistribute it and/or
......@@ -153,7 +153,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking
def stepDecreaseProducedDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw):
packing_list = sequence.get('produced_delivery_packing_list')
for line in packing_list.getMovementList():
line.edit(
quantity = line.getQuantity() - 1.0
......@@ -161,7 +161,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking
def stepDecreaseSupplyDeliveryPackingListQuantity(self, sequence=None, sequence_list=None, **kw):
packing_list = sequence.get('supply_delivery_packing_list')
for line in packing_list.getMovementList():
line.edit(
quantity = line.getQuantity() - 1.0
......@@ -208,7 +208,7 @@ class TestProductionPackingReportListMixin(TestProductionOrderMixin, TestPacking
supply_movement.getSimulationState(),
supply_delivery_packing_list.getSimulationState()
)
self.assertEquals(
produced_movement.getSimulationState(),
produced_report.getSimulationState()
......@@ -403,7 +403,7 @@ class TestProductionDelivery(TestProductionPackingReportListMixin):
self.transformation_portal_type,
self.resource_portal_type,)
def test_01_sourcingDelivery(self, quiet=0,
def test_01_sourcingDelivery(self, quiet=0,
run=run_all_test):
"""
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