Commit 1b95e701 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Global Udate to Latest Coramy Optimizations


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@524 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 12f5f171
......@@ -888,6 +888,21 @@ class CategoryTool( UniqueObject, Folder, Base ):
return 1
return 0
security.declareProtected( Permissions.AccessContentsInformation, 'isAcquiredMemberOf' )
def isAcquiredMemberOf(self, context, category):
"""
Tests if an object if member of a given category
Category is a string here. It could be more than a string (ex. an object)
XXX Should include acquisition ?
"""
if getattr(aq_base(context), 'isCategory', 0):
return context.isAcquiredMemberOf(category)
for c in self._getAcquiredCategoryList(context):
if c.find(category) >= 0:
return 1
return 0
security.declareProtected( Permissions.AccessContentsInformation, 'getCategoryList' )
def getCategoryList(self, context):
self._cleanupCategories(context)
......
......@@ -55,6 +55,7 @@ class Invoice(ERP5Invoice):
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Delivery
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Movement
......
......@@ -174,8 +174,7 @@ un modele..."""
return pri.getProperty('pri')
return None
def _updateIndustrialPrice(self):
pass
#self.modele_compute_pri(batch_mode=1)
def _updateIndustrialPrice(self, context):
#pass
self.modele_compute_pri(batch_mode=1)
......@@ -34,7 +34,7 @@ from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5.Document.OrderLine import OrderLine
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from ElementTarif import ElementTarif
from Products.Coramy.Document.ElementTarif import ElementTarif
class SampleOrderLine(OrderLine, ElementTarif):
"""
......
......@@ -37,7 +37,7 @@ class Vetement:
'description' : 'librairie contenant les morceaux',
'type' : 'string',
'mode' : 'w' },
{ 'id' : 'base_taille',
{ 'id' : 'base_taille',
'description' : 'taille de base',
'type' : 'string',
'mode' : 'w' },
......@@ -53,6 +53,26 @@ class Vetement:
'description' : 'ensemble de recommandations de montage servant a mettre au point le vetement',
'type' : 'text',
'mode' : 'w' },
{ 'id' : 'forme_id',
'description' : 'Id des formes compatibles',
'type' : 'lines',
'acquisition_base_category' : ('specialise',),
'acquisition_portal_type' : ('Forme',),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0,
'acquisition_accessor_id' : 'getId',
'acquisition_depends' : None,
'mode' : 'w' },
{ 'id' : 'correspondance_id',
'description' : 'Id de la correspondance mesure associée',
'type' : 'lines',
'acquisition_base_category' : ('specialise',),
'acquisition_portal_type' : ('Correspondance Mesures',),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0,
'acquisition_accessor_id' : 'getId',
'acquisition_depends' : None,
'mode' : 'w' },
)
_categories = ( 'taille', 'mesure_vetement', 'specialise')
......@@ -5,35 +5,75 @@
##bind script=script
##bind subpath=traverse_subpath
##parameters=fix=0
##title=
##title=Tries to find orphaned movements to fix a given delivery
##
# Example code:
order_uid_list = context.getCausalityUidList() # XXX We may need to filter portal_type
order_uid_list = list(context.getCausalityUidList()) + [context.getUid()] # XXX We may need to filter portal_type
#order_uid_list = context.getCausalityUidList()
# We must consider delivery rules and deliveries without order (ie. order is delivery)
# Check each existing movement in delivery
attached_to_movement = []
requires_delivery_rule = []
requires_new_delivery = []
for m in context.getMovementList():
# simulation_movement = m.getDeliveryRelatedValueList()
# Is there any orphaned movement
result = context.Delivery_zGetOrphanedMovementList(order_uid_list = order_uid_list,
resource_uid = m.getResourceUid(),
variation_text = m.getVariationText())
if len(result) > 0:
for orphaned in result:
print "Found orphaned movement %s attached to %s" % (orphaned.relative_url, m.getRelativeUrl())
attached_to_movement.append(orphaned.relative_url)
if fix:
simulation_movement_list = m.getDeliveryRelatedValueList()
if len(simulation_movement_list) > 0:
# This movement is simulated
# let us check if simulation movements point where they should
for orphaned in simulation_movement_list:
simulation_movement = orphaned.getObject()
if simulation_movement.getDelivery() != m.getRelativeUrl():
print "Found inconsistent simulation movement %s attached to %s instead of %s" % (simulation_movement.getRelativeUrl(), simulation_movement.getDelivery(), m.getRelativeUrl())
print "##Reindexing"
simulation_movement.immediateReindexObject() # Always fix
else:
# This movement is not simulated
# find potential orphaned
result = context.Delivery_zGetOrphanedMovementList(order_uid_list = order_uid_list,
resource_uid = m.getResourceUid(),
variation_text = m.getVariationText())
if len(result) > 0:
for orphaned in result:
simulation_movement = orphaned.getObject()
initial_quantity = m.getQuantity()
quantity = simulation_movement.getQuantity()
simulation_movement.setDeliveryValue(m)
m.setQuantity(quantity)
print " Fixed orphaned movement %s attached to %s with quantity %s" % (orphaned.relative_url, m.getRelativeUrl(), quantity)
print "Found orphaned movement %s attached to %s. (%s in simulation instead of %s in delivery)" % (orphaned.relative_url, m.getRelativeUrl(), quantity, initial_quantity)
attached_to_movement.append(orphaned.relative_url)
if fix:
# More job is required here XXX
simulation_movement.setDeliveryValue(m)
m.setQuantity(quantity)
print " Fixed orphaned movement %s attached to %s with simulation quantity %s" % (orphaned.relative_url, m.getRelativeUrl(), quantity)
else:
requires_delivery_rule.append(m)
# Check each orphaned movement
# Check each orphaned movement related to orders which we came from
print "##Building orphaned list"
result = context.Delivery_zGetOrphanedMovementList( order_uid_list = order_uid_list )
#return map(lambda x:x.portal_type, result)
for orphaned in result:
if orphaned.relative_url not in attached_to_movement:
print "Found orphaned movement %s which required new line/cell" % orphaned.relative_url
print "Found orphaned movement %s which requires new delivery" % orphaned.relative_url
simulation_movement = orphaned.getObject()
if simulation_movement is not None:
try:
simulation_movement.getDeliveryValue()
except:
return str(orphaned.portal_type)
if simulation_movement.getDeliveryValue() is None:
simulation_movement.setDelivery(None)
requires_new_delivery.append(simulation_movement)
else:
print "Error: has previous delivery but found as orphaned movement (%s)" % orphaned.relative_url
# Build new deliveries
if fix:
print "Building new packing lists"
root_group = context.portal_simulation.collectMovement(requires_new_delivery)
delivery_list = context.portal_simulation.buildDeliveryList(root_group)
for delivery in delivery_list:
print " New delivery %s for causality %s" % (delivery.getRelativeUrl(), ' '.join(delivery.getCausalityList()))
return printed
......@@ -44,9 +44,14 @@ AND
related_order_line.delivery_uid = related_order.uid
AND
catalog.uid = movement.uid
AND
AND (
related_order.simulation_state = 'confirmed'
<dtml-if order_uid_list>AND <dtml-in order_uid_list>related_order.uid = <dtml-sqlvar sequence-item type="int"> <dtml-if sequence-end><dtml-else> OR </dtml-if> </dtml-in>
</dtml-if><dtml-if resource_uid>AND movement.resource_uid = <dtml-sqlvar resource_uid type="int">
OR related_order.simulation_state = 'getting_started'
OR related_order.simulation_state = 'started'
OR related_order.simulation_state = 'stopped'
OR related_order.simulation_state = 'delivered'
)
<dtml-if order_uid_list>AND (<dtml-in order_uid_list>related_order.uid = <dtml-sqlvar sequence-item type="int"> <dtml-if sequence-end><dtml-else> OR </dtml-if> </dtml-in>
)</dtml-if><dtml-if resource_uid>AND movement.resource_uid = <dtml-sqlvar resource_uid type="int">
</dtml-if><dtml-if variation_text>AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if>
\ No newline at end of file
......@@ -10,6 +10,7 @@ class_file:
<params></params>
CREATE TABLE `message` (
`uid` int(11) NOT NULL auto_increment,
`date` datetime,
`path` VARCHAR(255),
`method_id` VARCHAR(40),
`processing_node` INT DEFAULT -1,
......@@ -17,9 +18,10 @@ CREATE TABLE `message` (
`priority` INT DEFAULT 0,
`message` BLOB,
PRIMARY KEY (`uid`),
KEY `date` (`date`),
KEY `path` (`path`),
KEY `method_id` (`method_id`),
KEY `processing_node` (`processing_node`),
KEY `processing` (`processing`),
KEY `priority` (`priority`),
) TYPE = InnoDB;
) TYPE = InnoDB;
\ No newline at end of file
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
max_cache:100
connection_id:MySQL
max_rows:1
max_cache:0
cache_time:0
class_name:
class_file:
......@@ -12,4 +12,4 @@ UPDATE message
SET processing=1
WHERE
<dtml-in uid>uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else>
OR </dtml-if></dtml-in>
OR </dtml-if></dtml-in>
\ No newline at end of file
......@@ -17,4 +17,4 @@ WHERE
<dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if>
ORDER BY
priority
\ No newline at end of file
priority, date
\ No newline at end of file
......@@ -20,4 +20,6 @@ WHERE
<dtml-if path>AND path = <dtml-sqlvar path type="string"></dtml-if>
<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
GROUP BY
path, method_id, processing_node, processing
\ No newline at end of file
path, method_id, processing_node, processing
ORDER BY
priority, date
\ No newline at end of file
......@@ -14,6 +14,7 @@ priority</params>
INSERT INTO message
SET
path = <dtml-sqlvar path type="string">,
date = <dtml-sqlvar "_.DateTime()" type="string">,
method_id = <dtml-sqlvar method_id type="string">,
processing_node = -1,
processing = -1,
......
......@@ -45,10 +45,11 @@ AND not (next_movement.inventory is NULL))
WHERE
item.portal_type = "Piece Tissu"
AND stock.node_uid = <dtml-var "portal_categories.site.Stock_MP.Gravelines.getUid()">
AND ( stock.uid is NULL
OR ( stock.node_uid = <dtml-var "portal_categories.site.Stock_MP.Gravelines.getUid()">
AND ( stock.quantity >= 0
OR (stock.quantity < 0
AND not (movement.inventory is NULL) ) )
AND not (movement.inventory is NULL) ) ) ) )
<dtml-in PieceTissu_searchConsumedList>AND item.uid <> <dtml-sqlvar uid type="int">
</dtml-in>
AND next_movement.uid is NULL
......@@ -87,4 +88,4 @@ AND item.default_source_reference LIKE <dtml-sqlvar default_source_reference typ
<dtml-if sort_on>ORDER BY
<dtml-var sort_on>
</dtml-if>
\ No newline at end of file
</dtml-if>
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
connection_id:MySQL
max_rows:750
max_cache:100
cache_time:0
class_name:ZSQLBrain
......
......@@ -60,7 +60,7 @@
<all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('resource_relative_url', 'Composant'), ('variation_text', 'Variante'), ('quantity', 'Conso'), ('getCurrentInventory', 'Stock'), ('getAvailableInventory', 'Dispo'), ('getInventoryAtDate', 'Pr\xe9vu'), ('getFutureInventory', 'Futur'), ('getQuantityUnit', 'Unit\xe9')]</columns>
<columns type="list">[('resource_relative_url', 'Composant'), ('variation_text', 'Variante'), ('quantity', 'Conso'), ('getAvailableInventory', 'Dispo'), ('getCurrentInventory', 'Stock'), ('getInventoryAtDate', 'Pr\xe9vu'), ('getFutureInventory', 'Futur'), ('getQuantityUnit', 'Unit\xe9')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
......
......@@ -7,7 +7,9 @@
##parameters=
##title=
##
result = context.portal_simulation.updateAssetPrice(
active_process = context.portal_activities.newActiveProcess(title="Calcul test de valorisation du stock")
result = context.portal_simulation.activate(activity='SQLQueue', priority=3, active_process = active_process ).updateAssetPrice(
"modele/417P401",
"""coloris/modele/417P401/1_espace_stuc
taille/enfant/10 ans""",
......@@ -15,7 +17,9 @@ taille/enfant/10 ans""",
"site/Stock_PF"
)
for i in result:
print ' '.join(map(lambda x:str(x), i))
#for i in result:
# print ' '.join(map(lambda x:str(x), i))
print repr(result)
return printed
......@@ -15,7 +15,7 @@ node
section
node_uid
section_uid
variation_text
variation_text=None
node_category
section_category
resource_category
......@@ -36,12 +36,15 @@ SELECT
COUNT(DISTINCT movement.variation_text) AS variation_text,
MAX(stock.resource_uid) AS resource_uid
FROM
catalog, movement, stock, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
movement
LEFT JOIN catalog ON (movement.uid = catalog.uid)
LEFT JOIN stock ON (movement.uid = stock.uid)
, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
WHERE
catalog.uid = movement.uid
AND catalog.uid = stock.uid
1 = 1
<dtml-if resource>AND (<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> stock.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if "variation_text is not None">AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if>AND movement.is_accountable = 1
AND node.uid = stock.node_uid
AND section.uid = stock.section_uid
......@@ -50,7 +53,6 @@ AND stock.resource_uid = resource.uid
</dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if><dtml-if node_uid>AND stock.node_uid = <dtml-sqlvar node_uid type="int">
</dtml-if><dtml-if section_uid>AND stock.section_uid = <dtml-sqlvar section_uid type="int">
</dtml-if><dtml-if variation_text>AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if node>AND node.relative_url = <dtml-sqlvar node type="string">
</dtml-if><dtml-if section>AND section.relative_url = <dtml-sqlvar section type="string">
</dtml-if><dtml-if node_category>AND node_c.relative_url = <dtml-sqlvar node_category type="string">
......
<dtml-comment>
title:
connection_id:erp5_sql_connection
max_rows:1000
connection_id:MySQL
max_rows:20000
max_cache:100
cache_time:0
class_name:InventoryListBrain
......@@ -15,7 +15,7 @@ node_uid
section_uid
node
section
variation_text
variation_text="XXX_marker"
node_category
section_category
resource_category
......@@ -24,7 +24,10 @@ omit_input
omit_output
simulation_state
query
calculate_asset:int=0</params>
calculate_asset:int=0
group_by_node=1
group_by_section=1
group_by_variation=1</params>
SELECT
SUM(stock.quantity) AS inventory,
<dtml-if "calculate_asset != 0"> SUM(stock.total_asset_price) AS asset_price, </dtml-if>
......@@ -36,23 +39,30 @@ SELECT
resource.relative_url AS resource_relative_url,
resource.uid AS resource_uid,
movement.variation_text AS variation_text,
MAX(catalog.path) AS path
MAX(catalog.path) AS path,
<dtml-sqlvar group_by_node type="int"> AS group_by_node,
<dtml-sqlvar group_by_section type="int"> AS group_by_section,
<dtml-sqlvar group_by_variation type="int"> AS group_by_variation
<dtml-if section_category>, <dtml-sqlvar section_category type="string"> AS section_category </dtml-if>
<dtml-if node_category>, <dtml-sqlvar node_category type="string"> AS node_category </dtml-if>
FROM
catalog, movement, stock, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
movement
LEFT JOIN catalog AS resource ON (movement.resource_uid = resource.uid)
LEFT JOIN catalog ON (catalog.uid = movement.uid)
LEFT JOIN stock ON (stock.uid = movement.uid)
LEFT JOIN catalog AS node ON (stock.node_uid = node.uid)
LEFT JOIN catalog AS section ON (stock.section_uid = section.uid)
<dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
WHERE
catalog.uid = movement.uid
AND catalog.uid = stock.uid
1 = 1
<dtml-if resource>AND (<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if>AND movement.is_accountable = 1
AND node.uid = stock.node_uid
AND section.uid = stock.section_uid
AND movement.resource_uid = resource.uid
<dtml-if from_date>AND movement.stop_date >= <dtml-sqlvar from_date type="string">
</dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if><dtml-if node_uid>AND stock.node_uid = <dtml-sqlvar node_uid type="int">
</dtml-if><dtml-if section_uid>AND stock.section_uid = <dtml-sqlvar section_uid type="int">
</dtml-if><dtml-if variation_text>AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if "variation_text <> 'XXX_marker'">AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if node>AND node.relative_url = <dtml-sqlvar node type="string">
</dtml-if><dtml-if section>AND section.relative_url = <dtml-sqlvar section type="string">
</dtml-if><dtml-if node_category>AND node_c.relative_url = <dtml-sqlvar node_category type="string">
......@@ -74,6 +84,7 @@ AND resource_membership.uid = resource.uid
</dtml-if><dtml-if query>AND category.uid = node.uid
AND <dtml-var query></dtml-if>
GROUP BY
stock.node_uid, stock.section_uid, movement.resource_uid, movement.variation_text
<dtml-if group_by_node>stock.node_uid, </dtml-if><dtml-if group_by_section>stock.section_uid, </dtml-if>movement.resource_uid<dtml-if group_by_variation>, movement.variation_text</dtml-if>
ORDER BY
node.title, resource.title, movement.variation_text
\ No newline at end of file
node.title, resource.title, movement.variation_text
......@@ -15,7 +15,7 @@ node_uid
section_uid
node
section
variation_text
variation_text=None
node_category
section_category
resource_category
......@@ -48,13 +48,16 @@ SELECT
movement.delivery_uid AS explanation_uid,
catalog.simulation_state AS simulation_state
FROM
catalog, movement, stock, catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
movement
LEFT JOIN catalog ON (movement.uid = catalog.uid)
LEFT JOIN stock ON (movement.uid = stock.uid),
catalog AS node, catalog AS section, catalog AS resource <dtml-if node_category>, catalog AS node_c, catalog AS node_bc, category AS node_membership </dtml-if> <dtml-if section_category>, catalog AS section_c, catalog AS section_bc, category AS section_membership</dtml-if> <dtml-if resource_category>, catalog AS resource_c, catalog AS resource_bc, category AS resource_membership </dtml-if> <dtml-if query>, category </dtml-if>
WHERE
catalog.uid = movement.uid
AND catalog.uid = stock.uid
AND node.uid = stock.node_uid
AND section.uid = stock.section_uid
AND stock.resource_uid = resource.uid
AND movement.resource_uid = resource.uid
<dtml-if resource>AND (<dtml-in resource> resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if><dtml-if resource_uid>AND (<dtml-in resource_uid> movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>)
</dtml-if>AND movement.is_accountable = 1
......@@ -62,7 +65,7 @@ AND stock.resource_uid = resource.uid
</dtml-if><dtml-if section_uid>AND stock.section_uid = <dtml-sqlvar section_uid type="int">
</dtml-if><dtml-if from_date>AND movement.stop_date >= <dtml-sqlvar from_date type="string">
</dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if><dtml-if variation_text>AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if "variation_text is not None">AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if><dtml-if omit_simulation>AND catalog.portal_type != "Simulation Movement"
</dtml-if><dtml-if omit_input>AND stock.quantity < 0
</dtml-if><dtml-if omit_output>AND stock.quantity > 0
......
......@@ -57,13 +57,13 @@
<field><id>listbox</id> <type>ListBox</type>
<values>
<all_columns type="list">[]</all_columns>
<all_columns type="list">[('node_title', 'Stock'), ('section_title', 'Propri\xe9taire'), ('variation_text', 'Variante'), ('getCurrentInventory', 'Stock'), ('getAvailableInventory', 'Dispo'), ('inventory', 'Futur')]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('node_title', 'Stock'), ('section_title', 'Propri\xe9taire'), ('variation_text', 'Variante'), ('getCurrentInventory', 'Stock'), ('getAvailableInventory', 'Dispo'), ('inventory', 'Futur')]</columns>
<columns type="list">[('node_title', 'Stock'), ('variation_text', 'Variante'), ('getCurrentInventory', 'Stock'), ('getAvailableInventory', 'Dispo'), ('inventory', 'Futur')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
<default_params type="list">[('group_by_section', '0')]</default_params>
<description></description>
<domain_root_list type="list">[('portal_categories/site/Stock_MP', 'Stocks MP'), ('portal_categories/site', 'Sites')]</domain_root_list>
<domain_tree type="int">1</domain_tree>
......
......@@ -37,9 +37,9 @@
<report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree>
<search type="int">1</search>
<search_columns></search_columns>
<search_columns type="list">[]</search_columns>
<select type="int">1</select>
<selection_name>modele_selection</selection_name>
<selection_name>assortiment_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<stat_method></stat_method>
<title>Assortiments</title>
......
......@@ -122,6 +122,30 @@
<message name="too_long">You entered too many characters.</message>
</messages>
</field>
<field><id>my_option_forme</id> <type>MultiListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default type="list">[]</default>
<description></description>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>Options</title>
</values>
<tales>
<default>here/getOptionFormeList</default>
<items>here/portal_categories/option_forme/getFormItemList</items>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
</fields>
</group>
<group>
......@@ -164,7 +188,7 @@
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>Espace Imaginaire</title>
<title>Famille</title>
</values>
<tales>
<default>here/getEipList</default>
......@@ -176,6 +200,23 @@
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_present_au_catalogue</id> <type>CheckBoxField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default type="int">0</default>
<description></description>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<title>Prsent au catalogue</title>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
</messages>
</field>
<field><id>etat</id> <type>StringField</type>
<values>
<alternate_name></alternate_name>
......
......@@ -106,7 +106,7 @@
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>Espace Imaginaire</title>
<title>Famille</title>
</values>
<tales>
<default>here/getEipList</default>
......
......@@ -126,7 +126,7 @@
<td>
<table class="border" width="100%">
<tr>
<td align="left"><b>Nomenclature</b></td>
<td align="left"><b>Nomenclature Prototype</b></td>
</tr>
<tr tal:define="nomenclature_list python:modules['string'].split(here.getModeleAggregatedNomenclature()+here.getNomenclature(''),'\n')">
<td width="100%"> <span tal:repeat="nomenclature_item nomenclature_list">
......@@ -134,7 +134,7 @@
</span> </td>
</tr>
<tr>
<td align="left"><b>Mode opratoire</b></td>
<td align="left"><b>Mode opratoire Prototype</b></td>
</tr>
<tr tal:define="nomenclature_list python:modules['string'].split(here.getModeleAggregatedModeOperatoire()+here.getModeOperatoire(''),'\n')">
<td width="100%"> <span tal:repeat="nomenclature_item nomenclature_list">
......@@ -199,6 +199,13 @@
</table>
</span></td>
</tr>
<tr>
<td colspan="2" align="left"><b>Composition</b></td>
</tr>
<tr>
<td width="100%"> <span tal:content="python:here.getComposition('')"> </span><br>
</td>
</tr>
</table></td>
<td><img src="spacer.png" width="1" height="100%"></td>
</tr>
......@@ -220,13 +227,13 @@
<tr> <!-- Commentaires -->
<td><img src="spacer.png" width="1" height="100%"></td>
<td><table class="border" width="100%">
<tr>
<tr>
<td colspan="2" align="left"><b>Commentaires</b></td>
</tr>
<tr tal:define="commentaires_list python:modules['string'].split(here.getCommentaires(''),'\n')">
<td width="100%"> <span tal:repeat="commentaires_item commentaires_list">
<span tal:content="python:commentaires_item"> </span><br>
</span> </td>
<tr tal:define="commentaires_list python:modules['string'].split(here.getCommentaires(''),'\n')">
<td width="100%"> <span tal:repeat="commentaires_item commentaires_list">
<span tal:content="python:commentaires_item"> </span><br>
</span> </td>
</tr>
</table></td>
<td><img src="spacer.png" width="1" height="100%"></td>
......
......@@ -353,7 +353,7 @@
<items type="list">[]</items>
<required type="int">1</required>
<size type="int">1</size>
<title>Espace imaginaire</title>
<title>Famille</title>
</values>
<tales>
<items>here/portal_categories/eip/getFormItemList</items>
......
......@@ -351,7 +351,7 @@
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>Espace imaginaire</title>
<title>Famille</title>
</values>
<tales>
<default>here/getEipList</default>
......
......@@ -2,18 +2,18 @@
<form>
<title>Liste de vtements</title>
<name>vetement_search_list</name>
<name>vetement_list</name>
<action></action>
<enctype></enctype>
<method>POST</method>
<pt>vetement_list</pt>
<pt>form_list</pt>
<groups>
<group>
<title>Default</title>
<fields>
<field><id>search_list</id> <type>ListBox</type>
<field><id>listbox</id> <type>ListBox</type>
<values>
<all_columns type="list">[('id', 'V\xeatement'), ('relative_url', "Chemin d'acc\xe8s"), ('Description', 'Description')]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
......@@ -34,16 +34,16 @@
<lines type="int">50</lines>
<list_action>list</list_action>
<list_cookie>SEARCH_LIST</list_cookie>
<list_method type="method">portal_catalog</list_method>
<list_method type="method">searchFolder</list_method>
<meta_types type="list">[]</meta_types>
<portal_types type="list">[('Vetement', 'Vetement')]</portal_types>
<report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree>
<reverse type="int">0</reverse>
<search type="int">1</search>
<search_columns></search_columns>
<search_columns type="list">[]</search_columns>
<select type="int">1</select>
<selection_name></selection_name>
<selection_name>vetement_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<stat_method></stat_method>
<title>Vtements</title>
......
......@@ -50,7 +50,7 @@
<hidden type="int">0</hidden>
<max_length></max_length>
<required type="int">0</required>
<title>Librairie</title>
<title>Fichier Lectra</title>
<truncate type="int">0</truncate>
</values>
<tales>
......@@ -88,6 +88,39 @@
<message name="too_long">You entered too many characters.</message>
</messages>
</field>
<field><id>my_forme_id_list</id> <type>MultiRelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>specialise</base_category>
<catalog_index>id</catalog_index>
<css_class></css_class>
<default type="list">[]</default>
<default_module>forme</default_module>
<description></description>
<external_validator></external_validator>
<extra></extra>
<height type="int">5</height>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<max_linelength></max_linelength>
<max_lines></max_lines>
<portal_type type="list">[('Forme', 'Forme')]</portal_type>
<required type="int">0</required>
<title>Formes concernes</title>
<update_method>base_update_relation</update_method>
<width type="int">20</width>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_many_lines">You entered too many lines.</message>
<message name="line_too_long">A line was too long.</message>
<message name="too_long">You entered too many characters.</message>
</messages>
</field>
<field><id>my_base_taille</id> <type>ListField</type>
<values>
<alternate_name></alternate_name>
......@@ -112,24 +145,29 @@
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>vetement_state</id> <type>StringField</type>
<field><id>my_correspondance_id</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>specialise</base_category>
<catalog_index>id</catalog_index>
<css_class></css_class>
<default></default>
<default_module>correspondance_mesures</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Correspondance Mesures', 'Correspondance Mesures')]</portal_type>
<required type="int">0</required>
<title>Etat</title>
<title>Correspondance mesures</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
<default>python:here.portal_workflow.getInfoFor(here, 'vetement_state')</default>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......@@ -137,29 +175,24 @@
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_specialise_id</id> <type>RelationStringField</type>
<field><id>vetement_state</id> <type>StringField</type>
<values>
<alternate_name></alternate_name>
<base_category>specialise</base_category>
<catalog_index>id</catalog_index>
<css_class></css_class>
<default></default>
<default_module>correspondance_mesures</default_module>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length>
<portal_type type="list">[('Correspondance Mesures', 'Correspondance Mesures')]</portal_type>
<required type="int">0</required>
<title>Correspondance mesures</title>
<title>Etat</title>
<truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values>
<tales>
<default>python:here.portal_workflow.getInfoFor(here, 'vetement_state')</default>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......@@ -221,6 +254,23 @@
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_present_au_catalogue</id> <type>CheckBoxField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default type="int">0</default>
<description></description>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<title>Prsent au catalogue</title>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
</messages>
</field>
</fields>
</group>
<group>
......
......@@ -4,7 +4,7 @@
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##parameters=printer_name=''
##title=
##
from Products.Coramy.MetoAPI import selectMeter, startFormat, setDecoration, setPrintSpeed, setPaperSpeed, setPixel, setTemparature, setNumber, endFormat, printText, printLine, printFrame, setAsdFont
......@@ -36,7 +36,7 @@ def chaine(num, div):
raw_string = ''
container = context
"""
# selecting printer (user dependent)
local_user = container.portal_membership.getAuthenticatedMember().getUserName()
if local_user == 'Nicole_Denis' :
......@@ -47,11 +47,16 @@ elif local_user == 'Jocelyne_Olejarz' :
printer_name = 'Meto_XS40_4'
elif local_user == 'Nathalie_Wadoux' :
printer_name = 'Meto_XS40_5'
elif local_user == 'Joelle_Gorriez':
printer_name = 'Meto_XS40_6'
elif local_user == 'Chantal_Hannequin' :
printer_name = 'Meto_XS40_5'
elif local_user == 'Gaelle_Manier' :
printer_name = 'Meto_XS40_6'
else :
printer_name = 'Meto_XS40_2'
"""
delivery = container.aq_parent
# Destination
......
......@@ -4,13 +4,16 @@
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##parameters=user_name=None
##title=
##
# get the name of the printer
printer_name = context.Coramy_userLabelPrinterDefinition(user_name=user_name)
# print container label
container = context
if container.aq_parent.getDeliveryMode() == 'Transporteur/Extand' :
container.Container_printExtandLabel()
container.Container_printExtandLabel(printer_name=printer_name)
else :
container.Container_printMetoLabel()
container.Container_printMetoLabel(printer_name=printer_name)
......@@ -4,14 +4,14 @@
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##parameters=printer_name=''
##title=
##
from Products.Coramy.MetoAPI import selectMeter, startFormat, setDecoration, setPrintSpeed, setPaperSpeed, setPixel, setTemparature, setNumber, endFormat, printText, printLine, printFrame, setAsdFont
raw_string = ''
container = context
"""
# selecting printer (user dependent)
local_user = container.portal_membership.getAuthenticatedMember().getUserName()
if local_user == 'Nicole_Denis' :
......@@ -22,11 +22,15 @@ elif local_user == 'Jocelyne_Olejarz' :
printer_name = 'Meto_XS40_4'
elif local_user == 'Nathalie_Wadoux' :
printer_name = 'Meto_XS40_5'
elif local_user == 'Joelle_Gorriez':
printer_name = 'Meto_XS40_6'
elif local_user == 'Chantal_Hannequin' :
printer_name = 'Meto_XS40_5'
elif local_user == 'Gaelle_Manier' :
printer_name = 'Meto_XS40_6'
else :
printer_name = 'Meto_XS40_2'
"""
delivery = container.aq_parent
client_title = delivery.getDestinationValue(portal_type=['Organisation']).getTitle()
client_address_items = delivery.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().asText(country='France').split('\n')
......@@ -67,7 +71,9 @@ raw_string += printText(2, "9", 0, 0, 3, 46, 131, '', 10)
raw_string += printText(2, "9", 0, 0, 1, 5, 131, delivery.getId(), 10)
raw_string += printText(2, "9", 0, 0, 1, 5, 86, str(container.getIntIndex()), 10)
raw_string += printText(2, "9", 0, 0, 1, 5, 46, delivery.getDeliveryMode(), 10)
if delivery.getDeliveryMode() != None:
raw_string += printText(2, "9", 0, 0, 1, 5, 46, delivery.getDeliveryMode(), 10)
raw_string += printText(4, "d", 8, 2, 220, 37, 8, container.getSerialNumber(), 10)
......
......@@ -36,7 +36,7 @@ def chaine(num, width):
object_list = context.object_action_list(selection_name='sales_packing_list_selection')
for delivery in object_list:
try:
if delivery.getDeliveryMode() == 'Transporteur/Extand':
# Destination
......@@ -57,8 +57,11 @@ for delivery in object_list:
client_zip_code = delivery.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().getZipCode()
client_tel = delivery.getDestinationValue(portal_type=['Organisation']).getDefaultTelephone().asText().split('\n')[0]
client_tel = delivery.getDestinationValue(portal_type=['Organisation']).getDefaultTelephone()
if client_tel != None:
client_tel = client_tel.asText().split('\n')[0]
else:
client_tel = ''
......@@ -87,7 +90,10 @@ for delivery in object_list:
msg += plat+"001000"+decoupe( num_com_client ,80)+decoupe(client_title ,32)+decoupe(client_address_1,32)
msg += decoupe(client_address_2,32)+decoupe(client_address_3,32)+decoupe(client_zip_code,10)
msg += decoupe(client_city,32)+decoupe(client_tel,16)+'\r\n'
except:
message='Erreur+sur+la+livraison:+identifiant+%s.' % (delivery.getId())
redirect_url = '%s?%s%s' % ( context.absolute_url()+'/view', 'portal_status_message=',message)
request[ 'RESPONSE' ].redirect( redirect_url )
request.RESPONSE.setHeader('Content-Type','application/text')
return msg
......@@ -36,6 +36,8 @@ if order.getPortalType() == 'Purchase Order' :
filter_dict = {'portal_type': 'Purchase Order Line'}
elif order.getPortalType() == 'Sales Order':
filter_dict = {'portal_type': 'Sales Order Line'}
elif order.getPortalType() == 'Packing Order':
filter_dict = {'portal_type': 'Packing Order Line'}
else :
filter_dict = {'portal_type': 'Production Order Line'}
order_line_list = order.contentValues(filter=filter_dict)
......
......@@ -36,6 +36,7 @@ for container in ordered_container_list :
# reset variables
container_object = container
first_container = container.getIntIndex()
container_ref = container.getContainerText()
last_container = container.getIntIndex()
# append final container in final_container_list
......
......@@ -277,7 +277,7 @@ sales_order.sales_order_apply_condition(my_id, 1)
# and this is the end ....
if batch_mode:
#return sales_order.getComment()
return (sales_order.getUid(),sales_order.getComment())
return (sales_order.getId(),sales_order.getComment())
else:
redirect_url = '%s?%s' % ( item_module.absolute_url()+'/'+my_id+'/'+'view', 'portal_status_message=Commande+Vente+créée.')
request[ 'RESPONSE' ].redirect( redirect_url )
......@@ -3,7 +3,7 @@
<form>
<title>Importer</title>
<name>SalesOrder_importEdiForm</name>
<action>SalesOrder_importEdiFiles</action>
<action>SalesOrder_importEdiFileList</action>
<enctype>multipart/form-data</enctype>
<method>POST</method>
<pt>form_dialog</pt>
......
......@@ -30,6 +30,8 @@ def decoupe(s,width):
result_tmp = rjust(s,width)
return result_tmp
request=context.REQUEST
retour_chariot = "\r\n"
result = ""
......@@ -52,9 +54,28 @@ result += "DTM_DATE_LIVR_DEMANDE:"+sales_order.getTargetStopDate().strftime("%Y%
result += "DTM_DATE_HEURE_EXPE__:"+context.getTargetStartDate().strftime("%Y%m%d%H%M")+retour_chariot
try:
result += "RFF_NUMERO_COMMANDE__:"+ sales_order.getDestinationReference() +retour_chariot
except:
if not batch_mode:
message="Erreur+sur+la+facture:+il+n\'y+a+pas+de+numro+de+commande+sur+la+commande"
redirect_url = '%s?%s%s' % ( context.absolute_url()+'/view', 'portal_status_message=',message)
request[ 'RESPONSE' ].redirect( redirect_url )
return None
else:
return None
try:
result += "RFF_DATE_COMMANDE____:"+ sales_order.getDateReception().strftime("%Y%m%d") +retour_chariot
except:
if not batch_mode:
message="Erreur+sur+la+facture:+il+n\'y+a+pas+de+date+de+rception+sur+la+commande"
redirect_url = '%s?%s%s' % ( context.absolute_url()+'/view', 'portal_status_message=',message)
request[ 'RESPONSE' ].redirect( redirect_url )
return None
else:
return None
result += "RFF_NUMERO_COMMANDE__:"+ sales_order.getDestinationReference() +retour_chariot
result += "RFF_DATE_COMMANDE____:"+ sales_order.getDateReception().strftime("%Y%m%d") +retour_chariot
# XXX
result += "RFF_BON_LIVRAISON____:"+ context.getId() +retour_chariot
......@@ -73,6 +94,15 @@ if len(list) > 0:
ean_destination = sales_order.getDestinationDecisionValue(portal_type=['Organisation']).getEan13Code()
if ean_destination in (None,''):
if not batch_mode:
message="Erreur+sur+la+facture:+il+n\'y+a+pas+de+code+ean+sur+l\'organisation:+command+par."
redirect_url = '%s?%s%s' % ( context.absolute_url()+'/view', 'portal_status_message=',message)
request[ 'RESPONSE' ].redirect( redirect_url )
return None
else:
return None
result += "NAD_EMETTEUR_CDE_____:"+ ean_destination + retour_chariot
result += "NAD_INTER_A_LIVRER___:"+ ean_destination + retour_chariot
result += "NAD_DEST_MESSAGE_____:"+ ean_destination + retour_chariot
......@@ -86,7 +116,7 @@ result += "TDT_DETAIL_TRANSPORT_:"+"3031"+retour_chariot
send_quantity_dict = {}
packing_list_movement_list = context.getMovementList()
for movement in packing_list_movement_list:
send_quantity_dict[ movement.Amount_getCodeEan13Client() ] = int (movement.getTargetQuantity())
send_quantity_dict[ movement.Amount_getCodeEan13Client() ] = int(movement.getTargetQuantity())
# [ (ean13code, difference) ]
difference_quantity_list = []
......@@ -94,7 +124,7 @@ sales_order_movement_list = sales_order.getMovementList()
for movement in sales_order_movement_list:
desired_quantity = int (movement.getTargetQuantity() )
desired_quantity = int(movement.getTargetQuantity() )
eanCode = movement.Amount_getCodeEan13Client()
try:
send_quantity = send_quantity_dict[ eanCode ]
......
......@@ -11,19 +11,17 @@
request = context.REQUEST
object_list = context.object_action_list(selection_name='sales_packing_list_selection')
export_file_list = []
result = ""
for order in object_list:
# some verifications have to be done
# XXX
# export the container
result += order.SalesPackingList_exportEdi( batch_mode = 1)
# XXX
#context.portal_activities.newMessage('SQLDict', object.getAbsoluteUrl(), {}, 'Container_exportEdi')
try:
# export the container
result += order.SalesPackingList_exportEdi( batch_mode = 1)
except:
message='Erreur+sur+la+livraison:+identifiant+%s.' % (order.getId())
redirect_url = '%s?%s%s' % ( context.absolute_url()+'/view', 'portal_status_message=',message)
request[ 'RESPONSE' ].redirect( redirect_url )
# and this is the end ....
if batch_mode:
......
......@@ -36,6 +36,7 @@ WHERE condition.portal_type="Condition Vente"
AND condition.uid = cat1.uid
AND cat1.category_uid = "<dtml-var source_section_uid>"
AND cat1.base_category_uid = <dtml-var "portal_categories.source_section.uid">
AND cat1.category_strict_membership = 1
</dtml-if>
<dtml-if expr="destination_uid<>''">
......
......@@ -13,4 +13,4 @@ SELECT DISTINCT id, relative_url, path, Description
FROM catalog
WHERE portal_type = "<dtml-var portal_type>"
AND Title REGEXP "<dtml-var title>"
\ No newline at end of file
AND Title = "<dtml-var title>"
\ No newline at end of file
......@@ -15,13 +15,13 @@
<field><id>listbox</id> <type>ListBox</type>
<values>
<all_columns type="list">[('id', 'Identifiant'), ('reference', 'Num\xe9ro de facture'), ('destination_administration_organisation_title', 'Factur\xe9e \xe0'), ('causality_id', 'Livraison vente'), ('description', 'Description'), ('simulation_state', 'Etat')]</all_columns>
<all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('id', 'Identifiant'), ('reference', 'Num\xe9ro de facture'), ('destination_administration_organisation_title', 'Factur\xe9e \xe0'), ('causality_id', 'Livraison vente'), ('description', 'Description'), ('simulation_state', 'Etat')]</columns>
<columns type="list">[('id', 'Identifiant'), ('reference', 'N\xb0 facture'), ('default_source_section_title', 'Soci\xe9t\xe9'), ('description', 'Description'), ('default_destination_administration_organisation_title', 'Facturer \xe0'), ('default_causality_id', 'Livraison'), ('default_destination_title', 'Livrer \xe0'), ('simulation_state', 'Etat')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[('id', "''")]</default_params>
<default_params type="list">[('reference', "''")]</default_params>
<description></description>
<domain_root_list type="list">[]</domain_root_list>
<domain_tree type="int">0</domain_tree>
......@@ -40,7 +40,7 @@
<search_columns type="list">[('id', 'Identifiant'), ('reference', 'Num\xe9ro de facture'), ('destination_administration_organisation_title', 'Factur\xe9e \xe0'), ('causality_id', 'Livraison vente'), ('description', 'Description'), ('simulation_state', 'Etat')]</search_columns>
<select type="int">1</select>
<selection_name>order_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<sort type="list">[('reference', 'reference')]</sort>
<stat_method></stat_method>
<title>Factures</title>
</values>
......@@ -53,4 +53,4 @@
</fields>
</group>
</groups>
</form>
\ No newline at end of file
</form>
......@@ -55,7 +55,7 @@ if len(condition_list) == 0 :
# s'il y a plus d'une condition trouvee, on essaye de réduire le choix
# en intégrant un critère de recherche sur 'destination_decision'
elif len(condition_list) > 1 :
condition_list = order.condition_vente_sql_search(source_section_uid=my_source_section_uid, destination_uid=my_destination_uid, group_uid="", destination_decision_uid=my_destination_decision)
condition_list = order.condition_vente_sql_search(source_section_uid=my_source_section_uid, destination_uid=my_destination_uid, group_uid="", destination_decision_uid=my_destination_decision_uid)
# resultat des courses sur le recherche
if len(condition_list ) == 0 :
......
......@@ -83,7 +83,7 @@
</TD>
<TD align="left"
tal:condition="python:container_template[1][0]<>container_template[1][1]">
<b tal:content="python:'Colis %s %s'%(container_template[1][0],container_template[1][1])"/>
<b tal:content="python:'Colis %s a %s'%(container_template[1][0],container_template[1][1])"/>
</TD>
<TD tal:attributes="colspan python:taille_qty+1" align="center">Quantits rparties par tailles</TD>
</TR>
......
......@@ -471,6 +471,7 @@
<select type="int">0</select>
<selection_name>container_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<sort_columns type="list">[]</sort_columns>
<stat_method></stat_method>
<title>Colis</title>
</values>
......
......@@ -83,7 +83,7 @@
<SPAN tal:condition="python:len(morphologie_list)==0"
tal:define="taille_list python:delivery_line.Variated_getTailleList(correspondance_tailles)"><!-- S'Il N'Y A PAS DE VARIANTES MORPHOLOGIQUES -->
<TR tal:condition="python:1">
<TD nowrap><SPAN tal:content="python:'Modle : %s' %delivery_line.getResourceValue().getId()"/></TD>
<TD nowrap><SPAN tal:content="python:'Modle : %s / %s' % (delivery_line.getResourceValue().getId() , delivery_line.getResourceValue().getDestinationReference(''))"/></TD>
<TD rowspan="2" align="center" tal:repeat="index python:range(taille_qty)"
tal:content="python:taille_list[1][index]">36</TD><!-- BOUCLE SUR LE NB DE TAILLES -->
<TD align="center" rowspan="2" nowrap>Total</TD>
......
......@@ -231,6 +231,31 @@
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>destination_address</id> <type>StringField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">1</hidden>
<max_length></max_length>
<required type="int">0</required>
<title>Lieu livraison : inconnu</title>
<truncate type="int">0</truncate>
</values>
<tales>
<title>python: 'Lieu livraison : %s %s' % (here.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().getZipCode(),here.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().getCity())</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="too_long">Too much input was given.</message>
</messages>
</field>
<field><id>my_start_date</id> <type>DateTimeField</type>
<values>
<alternate_name></alternate_name>
......@@ -248,7 +273,7 @@
<title>Date d'expdition prvue</title>
</values>
<tales>
<title>python:'Expdition prvue le : %s' % here.getStartDate()</title>
<title>python:'Expdition prvue le : ' + here.getStartDate().strftime('%d/%m/%Y')</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......@@ -299,7 +324,7 @@
<title>Date de livraison prvue</title>
</values>
<tales>
<title>python:'Livraison prvue le : %s' % here.getStopDate()</title>
<title>python:'Livraison prvue le : ' + here.getStopDate().strftime('%d/%m/%Y')</title>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
......
......@@ -112,18 +112,26 @@ class Group(Implicit):
def __init__(self, movement):
self.movement_list = []
self.quantity_unit = movement.getQuantityUnit()
#self.quantity_unit = movement.getQuantityUnit() # This is likely an error JPSforYO
resource_value = movement.getResourceValue()
if resource_value is not None:
self.quantity_unit = resource_value.getDefaultQuantityUnit()
else:
self.quantity_unit = movement.getQuantityUnit() # Meaningless XXX ?
self.resource = movement.getResource()
self.resource_id = movement.getResourceId()
self.resource_title = movement.getResourceTitle()
self.variation_base_category_list = movement.getVariationBaseCategoryList()
self.total_price = movement.getTotalPrice()
self.total_quantity = movement.getTotalQuantity()
# self.total_price = movement.getTotalPrice() # This is likely an error JPSforYO
# self.total_quantity = movement.getTotalQuantity() # This is likely an error JPSforYO
self.total_price = 0.0 # No need to add twice since we add it in append
self.total_quantity = 0.0 # No need to add twice since we add it in append
self.matrix = XMLMatrix(None)
self.append(movement)
def test(self, movement):
if movement.getResourceId() == self.resource_id and \
# Use resource rather than resource_id JPSforYO
if movement.getResource() == self.resource and \
movement.getVariationBaseCategoryList() == self.variation_base_category_list:
return 1
else:
......@@ -132,6 +140,13 @@ class Group(Implicit):
def append(self, movement):
if not movement in self.movement_list:
self.movement_list.append(movement)
self.total_price += movement.getTotalPrice() # XXX Something should be done wrt to currency
# If one order has beed negociated in USD and anotehr in EUR, then there is no
# way to merge invoices. Multiple invoices must be produced
# This may require serious extensions to this code
# ie. N deliveries result in M invoices (1 invoice per currency)
#self.total_quantity += movement.getTotalQuantity() # This is likely an error JPSforYO
self.total_quantity += movement.getInventoriatedQuantity()
def finish(self):
# Make up a list of cell ranges for setCellRange.
......@@ -172,6 +187,13 @@ class Group(Implicit):
cell._setPrice(cell.getPrice() / float(quantity))
else:
cell._setPrice(0.0) # if quantity is zero, price is et to 0.0 as a convention
# Normalize self price also JPSforYO
quantity = self.total_quantity
if quantity:
self.price = self.total_price / float(quantity)
else:
self.price = 0.0
LOG('Group', 0, repr(self.total_price), repr(self.total_quantity))
InitializeClass(Group)
#allow_class(Group)
......@@ -918,50 +940,52 @@ une liste de mouvements..."""
if movement_group is not None:
for group in movement_group:
# Create each invoice_line in the new invoice.
invoice_line = self.newContent(portal_type = 'Invoice Line',
resource = group.resource,
quantity_unit = group.quantity_unit) # FIXME: more args
invoice_line_list.append(invoice_line)
# Make sure that the order is always preserved.
variation_base_category_list = list(group.variation_base_category_list)
variation_base_category_list.sort()
invoice_line.setVariationBaseCategoryList(variation_base_category_list)
#LOG('buildInvoiceLineList', 0, "group.variation_base_category_list = %s" % str(group.variation_base_category_list))
variation_category_list = []
for cell_key in group.matrix.getCellKeyList(base_id='movement'):
for variation_category in cell_key:
if variation_category not in variation_category_list:
variation_category_list.append(variation_category)
invoice_line.setVariationCategoryList(variation_category_list)
# IMPORTANT : delivery cells are automatically created during setVariationCategoryList
#LOG('buildInvoiceLineList', 0, "invoice_line.contentValues() = %s" % str(invoice_line.contentValues()))
if len(variation_category_list) > 0:
for invoice_cell in invoice_line.contentValues(filter={'portal_type':'Invoice Cell'}):
category_list = invoice_cell.getVariationCategoryList()
# XXX getVariationCategoryList does not return the same order as setVariationBaseCategoryList
point = []
for base_category in group.variation_base_category_list:
for category in category_list:
if category.startswith(base_category + '/'):
point.append(category)
break
kw_list = {'base_id' : 'movement'}
cell = apply(group.matrix.getCell, point, kw_list)
#LOG('buildInvoiceLineList', 0,
# "point = %s, cell = %s" % (str(point), str(cell)))
if cell is not None:
# Create each invoice_line in the new invoice
# but only if quantity > 0
if group.total_quantity > 0 :
invoice_line = self.newContent(portal_type = 'Invoice Line',
resource = group.resource,
quantity_unit = group.quantity_unit) # FIXME: more args
invoice_line_list.append(invoice_line)
# Make sure that the order is always preserved.
variation_base_category_list = list(group.variation_base_category_list)
variation_base_category_list.sort()
invoice_line.setVariationBaseCategoryList(variation_base_category_list)
#LOG('buildInvoiceLineList', 0, "group.variation_base_category_list = %s" % str(group.variation_base_category_list))
variation_category_list = []
for cell_key in group.matrix.getCellKeyList(base_id='movement'):
for variation_category in cell_key:
if variation_category not in variation_category_list:
variation_category_list.append(variation_category)
invoice_line.setVariationCategoryList(variation_category_list)
# IMPORTANT : delivery cells are automatically created during setVariationCategoryList
#LOG('buildInvoiceLineList', 0, "invoice_line.contentValues() = %s" % str(invoice_line.contentValues()))
if len(variation_category_list) > 0:
for invoice_cell in invoice_line.contentValues(filter={'portal_type':'Invoice Cell'}):
category_list = invoice_cell.getVariationCategoryList()
# XXX getVariationCategoryList does not return the same order as setVariationBaseCategoryList
point = []
for base_category in group.variation_base_category_list:
for category in category_list:
if category.startswith(base_category + '/'):
point.append(category)
break
kw_list = {'base_id' : 'movement'}
cell = apply(group.matrix.getCell, point, kw_list)
#LOG('buildInvoiceLineList', 0,
# "quentity = %s, price = %s" % (str(cell.getQuantity()), str(cell.getPrice())))
invoice_cell.edit(quantity = cell.getQuantity(),
price = cell.getPrice(),
force_update = 1)
else:
# There is no variation category.
invoice_line.edit(quantity = group.total_quantity,
price = group.total_price,
force_update = 1)
# "point = %s, cell = %s" % (str(point), str(cell)))
if cell is not None:
#LOG('buildInvoiceLineList', 0,
# "quentity = %s, price = %s" % (str(cell.getQuantity()), str(cell.getPrice())))
invoice_cell.edit(quantity = cell.getQuantity(),
price = cell.getPrice(),
force_update = 1)
else:
# There is no variation category.
invoice_line.edit(quantity = group.total_quantity,
price = group.price,
force_update = 1) # Use unit price JPSforYO
return invoice_line_list
......@@ -205,15 +205,10 @@ Une ligne tarifaire."""
security.declareProtected( Permissions.AccessContentsInformation, 'getInventory' )
def getInventory(self):
"""
Returns the quantity if defined on the cell
or acquire it
No acquisition for inventories: either defined or None
"""
# Call a script on the context
if 'inventory' in self.getMappedValuePropertyList([]):
if getattr(aq_base(self), 'inventory', None) is not None:
return getattr(self, 'inventory')
else:
return self.aq_parent.getProperty('inventory')
return getattr(aq_base(self), 'inventory', None)
else:
return None # return None
......
......@@ -139,7 +139,10 @@ An ERP5 Rule..."""
# Only expand if my_order is not None and state is not 'confirmed'
if my_order is not None:
if my_order.getSimulationState() not in ('confirmeda', 'delivered'):
# Only expand order rule if order not yet confirmed (This is consistent
# with the fact that once simulation is launched, we stick to it)
if my_order.getSimulationState() not in reserved_inventory_state_list and \
my_order.getSimulationState() not in current_inventory_state_list:
# First, check each contained movement and make
# a list of order ids which do not need to be copied
# eventually delete movement which do not exist anylonger
......
......@@ -296,6 +296,7 @@ a service in a public administration)."""
"""
Returns list of future inventory grouped by section or site
"""
LOG('getFutureInventoryList',0,str(kw))
return self.getInventoryList(at_date=None, section=section, node=node,
node_category=node_category, section_category=section_category, **kw)
......@@ -506,9 +507,9 @@ a service in a public administration)."""
context = self.asContext(context=context, REQUEST=REQUEST, **kw)
result = self._getIndustrialPrice(context)
if result is None:
self._updateIndustrialPrice()
self._updateIndustrialPrice(context)
result = self._getIndustrialPrice(context)
return result
return result
def _getIndustrialPrice(self, context):
# Default value is None
......
......@@ -34,7 +34,7 @@ from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Core import MetaNode, MetaResource
from Movement import Movement
from Products.ERP5.Document.Movement import Movement
from zLOG import LOG
......
......@@ -161,6 +161,7 @@ An ERP5 Rule..."""
if type(source) is type('a'):
if source.find('site/Stock_PF/Gravelines') >= 0 :
return 1
return 0
# Simulation workflow
......
......@@ -40,7 +40,7 @@ node_type_list = ('Organisation','Person','Category','MetaNode',)
invoice_type_list = ('Invoice', 'Sale Invoice', 'Sales Invoice', 'Sale Invoice Transaction')
order_type_list = ('Order', 'Project', 'Samples Order',
'Production Order', 'Purchase Order', 'Sale Order',
'Packing Order','Production Order', 'Purchase Order', 'Sale Order',
'Sales Order', )
delivery_type_list = ('Delivery',
......@@ -76,6 +76,7 @@ order_movement_type_list = (
'Sale Order Line',
'Sample Order Line',
'Production Order Line',
'Packing Order Line',
'Delivery Cell',
) # Delivery Cell is both used for orders and deliveries XXX
......
......@@ -88,12 +88,20 @@ class InventoryListBrain(ZSQLBrain):
def getInventory(self, at_date = None, ignore_variation=0, simulation_state=None, **kw):
if type(simulation_state) is type('a'):
simulation_state = [simulation_state]
result = self.Resource_zGetInventory( resource_uid = [self.resource_uid],
if getattr(self, 'group_by_section', 1):
result = self.Resource_zGetInventory( resource_uid = [self.resource_uid],
to_date=at_date,
section=self.section_relative_url,
node=self.node_relative_url,
variation_text = self.variation_text,
simulation_state=simulation_state)
else:
result = self.Resource_zGetInventory( resource_uid = [self.resource_uid],
to_date=at_date,
section_category=self.section_category,
node=self.node_relative_url,
variation_text = self.variation_text,
simulation_state=simulation_state)
inventory = None
if len(result) > 0:
inventory = result[0].inventory
......@@ -180,8 +188,8 @@ class InventoryListBrain(ZSQLBrain):
url_params_string
)
elif cname_id in ('getCurrentInventory',):
resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url)
return '%s/Resource_movementHistoryView?%s&reset=1' % (resource.absolute_url(),
resource = self.portal_categories.unrestrictedTraverse(self.resource_relative_url)
return '%s/Resource_movementHistoryView?%s&reset=1' % (resource.absolute_url(),
make_query(variation_text=self.variation_text, selection_name=selection_name, selection_index=selection_index,
simulation_state=list(current_inventory_state_list)))
elif cname_id in ('getAvailableInventory',):
......
......@@ -48,6 +48,10 @@ class Reference:
'description' : 'The references of the document for default destinations',
'type' : 'string',
'mode' : 'w' },
{ 'id' : 'document_reference', # XXX ERROR - we already have a reference
'description' : 'The references of the document itself',
'type' : 'string',
'mode' : 'w' },
)
_categories = ()
......
......@@ -241,6 +241,11 @@ class SimulationTool (Folder, UniqueObject):
# This is a simulation movement
order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=order_type_list)
if order_value is None:
# In some cases (ex. DeliveryRule), there is no order
# we may consider a PackingList as the order in the OrderGroup
order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=delivery_type_list)
else:
# This is a temp movement
order_value = None
......@@ -1057,12 +1062,23 @@ class SimulationTool (Folder, UniqueObject):
if m.getSourceSectionValue() is not None and m.getSourceSectionValue().isMemberOf(section_category):
# for each movement, source section is member of one and one only accounting category
# therefore there is only one and one only source asset price
m._setSourceAssetPrice(current_asset_price)
quantity = m.getInventoriatedQuantity()
if quantity:
total_asset_price = - current_asset_price * quantity
m.Movement_zSetSourceTotalAssetPrice(uid=m.getUid(), total_asset_price = total_asset_price)
#m._setSourceAssetPrice(current_asset_price)
if m.getDestinationSectionValue() is not None and m.getDestinationSectionValue().isMemberOf(section_category):
# for each movement, destination section is member of one and one only accounting category
# therefore there is only one and one only destination asset price
m._setDestinationAssetPrice(current_asset_price)
# Global reindexing required afterwards
#m._setDestinationAssetPrice(current_asset_price)
quantity = m.getInventoriatedQuantity()
if quantity:
total_asset_price = current_asset_price * quantity
m.Movement_zSetDestinationTotalAssetPrice(uid=m.getUid(), total_asset_price = total_asset_price)
# Global reindexing required afterwards in any case: so let us do it now
# Until we get faster methods (->reindexObject())
#m.immediateReindexObject()
#m.activate(priority=7).immediateReindexObject() # Too slow
return result
......
......@@ -37,4 +37,8 @@ if list_method_id:
return getattr(context,form_id)(request)
else:
# Default behaviour is not as great but returns something
return getattr(context,form_id)(request)
kw.update(request.form)
if kw.has_key('listbox_uid'): del kw['listbox_uid']
if kw.has_key('list_start'): del kw['list_start']
request.RESPONSE.redirect('%s/%s?%s' % (context.absolute_url(), form_id, make_query(kw)))
#return getattr(context,form_id)(request)
......@@ -6,7 +6,8 @@ if context.cb_dataValid:
new_item_list = context.manage_pasteObjects(REQUEST['__cp'])
new_id_list = map(lambda i: i['new_id'],new_item_list)
for my_id in new_id_list:
context[my_id].flushActivity(invoke=1)
context[my_id].flushActivity(invoke=0, method_id='immediateReindexObject')
context[my_id].recursiveImmediateReindexObject()
return REQUEST.RESPONSE.redirect(context.absolute_url() + '/' + form_id + '?portal_status_message=Item(s)+Pasted.')
else:
return REQUEST.RESPONSE.redirect(context.absolute_url() + '/' + form_id + '?portal_status_message=Copy+or+cut+one+or+more+items+to+paste+first.')
......@@ -40,9 +40,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
<div metal:use-macro="here/menu_box/macros/menu_box">
<div metal:fill-slot="buttons"
tal:define="form_id form/id;
list_method_id request/list_method_id | nothing;
selection_name form/listbox/selection_name | string:">
<input type="hidden" name="selection_name" value="selection_name"
tal:attributes="value selection_name">
<input type="hidden" name="list_method_id" value="list_method_id"
tal:attributes="value list_method_id" tal:condition="list_method_id">
<img src="/images/pro/images/sepacla.png" alt="img"/>&nbsp;
<input type="image" src="/images/pro/images/editcopy.png" title="Copy"
width="22" height="22"
......
......@@ -122,7 +122,7 @@ class ListBoxWidget(Widget.Widget):
- sort_order -- the order of sorting
"""
property_names = Widget.Widget.property_names +\
['lines', 'columns', 'all_columns', 'search_columns', 'sort',
['lines', 'columns', 'all_columns', 'search_columns', 'sort_columns', 'sort',
'editable_columns', 'all_editable_columns', 'global_attributes',
'list_method', 'stat_method', 'selection_name',
'meta_types', 'portal_types', 'default_params',
......@@ -167,6 +167,13 @@ class ListBoxWidget(Widget.Widget):
default=[],
required=0)
sort_columns = fields.ListTextAreaField('sort_columns',
title="Sortable Columns",
description=(
"An optional list of columns to sort."),
default=[],
required=0)
sort = fields.ListTextAreaField('sort',
title='Default Sort',
description=('The default sort keys and order'),
......@@ -306,6 +313,7 @@ class ListBoxWidget(Widget.Widget):
editable_columns = field.get_value('editable_columns')
all_editable_columns = field.get_value('all_editable_columns')
search_columns = field.get_value('search_columns')
sort_columns = field.get_value('sort_columns')
domain_tree = field.get_value('domain_tree')
report_tree = field.get_value('report_tree')
domain_root_list = field.get_value('domain_root_list')
......@@ -317,13 +325,16 @@ class ListBoxWidget(Widget.Widget):
current_selection_name = REQUEST.get('selection_name','default')
list_action = here.absolute_url() + '/' + field.get_value('list_action')
LOG('Listbox',0,'search_columns1: %s' % str(search_columns))
#LOG('Listbox',0,'search_columns1: %s' % str(search_columns))
if search_columns == [] or search_columns is None or search_columns == '':
# We will set it as the schema
search_columns = map(lambda x: [x,x],here.portal_catalog.schema())
LOG('Listbox',0,'search_columns2: %s' % str(search_columns))
#LOG('Listbox',0,'search_columns2: %s' % str(search_columns))
search_columns_id_list = map(lambda x: x[0], search_columns)
if sort_columns == [] or sort_columns is None or sort_columns == '':
sort_columns = search_columns
sort_columns_id_list = map(lambda x: x[0], sort_columns)
# We only display stats if a stat button exsists
# XXXXXXXXXXXX This is not necessarily a good
......@@ -337,11 +348,22 @@ class ListBoxWidget(Widget.Widget):
if k == 'catalog.path' or k == 'path':
has_catalog_path = k
break
selection = here.portal_selections.getSelectionFor(selection_name, REQUEST=REQUEST)
# Creation selection if needed, with default sort order
selection = here.portal_selections.getSelectionFor(selection_name, REQUEST=REQUEST)
# Create selection if needed, with default sort order
if selection is None:
selection = Selection(params=default_params, sort_on = sort)
# Or make sure all sort arguments are valid
else:
# Filter non searchable items
sort = []
fix_sort = 0
for (k , v) in selection.selection_sort_on:
if k in sort_columns_id_list:
sort.append((k,v))
else:
fix_sort = 1
if fix_sort: selection.selection_sort_on = sort
if not hasattr(selection, 'selection_flat_list_mode'):
selection.edit(flat_list_mode=(not (domain_tree or
......@@ -389,6 +411,7 @@ class ListBoxWidget(Widget.Widget):
params = selection.getSelectionParams()
params.update(REQUEST.form)
for (k,v) in default_params:
LOG("Default param",0,str((k,v)))
if REQUEST.form.has_key(k):
params[k] = REQUEST.form[k]
elif not params.has_key(k):
......@@ -607,7 +630,8 @@ class ListBoxWidget(Widget.Widget):
report_sections = ( (None, 0, 0, object_list, len(object_list), 0), )
LOG("Selection", 0, str(selection.__dict__))
# Build the real list by slicing it
# PERFORMANCE ANALYSIS: the result of the query should be
# if possible a lazy sequence
......@@ -623,7 +647,7 @@ class ListBoxWidget(Widget.Widget):
start = int(start)
end = min(start + lines, total_size)
#object_list = object_list[start:end]
total_pages = int(total_size / lines) + 1
total_pages = int(max(total_size-1,0) / lines) + 1
current_page = int(start / lines)
start = max(start, 0)
start = min(start, max(0, total_pages * lines - lines) )
......@@ -821,7 +845,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
<tr >
%s
<td class="Data" width="50" align="center" valign="middle">
<input type="image" src="/images/pro/images/exec16.png" title="Action" alt="Action" name="view:method" />
<input type="image" src="/images/pro/images/exec16.png" title="Action" alt="Action" name="doSelect:method" />
</td>
""" % report_search
else:
......@@ -946,7 +970,11 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
except:
attribute_value = "Could not evaluate"
if type(attribute_value) is type(0.0):
attribute_value = "%.2f" % attribute_value
if cname_id in editable_column_ids and form.has_field('%s_%s' % (field.id, cname_id) ):
# Do not truncate if editable
pass
else:
attribute_value = "%.2f" % attribute_value
td_align = "right"
elif type(attribute_value) is type(1):
td_align = "right"
......
from DublinCore import DublinCore
from Base import Base
from Folder import Folder
from XMLObject import XMLObject
from SimpleItem import SimpleItem
from XMLObject import XMLObject
\ No newline at end of file
from DublinCore import DublinCore
from Folder import Folder
\ No newline at end of file
......@@ -201,6 +201,7 @@ import imp, os, re
try:
from App.config import getConfiguration
except ImportError:
getConfiguration = None
pass
from Globals import InitializeClass
......@@ -228,6 +229,7 @@ class DocumentConstructor(Method):
python_file_parser = re.compile('^(.*)\.py$')
def getLocalPropertySheetList():
if not getConfiguration: return []
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "PropertySheet")
file_list = os.listdir(path)
......@@ -265,6 +267,7 @@ def importLocalPropertySheet(class_id):
setattr(Products.ERP5Type.PropertySheet, class_id, getattr(module, class_id))
def getLocalExtensionList():
if not getConfiguration: return []
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Extensions")
file_list = os.listdir(path)
......@@ -395,6 +398,7 @@ def importLocalDocument(class_id, document_path = None):
def initializeLocalDocumentRegistry():
if not getConfiguration: return
instance_home = getConfiguration().instancehome
document_path = os.path.join(instance_home, "Document")
python_file_expr = re.compile("py$")
......
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