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 ): ...@@ -888,6 +888,21 @@ class CategoryTool( UniqueObject, Folder, Base ):
return 1 return 1
return 0 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' ) security.declareProtected( Permissions.AccessContentsInformation, 'getCategoryList' )
def getCategoryList(self, context): def getCategoryList(self, context):
self._cleanupCategories(context) self._cleanupCategories(context)
......
...@@ -55,6 +55,7 @@ class Invoice(ERP5Invoice): ...@@ -55,6 +55,7 @@ class Invoice(ERP5Invoice):
, PropertySheet.XMLObject , PropertySheet.XMLObject
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.Delivery
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.Arrow , PropertySheet.Arrow
, PropertySheet.Movement , PropertySheet.Movement
......
...@@ -174,8 +174,7 @@ un modele...""" ...@@ -174,8 +174,7 @@ un modele..."""
return pri.getProperty('pri') return pri.getProperty('pri')
return None return None
def _updateIndustrialPrice(self): def _updateIndustrialPrice(self, context):
pass #pass
#self.modele_compute_pri(batch_mode=1) self.modele_compute_pri(batch_mode=1)
...@@ -34,7 +34,7 @@ from Products.CMFCore.WorkflowCore import WorkflowAction ...@@ -34,7 +34,7 @@ from Products.CMFCore.WorkflowCore import WorkflowAction
from Products.ERP5.Document.OrderLine import OrderLine from Products.ERP5.Document.OrderLine import OrderLine
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from ElementTarif import ElementTarif from Products.Coramy.Document.ElementTarif import ElementTarif
class SampleOrderLine(OrderLine, ElementTarif): class SampleOrderLine(OrderLine, ElementTarif):
""" """
......
...@@ -53,6 +53,26 @@ class Vetement: ...@@ -53,6 +53,26 @@ class Vetement:
'description' : 'ensemble de recommandations de montage servant a mettre au point le vetement', 'description' : 'ensemble de recommandations de montage servant a mettre au point le vetement',
'type' : 'text', 'type' : 'text',
'mode' : 'w' }, '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') _categories = ( 'taille', 'mesure_vetement', 'specialise')
...@@ -5,35 +5,75 @@ ...@@ -5,35 +5,75 @@
##bind script=script ##bind script=script
##bind subpath=traverse_subpath ##bind subpath=traverse_subpath
##parameters=fix=0 ##parameters=fix=0
##title= ##title=Tries to find orphaned movements to fix a given delivery
## ##
# Example code: # 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 # Check each existing movement in delivery
attached_to_movement = [] attached_to_movement = []
requires_delivery_rule = []
requires_new_delivery = []
for m in context.getMovementList(): for m in context.getMovementList():
# simulation_movement = m.getDeliveryRelatedValueList() simulation_movement_list = m.getDeliveryRelatedValueList()
# Is there any orphaned movement 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, result = context.Delivery_zGetOrphanedMovementList(order_uid_list = order_uid_list,
resource_uid = m.getResourceUid(), resource_uid = m.getResourceUid(),
variation_text = m.getVariationText()) variation_text = m.getVariationText())
if len(result) > 0: if len(result) > 0:
for orphaned in result: 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 = orphaned.getObject() simulation_movement = orphaned.getObject()
initial_quantity = m.getQuantity()
quantity = simulation_movement.getQuantity() quantity = simulation_movement.getQuantity()
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) simulation_movement.setDeliveryValue(m)
m.setQuantity(quantity) m.setQuantity(quantity)
print " Fixed orphaned movement %s attached to %s with quantity %s" % (orphaned.relative_url, m.getRelativeUrl(), 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 ) result = context.Delivery_zGetOrphanedMovementList( order_uid_list = order_uid_list )
#return map(lambda x:x.portal_type, result)
for orphaned in result: for orphaned in result:
if orphaned.relative_url not in attached_to_movement: 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 return printed
...@@ -44,9 +44,14 @@ AND ...@@ -44,9 +44,14 @@ AND
related_order_line.delivery_uid = related_order.uid related_order_line.delivery_uid = related_order.uid
AND AND
catalog.uid = movement.uid catalog.uid = movement.uid
AND AND (
related_order.simulation_state = 'confirmed' 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> OR related_order.simulation_state = 'getting_started'
</dtml-if><dtml-if resource_uid>AND movement.resource_uid = <dtml-sqlvar resource_uid type="int"> 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><dtml-if variation_text>AND movement.variation_text = <dtml-sqlvar variation_text type="string">
</dtml-if> </dtml-if>
\ No newline at end of file
...@@ -10,6 +10,7 @@ class_file: ...@@ -10,6 +10,7 @@ class_file:
<params></params> <params></params>
CREATE TABLE `message` ( CREATE TABLE `message` (
`uid` int(11) NOT NULL auto_increment, `uid` int(11) NOT NULL auto_increment,
`date` datetime,
`path` VARCHAR(255), `path` VARCHAR(255),
`method_id` VARCHAR(40), `method_id` VARCHAR(40),
`processing_node` INT DEFAULT -1, `processing_node` INT DEFAULT -1,
...@@ -17,6 +18,7 @@ CREATE TABLE `message` ( ...@@ -17,6 +18,7 @@ CREATE TABLE `message` (
`priority` INT DEFAULT 0, `priority` INT DEFAULT 0,
`message` BLOB, `message` BLOB,
PRIMARY KEY (`uid`), PRIMARY KEY (`uid`),
KEY `date` (`date`),
KEY `path` (`path`), KEY `path` (`path`),
KEY `method_id` (`method_id`), KEY `method_id` (`method_id`),
KEY `processing_node` (`processing_node`), KEY `processing_node` (`processing_node`),
......
<dtml-comment> <dtml-comment>
title: title:
connection_id:erp5_sql_connection connection_id:MySQL
max_rows:1000 max_rows:1
max_cache:100 max_cache:0
cache_time:0 cache_time:0
class_name: class_name:
class_file: class_file:
......
...@@ -17,4 +17,4 @@ WHERE ...@@ -17,4 +17,4 @@ WHERE
<dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if> <dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if>
ORDER BY ORDER BY
priority priority, date
\ No newline at end of file \ No newline at end of file
...@@ -21,3 +21,5 @@ WHERE ...@@ -21,3 +21,5 @@ WHERE
<dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if> <dtml-if method_id>AND method_id = <dtml-sqlvar method_id type="string"></dtml-if>
GROUP BY GROUP BY
path, method_id, processing_node, processing path, method_id, processing_node, processing
ORDER BY
priority, date
\ No newline at end of file
...@@ -14,6 +14,7 @@ priority</params> ...@@ -14,6 +14,7 @@ priority</params>
INSERT INTO message INSERT INTO message
SET SET
path = <dtml-sqlvar path type="string">, path = <dtml-sqlvar path type="string">,
date = <dtml-sqlvar "_.DateTime()" type="string">,
method_id = <dtml-sqlvar method_id type="string">, method_id = <dtml-sqlvar method_id type="string">,
processing_node = -1, processing_node = -1,
processing = -1, processing = -1,
......
...@@ -45,10 +45,11 @@ AND not (next_movement.inventory is NULL)) ...@@ -45,10 +45,11 @@ AND not (next_movement.inventory is NULL))
WHERE WHERE
item.portal_type = "Piece Tissu" 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 AND ( stock.quantity >= 0
OR (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 PieceTissu_searchConsumedList>AND item.uid <> <dtml-sqlvar uid type="int">
</dtml-in> </dtml-in>
AND next_movement.uid is NULL AND next_movement.uid is NULL
......
<dtml-comment> <dtml-comment>
title: title:
connection_id:erp5_sql_connection connection_id:MySQL
max_rows:1000 max_rows:750
max_cache:100 max_cache:100
cache_time:0 cache_time:0
class_name:ZSQLBrain class_name:ZSQLBrain
......
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
<all_columns type="list">[]</all_columns> <all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns> <all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name> <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> <css_class></css_class>
<default></default> <default></default>
<default_params type="list">[]</default_params> <default_params type="list">[]</default_params>
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
##parameters= ##parameters=
##title= ##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", "modele/417P401",
"""coloris/modele/417P401/1_espace_stuc """coloris/modele/417P401/1_espace_stuc
taille/enfant/10 ans""", taille/enfant/10 ans""",
...@@ -15,7 +17,9 @@ taille/enfant/10 ans""", ...@@ -15,7 +17,9 @@ taille/enfant/10 ans""",
"site/Stock_PF" "site/Stock_PF"
) )
for i in result: #for i in result:
print ' '.join(map(lambda x:str(x), i)) # print ' '.join(map(lambda x:str(x), i))
print repr(result)
return printed return printed
...@@ -15,7 +15,7 @@ node ...@@ -15,7 +15,7 @@ node
section section
node_uid node_uid
section_uid section_uid
variation_text variation_text=None
node_category node_category
section_category section_category
resource_category resource_category
...@@ -36,12 +36,15 @@ SELECT ...@@ -36,12 +36,15 @@ SELECT
COUNT(DISTINCT movement.variation_text) AS variation_text, COUNT(DISTINCT movement.variation_text) AS variation_text,
MAX(stock.resource_uid) AS resource_uid MAX(stock.resource_uid) AS resource_uid
FROM 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 WHERE
catalog.uid = movement.uid 1 = 1
AND catalog.uid = stock.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 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 </dtml-if>AND movement.is_accountable = 1
AND node.uid = stock.node_uid AND node.uid = stock.node_uid
AND section.uid = stock.section_uid AND section.uid = stock.section_uid
...@@ -50,7 +53,6 @@ AND stock.resource_uid = resource.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 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 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 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 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 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-if><dtml-if node_category>AND node_c.relative_url = <dtml-sqlvar node_category type="string">
......
<dtml-comment> <dtml-comment>
title: title:
connection_id:erp5_sql_connection connection_id:MySQL
max_rows:1000 max_rows:20000
max_cache:100 max_cache:100
cache_time:0 cache_time:0
class_name:InventoryListBrain class_name:InventoryListBrain
...@@ -15,7 +15,7 @@ node_uid ...@@ -15,7 +15,7 @@ node_uid
section_uid section_uid
node node
section section
variation_text variation_text="XXX_marker"
node_category node_category
section_category section_category
resource_category resource_category
...@@ -24,7 +24,10 @@ omit_input ...@@ -24,7 +24,10 @@ omit_input
omit_output omit_output
simulation_state simulation_state
query query
calculate_asset:int=0</params> calculate_asset:int=0
group_by_node=1
group_by_section=1
group_by_variation=1</params>
SELECT SELECT
SUM(stock.quantity) AS inventory, SUM(stock.quantity) AS inventory,
<dtml-if "calculate_asset != 0"> SUM(stock.total_asset_price) AS asset_price, </dtml-if> <dtml-if "calculate_asset != 0"> SUM(stock.total_asset_price) AS asset_price, </dtml-if>
...@@ -36,23 +39,30 @@ SELECT ...@@ -36,23 +39,30 @@ SELECT
resource.relative_url AS resource_relative_url, resource.relative_url AS resource_relative_url,
resource.uid AS resource_uid, resource.uid AS resource_uid,
movement.variation_text AS variation_text, 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 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 WHERE
catalog.uid = movement.uid 1 = 1
AND catalog.uid = stock.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 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><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 </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 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 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 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 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 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 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-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 ...@@ -74,6 +84,7 @@ AND resource_membership.uid = resource.uid
</dtml-if><dtml-if query>AND category.uid = node.uid </dtml-if><dtml-if query>AND category.uid = node.uid
AND <dtml-var query></dtml-if> AND <dtml-var query></dtml-if>
GROUP BY 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 ORDER BY
node.title, resource.title, movement.variation_text node.title, resource.title, movement.variation_text
...@@ -15,7 +15,7 @@ node_uid ...@@ -15,7 +15,7 @@ node_uid
section_uid section_uid
node node
section section
variation_text variation_text=None
node_category node_category
section_category section_category
resource_category resource_category
...@@ -48,13 +48,16 @@ SELECT ...@@ -48,13 +48,16 @@ SELECT
movement.delivery_uid AS explanation_uid, movement.delivery_uid AS explanation_uid,
catalog.simulation_state AS simulation_state catalog.simulation_state AS simulation_state
FROM 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 WHERE
catalog.uid = movement.uid catalog.uid = movement.uid
AND catalog.uid = stock.uid AND catalog.uid = stock.uid
AND node.uid = stock.node_uid AND node.uid = stock.node_uid
AND section.uid = stock.section_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 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><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 </dtml-if>AND movement.is_accountable = 1
...@@ -62,7 +65,7 @@ AND stock.resource_uid = resource.uid ...@@ -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 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 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 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_simulation>AND catalog.portal_type != "Simulation Movement"
</dtml-if><dtml-if omit_input>AND stock.quantity < 0 </dtml-if><dtml-if omit_input>AND stock.quantity < 0
</dtml-if><dtml-if omit_output>AND stock.quantity > 0 </dtml-if><dtml-if omit_output>AND stock.quantity > 0
......
...@@ -57,13 +57,13 @@ ...@@ -57,13 +57,13 @@
<field><id>listbox</id> <type>ListBox</type> <field><id>listbox</id> <type>ListBox</type>
<values> <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> <all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name> <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> <css_class></css_class>
<default></default> <default></default>
<default_params type="list">[]</default_params> <default_params type="list">[('group_by_section', '0')]</default_params>
<description></description> <description></description>
<domain_root_list type="list">[('portal_categories/site/Stock_MP', 'Stocks MP'), ('portal_categories/site', 'Sites')]</domain_root_list> <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> <domain_tree type="int">1</domain_tree>
......
...@@ -37,9 +37,9 @@ ...@@ -37,9 +37,9 @@
<report_root_list type="list">[]</report_root_list> <report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree> <report_tree type="int">0</report_tree>
<search type="int">1</search> <search type="int">1</search>
<search_columns></search_columns> <search_columns type="list">[]</search_columns>
<select type="int">1</select> <select type="int">1</select>
<selection_name>modele_selection</selection_name> <selection_name>assortiment_selection</selection_name>
<sort type="list">[('id', 'id')]</sort> <sort type="list">[('id', 'id')]</sort>
<stat_method></stat_method> <stat_method></stat_method>
<title>Assortiments</title> <title>Assortiments</title>
......
...@@ -122,6 +122,30 @@ ...@@ -122,6 +122,30 @@
<message name="too_long">You entered too many characters.</message> <message name="too_long">You entered too many characters.</message>
</messages> </messages>
</field> </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> </fields>
</group> </group>
<group> <group>
...@@ -164,7 +188,7 @@ ...@@ -164,7 +188,7 @@
<items type="list">[]</items> <items type="list">[]</items>
<required type="int">0</required> <required type="int">0</required>
<size type="int">5</size> <size type="int">5</size>
<title>Espace Imaginaire</title> <title>Famille</title>
</values> </values>
<tales> <tales>
<default>here/getEipList</default> <default>here/getEipList</default>
...@@ -176,6 +200,23 @@ ...@@ -176,6 +200,23 @@
<message name="unknown_selection">You selected an item that was not in the list.</message> <message name="unknown_selection">You selected an item that was not in the list.</message>
</messages> </messages>
</field> </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> <field><id>etat</id> <type>StringField</type>
<values> <values>
<alternate_name></alternate_name> <alternate_name></alternate_name>
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<items type="list">[]</items> <items type="list">[]</items>
<required type="int">0</required> <required type="int">0</required>
<size type="int">5</size> <size type="int">5</size>
<title>Espace Imaginaire</title> <title>Famille</title>
</values> </values>
<tales> <tales>
<default>here/getEipList</default> <default>here/getEipList</default>
......
...@@ -126,7 +126,7 @@ ...@@ -126,7 +126,7 @@
<td> <td>
<table class="border" width="100%"> <table class="border" width="100%">
<tr> <tr>
<td align="left"><b>Nomenclature</b></td> <td align="left"><b>Nomenclature Prototype</b></td>
</tr> </tr>
<tr tal:define="nomenclature_list python:modules['string'].split(here.getModeleAggregatedNomenclature()+here.getNomenclature(''),'\n')"> <tr tal:define="nomenclature_list python:modules['string'].split(here.getModeleAggregatedNomenclature()+here.getNomenclature(''),'\n')">
<td width="100%"> <span tal:repeat="nomenclature_item nomenclature_list"> <td width="100%"> <span tal:repeat="nomenclature_item nomenclature_list">
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
</span> </td> </span> </td>
</tr> </tr>
<tr> <tr>
<td align="left"><b>Mode opratoire</b></td> <td align="left"><b>Mode opratoire Prototype</b></td>
</tr> </tr>
<tr tal:define="nomenclature_list python:modules['string'].split(here.getModeleAggregatedModeOperatoire()+here.getModeOperatoire(''),'\n')"> <tr tal:define="nomenclature_list python:modules['string'].split(here.getModeleAggregatedModeOperatoire()+here.getModeOperatoire(''),'\n')">
<td width="100%"> <span tal:repeat="nomenclature_item nomenclature_list"> <td width="100%"> <span tal:repeat="nomenclature_item nomenclature_list">
...@@ -199,6 +199,13 @@ ...@@ -199,6 +199,13 @@
</table> </table>
</span></td> </span></td>
</tr> </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> </table></td>
<td><img src="spacer.png" width="1" height="100%"></td> <td><img src="spacer.png" width="1" height="100%"></td>
</tr> </tr>
......
...@@ -353,7 +353,7 @@ ...@@ -353,7 +353,7 @@
<items type="list">[]</items> <items type="list">[]</items>
<required type="int">1</required> <required type="int">1</required>
<size type="int">1</size> <size type="int">1</size>
<title>Espace imaginaire</title> <title>Famille</title>
</values> </values>
<tales> <tales>
<items>here/portal_categories/eip/getFormItemList</items> <items>here/portal_categories/eip/getFormItemList</items>
......
...@@ -351,7 +351,7 @@ ...@@ -351,7 +351,7 @@
<items type="list">[]</items> <items type="list">[]</items>
<required type="int">0</required> <required type="int">0</required>
<size type="int">5</size> <size type="int">5</size>
<title>Espace imaginaire</title> <title>Famille</title>
</values> </values>
<tales> <tales>
<default>here/getEipList</default> <default>here/getEipList</default>
......
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
<form> <form>
<title>Liste de vtements</title> <title>Liste de vtements</title>
<name>vetement_search_list</name> <name>vetement_list</name>
<action></action> <action></action>
<enctype></enctype> <enctype></enctype>
<method>POST</method> <method>POST</method>
<pt>vetement_list</pt> <pt>form_list</pt>
<groups> <groups>
<group> <group>
<title>Default</title> <title>Default</title>
<fields> <fields>
<field><id>search_list</id> <type>ListBox</type> <field><id>listbox</id> <type>ListBox</type>
<values> <values>
<all_columns type="list">[('id', 'V\xeatement'), ('relative_url', "Chemin d'acc\xe8s"), ('Description', 'Description')]</all_columns> <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> <all_editable_columns type="list">[]</all_editable_columns>
...@@ -34,16 +34,16 @@ ...@@ -34,16 +34,16 @@
<lines type="int">50</lines> <lines type="int">50</lines>
<list_action>list</list_action> <list_action>list</list_action>
<list_cookie>SEARCH_LIST</list_cookie> <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> <meta_types type="list">[]</meta_types>
<portal_types type="list">[('Vetement', 'Vetement')]</portal_types> <portal_types type="list">[('Vetement', 'Vetement')]</portal_types>
<report_root_list type="list">[]</report_root_list> <report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree> <report_tree type="int">0</report_tree>
<reverse type="int">0</reverse> <reverse type="int">0</reverse>
<search type="int">1</search> <search type="int">1</search>
<search_columns></search_columns> <search_columns type="list">[]</search_columns>
<select type="int">1</select> <select type="int">1</select>
<selection_name></selection_name> <selection_name>vetement_selection</selection_name>
<sort type="list">[('id', 'id')]</sort> <sort type="list">[('id', 'id')]</sort>
<stat_method></stat_method> <stat_method></stat_method>
<title>Vtements</title> <title>Vtements</title>
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<hidden type="int">0</hidden> <hidden type="int">0</hidden>
<max_length></max_length> <max_length></max_length>
<required type="int">0</required> <required type="int">0</required>
<title>Librairie</title> <title>Fichier Lectra</title>
<truncate type="int">0</truncate> <truncate type="int">0</truncate>
</values> </values>
<tales> <tales>
...@@ -88,6 +88,39 @@ ...@@ -88,6 +88,39 @@
<message name="too_long">You entered too many characters.</message> <message name="too_long">You entered too many characters.</message>
</messages> </messages>
</field> </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> <field><id>my_base_taille</id> <type>ListField</type>
<values> <values>
<alternate_name></alternate_name> <alternate_name></alternate_name>
...@@ -112,24 +145,29 @@ ...@@ -112,24 +145,29 @@
<message name="unknown_selection">You selected an item that was not in the list.</message> <message name="unknown_selection">You selected an item that was not in the list.</message>
</messages> </messages>
</field> </field>
<field><id>vetement_state</id> <type>StringField</type> <field><id>my_correspondance_id</id> <type>RelationStringField</type>
<values> <values>
<alternate_name></alternate_name> <alternate_name></alternate_name>
<base_category>specialise</base_category>
<catalog_index>id</catalog_index>
<css_class></css_class> <css_class></css_class>
<default></default> <default></default>
<default_module>correspondance_mesures</default_module>
<description></description> <description></description>
<display_maxwidth></display_maxwidth> <display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width> <display_width type="int">20</display_width>
<external_validator></external_validator> <external_validator></external_validator>
<extra></extra> <extra></extra>
<hidden type="int">0</hidden> <hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length> <max_length></max_length>
<portal_type type="list">[('Correspondance Mesures', 'Correspondance Mesures')]</portal_type>
<required type="int">0</required> <required type="int">0</required>
<title>Etat</title> <title>Correspondance mesures</title>
<truncate type="int">0</truncate> <truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values> </values>
<tales> <tales>
<default>python:here.portal_workflow.getInfoFor(here, 'vetement_state')</default>
</tales> </tales>
<messages> <messages>
<message name="external_validator_failed">The input failed the external validator.</message> <message name="external_validator_failed">The input failed the external validator.</message>
...@@ -137,29 +175,24 @@ ...@@ -137,29 +175,24 @@
<message name="too_long">Too much input was given.</message> <message name="too_long">Too much input was given.</message>
</messages> </messages>
</field> </field>
<field><id>my_specialise_id</id> <type>RelationStringField</type> <field><id>vetement_state</id> <type>StringField</type>
<values> <values>
<alternate_name></alternate_name> <alternate_name></alternate_name>
<base_category>specialise</base_category>
<catalog_index>id</catalog_index>
<css_class></css_class> <css_class></css_class>
<default></default> <default></default>
<default_module>correspondance_mesures</default_module>
<description></description> <description></description>
<display_maxwidth></display_maxwidth> <display_maxwidth></display_maxwidth>
<display_width type="int">20</display_width> <display_width type="int">20</display_width>
<external_validator></external_validator> <external_validator></external_validator>
<extra></extra> <extra></extra>
<hidden type="int">0</hidden> <hidden type="int">0</hidden>
<jump_method>base_jump_relation</jump_method>
<max_length></max_length> <max_length></max_length>
<portal_type type="list">[('Correspondance Mesures', 'Correspondance Mesures')]</portal_type>
<required type="int">0</required> <required type="int">0</required>
<title>Correspondance mesures</title> <title>Etat</title>
<truncate type="int">0</truncate> <truncate type="int">0</truncate>
<update_method>base_update_relation</update_method>
</values> </values>
<tales> <tales>
<default>python:here.portal_workflow.getInfoFor(here, 'vetement_state')</default>
</tales> </tales>
<messages> <messages>
<message name="external_validator_failed">The input failed the external validator.</message> <message name="external_validator_failed">The input failed the external validator.</message>
...@@ -221,6 +254,23 @@ ...@@ -221,6 +254,23 @@
<message name="unknown_selection">You selected an item that was not in the list.</message> <message name="unknown_selection">You selected an item that was not in the list.</message>
</messages> </messages>
</field> </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> </fields>
</group> </group>
<group> <group>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
##bind namespace= ##bind namespace=
##bind script=script ##bind script=script
##bind subpath=traverse_subpath ##bind subpath=traverse_subpath
##parameters= ##parameters=printer_name=''
##title= ##title=
## ##
from Products.Coramy.MetoAPI import selectMeter, startFormat, setDecoration, setPrintSpeed, setPaperSpeed, setPixel, setTemparature, setNumber, endFormat, printText, printLine, printFrame, setAsdFont 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): ...@@ -36,7 +36,7 @@ def chaine(num, div):
raw_string = '' raw_string = ''
container = context container = context
"""
# selecting printer (user dependent) # selecting printer (user dependent)
local_user = container.portal_membership.getAuthenticatedMember().getUserName() local_user = container.portal_membership.getAuthenticatedMember().getUserName()
if local_user == 'Nicole_Denis' : if local_user == 'Nicole_Denis' :
...@@ -47,11 +47,16 @@ elif local_user == 'Jocelyne_Olejarz' : ...@@ -47,11 +47,16 @@ elif local_user == 'Jocelyne_Olejarz' :
printer_name = 'Meto_XS40_4' printer_name = 'Meto_XS40_4'
elif local_user == 'Nathalie_Wadoux' : elif local_user == 'Nathalie_Wadoux' :
printer_name = 'Meto_XS40_5' printer_name = 'Meto_XS40_5'
elif local_user == 'Joelle_Gorriez':
printer_name = 'Meto_XS40_6'
elif local_user == 'Chantal_Hannequin' : elif local_user == 'Chantal_Hannequin' :
printer_name = 'Meto_XS40_5'
elif local_user == 'Gaelle_Manier' :
printer_name = 'Meto_XS40_6' printer_name = 'Meto_XS40_6'
else : else :
printer_name = 'Meto_XS40_2' printer_name = 'Meto_XS40_2'
"""
delivery = container.aq_parent delivery = container.aq_parent
# Destination # Destination
......
...@@ -4,13 +4,16 @@ ...@@ -4,13 +4,16 @@
##bind namespace= ##bind namespace=
##bind script=script ##bind script=script
##bind subpath=traverse_subpath ##bind subpath=traverse_subpath
##parameters= ##parameters=user_name=None
##title= ##title=
## ##
# get the name of the printer
printer_name = context.Coramy_userLabelPrinterDefinition(user_name=user_name)
# print container label # print container label
container = context container = context
if container.aq_parent.getDeliveryMode() == 'Transporteur/Extand' : if container.aq_parent.getDeliveryMode() == 'Transporteur/Extand' :
container.Container_printExtandLabel() container.Container_printExtandLabel(printer_name=printer_name)
else : else :
container.Container_printMetoLabel() container.Container_printMetoLabel(printer_name=printer_name)
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
##bind namespace= ##bind namespace=
##bind script=script ##bind script=script
##bind subpath=traverse_subpath ##bind subpath=traverse_subpath
##parameters= ##parameters=printer_name=''
##title= ##title=
## ##
from Products.Coramy.MetoAPI import selectMeter, startFormat, setDecoration, setPrintSpeed, setPaperSpeed, setPixel, setTemparature, setNumber, endFormat, printText, printLine, printFrame, setAsdFont from Products.Coramy.MetoAPI import selectMeter, startFormat, setDecoration, setPrintSpeed, setPaperSpeed, setPixel, setTemparature, setNumber, endFormat, printText, printLine, printFrame, setAsdFont
raw_string = '' raw_string = ''
container = context container = context
"""
# selecting printer (user dependent) # selecting printer (user dependent)
local_user = container.portal_membership.getAuthenticatedMember().getUserName() local_user = container.portal_membership.getAuthenticatedMember().getUserName()
if local_user == 'Nicole_Denis' : if local_user == 'Nicole_Denis' :
...@@ -22,11 +22,15 @@ elif local_user == 'Jocelyne_Olejarz' : ...@@ -22,11 +22,15 @@ elif local_user == 'Jocelyne_Olejarz' :
printer_name = 'Meto_XS40_4' printer_name = 'Meto_XS40_4'
elif local_user == 'Nathalie_Wadoux' : elif local_user == 'Nathalie_Wadoux' :
printer_name = 'Meto_XS40_5' printer_name = 'Meto_XS40_5'
elif local_user == 'Joelle_Gorriez':
printer_name = 'Meto_XS40_6'
elif local_user == 'Chantal_Hannequin' : elif local_user == 'Chantal_Hannequin' :
printer_name = 'Meto_XS40_5'
elif local_user == 'Gaelle_Manier' :
printer_name = 'Meto_XS40_6' printer_name = 'Meto_XS40_6'
else : else :
printer_name = 'Meto_XS40_2' printer_name = 'Meto_XS40_2'
"""
delivery = container.aq_parent delivery = container.aq_parent
client_title = delivery.getDestinationValue(portal_type=['Organisation']).getTitle() client_title = delivery.getDestinationValue(portal_type=['Organisation']).getTitle()
client_address_items = delivery.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().asText(country='France').split('\n') 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) ...@@ -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, 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, 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) raw_string += printText(4, "d", 8, 2, 220, 37, 8, container.getSerialNumber(), 10)
......
...@@ -36,7 +36,7 @@ def chaine(num, width): ...@@ -36,7 +36,7 @@ def chaine(num, width):
object_list = context.object_action_list(selection_name='sales_packing_list_selection') object_list = context.object_action_list(selection_name='sales_packing_list_selection')
for delivery in object_list: for delivery in object_list:
try:
if delivery.getDeliveryMode() == 'Transporteur/Extand': if delivery.getDeliveryMode() == 'Transporteur/Extand':
# Destination # Destination
...@@ -57,8 +57,11 @@ for delivery in object_list: ...@@ -57,8 +57,11 @@ for delivery in object_list:
client_zip_code = delivery.getDestinationValue(portal_type=['Organisation']).getDefaultAddress().getZipCode() 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: ...@@ -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 += 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_address_2,32)+decoupe(client_address_3,32)+decoupe(client_zip_code,10)
msg += decoupe(client_city,32)+decoupe(client_tel,16)+'\r\n' 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') request.RESPONSE.setHeader('Content-Type','application/text')
return msg return msg
...@@ -36,6 +36,8 @@ if order.getPortalType() == 'Purchase Order' : ...@@ -36,6 +36,8 @@ if order.getPortalType() == 'Purchase Order' :
filter_dict = {'portal_type': 'Purchase Order Line'} filter_dict = {'portal_type': 'Purchase Order Line'}
elif order.getPortalType() == 'Sales Order': elif order.getPortalType() == 'Sales Order':
filter_dict = {'portal_type': 'Sales Order Line'} filter_dict = {'portal_type': 'Sales Order Line'}
elif order.getPortalType() == 'Packing Order':
filter_dict = {'portal_type': 'Packing Order Line'}
else : else :
filter_dict = {'portal_type': 'Production Order Line'} filter_dict = {'portal_type': 'Production Order Line'}
order_line_list = order.contentValues(filter=filter_dict) order_line_list = order.contentValues(filter=filter_dict)
......
...@@ -36,6 +36,7 @@ for container in ordered_container_list : ...@@ -36,6 +36,7 @@ for container in ordered_container_list :
# reset variables # reset variables
container_object = container container_object = container
first_container = container.getIntIndex() first_container = container.getIntIndex()
container_ref = container.getContainerText()
last_container = container.getIntIndex() last_container = container.getIntIndex()
# append final container in final_container_list # append final container in final_container_list
......
...@@ -277,7 +277,7 @@ sales_order.sales_order_apply_condition(my_id, 1) ...@@ -277,7 +277,7 @@ sales_order.sales_order_apply_condition(my_id, 1)
# and this is the end .... # and this is the end ....
if batch_mode: if batch_mode:
#return sales_order.getComment() #return sales_order.getComment()
return (sales_order.getUid(),sales_order.getComment()) return (sales_order.getId(),sales_order.getComment())
else: else:
redirect_url = '%s?%s' % ( item_module.absolute_url()+'/'+my_id+'/'+'view', 'portal_status_message=Commande+Vente+créée.') redirect_url = '%s?%s' % ( item_module.absolute_url()+'/'+my_id+'/'+'view', 'portal_status_message=Commande+Vente+créée.')
request[ 'RESPONSE' ].redirect( redirect_url ) request[ 'RESPONSE' ].redirect( redirect_url )
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<form> <form>
<title>Importer</title> <title>Importer</title>
<name>SalesOrder_importEdiForm</name> <name>SalesOrder_importEdiForm</name>
<action>SalesOrder_importEdiFiles</action> <action>SalesOrder_importEdiFileList</action>
<enctype>multipart/form-data</enctype> <enctype>multipart/form-data</enctype>
<method>POST</method> <method>POST</method>
<pt>form_dialog</pt> <pt>form_dialog</pt>
......
...@@ -30,6 +30,8 @@ def decoupe(s,width): ...@@ -30,6 +30,8 @@ def decoupe(s,width):
result_tmp = rjust(s,width) result_tmp = rjust(s,width)
return result_tmp return result_tmp
request=context.REQUEST
retour_chariot = "\r\n" retour_chariot = "\r\n"
result = "" result = ""
...@@ -52,9 +54,28 @@ result += "DTM_DATE_LIVR_DEMANDE:"+sales_order.getTargetStopDate().strftime("%Y% ...@@ -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 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 # XXX
result += "RFF_BON_LIVRAISON____:"+ context.getId() +retour_chariot result += "RFF_BON_LIVRAISON____:"+ context.getId() +retour_chariot
...@@ -73,6 +94,15 @@ if len(list) > 0: ...@@ -73,6 +94,15 @@ if len(list) > 0:
ean_destination = sales_order.getDestinationDecisionValue(portal_type=['Organisation']).getEan13Code() 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_EMETTEUR_CDE_____:"+ ean_destination + retour_chariot
result += "NAD_INTER_A_LIVRER___:"+ ean_destination + retour_chariot result += "NAD_INTER_A_LIVRER___:"+ ean_destination + retour_chariot
result += "NAD_DEST_MESSAGE_____:"+ ean_destination + retour_chariot result += "NAD_DEST_MESSAGE_____:"+ ean_destination + retour_chariot
...@@ -86,7 +116,7 @@ result += "TDT_DETAIL_TRANSPORT_:"+"3031"+retour_chariot ...@@ -86,7 +116,7 @@ result += "TDT_DETAIL_TRANSPORT_:"+"3031"+retour_chariot
send_quantity_dict = {} send_quantity_dict = {}
packing_list_movement_list = context.getMovementList() packing_list_movement_list = context.getMovementList()
for movement in packing_list_movement_list: 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) ] # [ (ean13code, difference) ]
difference_quantity_list = [] difference_quantity_list = []
...@@ -94,7 +124,7 @@ sales_order_movement_list = sales_order.getMovementList() ...@@ -94,7 +124,7 @@ sales_order_movement_list = sales_order.getMovementList()
for movement in sales_order_movement_list: for movement in sales_order_movement_list:
desired_quantity = int (movement.getTargetQuantity() ) desired_quantity = int(movement.getTargetQuantity() )
eanCode = movement.Amount_getCodeEan13Client() eanCode = movement.Amount_getCodeEan13Client()
try: try:
send_quantity = send_quantity_dict[ eanCode ] send_quantity = send_quantity_dict[ eanCode ]
......
...@@ -11,19 +11,17 @@ ...@@ -11,19 +11,17 @@
request = context.REQUEST request = context.REQUEST
object_list = context.object_action_list(selection_name='sales_packing_list_selection') object_list = context.object_action_list(selection_name='sales_packing_list_selection')
export_file_list = []
result = "" result = ""
for order in object_list: for order in object_list:
# some verifications have to be done try:
# XXX
# export the container # export the container
result += order.SalesPackingList_exportEdi( batch_mode = 1) result += order.SalesPackingList_exportEdi( batch_mode = 1)
# XXX except:
#context.portal_activities.newMessage('SQLDict', object.getAbsoluteUrl(), {}, 'Container_exportEdi') 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 .... # and this is the end ....
if batch_mode: if batch_mode:
......
...@@ -36,6 +36,7 @@ WHERE condition.portal_type="Condition Vente" ...@@ -36,6 +36,7 @@ WHERE condition.portal_type="Condition Vente"
AND condition.uid = cat1.uid AND condition.uid = cat1.uid
AND cat1.category_uid = "<dtml-var source_section_uid>" AND cat1.category_uid = "<dtml-var source_section_uid>"
AND cat1.base_category_uid = <dtml-var "portal_categories.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>
<dtml-if expr="destination_uid<>''"> <dtml-if expr="destination_uid<>''">
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
invoice_reference python: here.getReference(0); invoice_reference python: here.getReference(0);
resource_title python:here.getResourceTitle() or 'Euros'; resource_title python:here.getResourceTitle() or 'Euros';
resource_id python:here.getResourceId() or 'EUR'; resource_id python:here.getResourceId() or 'EUR';
income python: here.Invoice_zGetTotalNetPrice(); incomeHT python: here.getTotalPrice() or 0;
income python: here.Invoice_zGetTotalNetPrice() or 0;
vat python: here.Invoice_zGetTotalVat(); vat python: here.Invoice_zGetTotalVat();
payable python: here.getDefaultTotalPrice(); payable python: here.getDefaultTotalPrice();
payable python: income + vat; payable python: income + vat;
...@@ -38,6 +39,8 @@ ...@@ -38,6 +39,8 @@
packing_list_id python:packing_list.getId(); packing_list_id python:packing_list.getId();
code_comptable python: destination_administration.getCodeComptable(); code_comptable python: destination_administration.getCodeComptable();
eu_vat_code python: destination_administration.getEuVatCode(); eu_vat_code python: destination_administration.getEuVatCode();
source_section_item python: here.Invoice_zGetSourceSectionDescription();
gross_weight python: str(packing_list.PackingList_getTotalGrossWeight());
order python:packing_list.getCausalityValueList(portal_type=['Sale Order','Sales Order'])[0];"> order python:packing_list.getCausalityValueList(portal_type=['Sale Order','Sales Order'])[0];">
<stylesheet> <stylesheet>
...@@ -155,8 +158,23 @@ ...@@ -155,8 +158,23 @@
<static> <static>
<!-- Entete CORAMY --> <!-- Entete CORAMY -->
<tal:block tal:condition="python: source_section_item[0] == 'Houvenaegel'" >
<infostring align="left" x="1.4cm" y="28.3cm" size="26"
font="Times-Bold" color="(0,0,0)">Houvenaegel</infostring>
<infostring align="left" x="2cm" y="27.4cm" size="26"
font="Times-Bold" color="(0,0,0)">Cration</infostring>
</tal:block>
<tal:block tal:condition="python: source_section_item[0] == 'BLS'" >
<infostring align="left" x="2cm" y="27.7cm" size="60"
font="Times-Bold" color="(0,0,0)">BLS</infostring>
<infostring align="left" x="1.8cm" y="27.3cm" size="10"
font="Times-Bold" color="(0,0,0)">Beachwear License Services</infostring>
</tal:block>
<tal:block tal:condition="python: source_section_item[0] == 'Coramy'" >
<infostring align="left" x="1.4cm" y="28cm" size="40" <infostring align="left" x="1.4cm" y="28cm" size="40"
font="Times-Bold" color="(0,0,0)">Coramy</infostring> font="Times-Bold" color="(0,0,0)">Coramy</infostring>
</tal:block>
<rectangle x="1cm" y="28cm" width="0.3cm" height="0.4cm" <rectangle x="1cm" y="28cm" width="0.3cm" height="0.4cm"
linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/> linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/>
...@@ -164,15 +182,15 @@ ...@@ -164,15 +182,15 @@
linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/> linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/>
<infostring align="left" x="7cm" y="28.5cm" size="8" <infostring align="left" x="7cm" y="28.5cm" size="8"
font="Helvetica" color="(0,0,0)"> font="Helvetica" color="(0,0,0)" tal:content="python: '%s' % source_section_item[1]">
5 bis, rue Denis Cordonnier - F.59820 GRAVELINES - Tel. 33(0)3 28 51 91 51 - Fax 33(0)3 28 23 34 96 5 bis, rue Denis Cordonnier - F.59820 GRAVELINES - Tel. 33(0)3 28 51 91 51 - Fax 33(0)3 28 23 34 96
</infostring> </infostring>
<infostring align="left" x="10cm" y="28.1cm" size="8" <infostring align="left" x="10cm" y="28.1cm" size="8"
font="Helvetica" color="(1,1,1)"> font="Helvetica" color="(1,1,1)" tal:content="python: '%s' % source_section_item[2]">
MAILLOTS DE BAIN - GYM - SWIMSUITS - FITNESS MAILLOTS DE BAIN - GYM - SWIMSUITS - FITNESS
</infostring> </infostring>
<infostring align="left" x="6.8cm" y="27.7cm" size="6" <infostring align="left" x="6.8cm" y="27.7cm" size="6"
font="Helvetica" color="(0,0,0)"> font="Helvetica" color="(0,0,0)" tal:content="python: '%s' % source_section_item[3]">
SAS capital de 435.200 EUR - T.V.A. FR 67 611 750 274 - R.C. Dunkerque 611 750 274 - SIRET 611 750 274 00023 - CNUF 15971 SAS capital de 435.200 EUR - T.V.A. FR 67 611 750 274 - R.C. Dunkerque 611 750 274 - SIRET 611 750 274 00023 - CNUF 15971
</infostring> </infostring>
...@@ -248,46 +266,58 @@ ...@@ -248,46 +266,58 @@
<infostring align="left" x="1.8cm" y="21.5cm" size="6" font="Helvetica-Oblique" color="(0,0,0)"> <infostring align="left" x="1.8cm" y="21.5cm" size="6" font="Helvetica-Oblique" color="(0,0,0)">
Nb of parcels Nb of parcels
</infostring> </infostring>
<infostring align="center" x="2.5cm" y="21.1cm" size="8" font="Helvetica-Bold" color="(0,0,0)" <infostring align="center" x="3.5cm" y="21.7cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:content="python: container_number"> tal:content="python: container_number">
NbrColis XXX NbrColis XXX
</infostring> </infostring>
<infostring align="left" x="1.3cm" y="21cm" size="6" font="Helvetica-Oblique" color="(0,0,0)">
Poids brut (kg)
</infostring>
<infostring align="left" x="1.3cm" y="20.8cm" size="6" font="Helvetica-Oblique" color="(0,0,0)">
Brutto-gewicht
</infostring>
<infostring align="left" x="1.3cm" y="20.6cm" size="6" font="Helvetica-Oblique" color="(0,0,0)">
Gross weight
</infostring>
<infostring align="center" x="3.5cm" y="20.8cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:content="python: gross_weight">
TotalGrossWeightXXX
</infostring>
<infostring align="left" x="6cm" y="24.7cm" size="6" font="Helvetica-Oblique" color="(0,0,0)"> <infostring align="left" x="6cm" y="24.7cm" size="6" font="Helvetica-Oblique" color="(0,0,0)">
Livraison / Versand / Delivery Livraison / Versand / Delivery
</infostring> </infostring>
<infostring align="left" x="4.4cm" y="24.3cm" size="8" font="Helvetica-Bold" color="(0,0,0)" <infostring align="left" x="4.4cm" y="24.4cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:content="python: destination.getTitle()"> tal:content="python: destination.getTitle()">
LA REDOUTE BERTHELOT LA REDOUTE BERTHELOT
</infostring> </infostring>
<tal:block tal:define="addr_list python: destination.getDefaultAddressText().split('\n')"> <tal:block tal:define="addr_list python: destination.getDefaultAddress().asText(country='France').split('\n') + [(destination.getDefaultAddressRegion() or '').split('/')[-1]]">
<tal:block tal:repeat="addr_item addr_list"> <tal:block tal:repeat="addr_item addr_list">
<tal:block tal:define="index repeat/addr_item/index"> <tal:block tal:define="index repeat/addr_item/index">
<infostring align="left" x="4.4cm" size="8" font="Helvetica-Bold" color="(0,0,0)" <infostring align="left" x="4.4cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:attributes="y python: '%fcm' % (23.9 - index * 0.4)" tal:content="addr_item"> tal:attributes="y python: '%fcm' % (24 - index * 0.4)" tal:content="addr_item">
119 CHAUSSEE BERTHELOT 119 CHAUSSEE BERTHELOT
</infostring> </infostring>
</tal:block> </tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
<infostring align="left" x="11.6cm" y="24.4cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
<infostring align="left" x="11.6cm" y="24.3cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:content="python: destination_administration.getTitle()"> tal:content="python: destination_administration.getTitle()">
REDOUTE REDOUTE
</infostring> </infostring>
<tal:block tal:define="addr_list python: destination_administration.getDefaultAddressText().split('\n')"> <tal:block tal:define="addr_list python: destination_administration.getDefaultAddress().asText(country='France').split('\n') + [(destination_administration.getDefaultAddressRegion() or '').split('/')[-1]]">
<tal:block tal:repeat="addr_item addr_list"> <tal:block tal:repeat="addr_item addr_list">
<tal:block tal:define="index repeat/addr_item/index"> <tal:block tal:define="index repeat/addr_item/index">
<infostring align="left" x="11.6cm" size="8" font="Helvetica-Bold" color="(0,0,0)" <infostring align="left" x="11.6cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:attributes="y python: '%fcm' % (23.9 - index * 0.4)" tal:content="addr_item"> tal:attributes="y python: '%fcm' % (24 - index * 0.4)" tal:content="addr_item">
119 CHAUSSEE BERTHELOT 119 CHAUSSEE BERTHELOT
</infostring> </infostring>
</tal:block> </tal:block>
</tal:block> </tal:block>
</tal:block> </tal:block>
<infostring align="left" x="4.5cm" y="21.7cm" size="6" font="Helvetica-Oblique" color="(0,0,0)"> <infostring align="left" x="4.5cm" y="21.7cm" size="6" font="Helvetica-Oblique" color="(0,0,0)">
Commercial Commercial
</infostring> </infostring>
...@@ -309,7 +339,7 @@ ...@@ -309,7 +339,7 @@
payment_modeXXX payment_modeXXX
</infostring> </infostring>
<infostring align="left" x="5.8cm" y="20.7cm" size="8" font="Helvetica-Bold" color="(0,0,0)" <infostring align="left" x="5.8cm" y="20.7cm" size="8" font="Helvetica-Bold" color="(0,0,0)"
tal:content="python: '%i jours Net' % payment_term"> tal:content="python: here.Invoice_zGetPaymentTime()">
payment_termXXX payment_termXXX
</infostring> </infostring>
...@@ -448,7 +478,7 @@ ...@@ -448,7 +478,7 @@
<infostring align="center" x="2.2cm" y="4.5cm" size="9" <infostring align="center" x="2.2cm" y="4.5cm" size="9"
font="Helvetica" color="(0,0,0)" font="Helvetica" color="(0,0,0)"
tal:content="python: '%.2f' % income"> tal:content="python: '%.2f' % incomeHT">
income XXX income XXX
</infostring> </infostring>
<infostring align="center" x="3.8cm" y="4.5cm" size="9" <infostring align="center" x="3.8cm" y="4.5cm" size="9"
...@@ -519,8 +549,23 @@ ...@@ -519,8 +549,23 @@
<static> <static>
<!-- Entete CORAMY --> <!-- Entete CORAMY -->
<tal:block tal:condition="python: source_section_item[0] == 'Houvenaegel'" >
<infostring align="left" x="1.4cm" y="28.3cm" size="26"
font="Times-Bold" color="(0,0,0)">Houvenaegel</infostring>
<infostring align="left" x="2cm" y="27.4cm" size="26"
font="Times-Bold" color="(0,0,0)">Cration</infostring>
</tal:block>
<tal:block tal:condition="python: source_section_item[0] == 'BLS'" >
<infostring align="left" x="2cm" y="27.7cm" size="60"
font="Times-Bold" color="(0,0,0)">BLS</infostring>
<infostring align="left" x="1.8cm" y="27.3cm" size="10"
font="Times-Bold" color="(0,0,0)">Beachwear License Services</infostring>
</tal:block>
<tal:block tal:condition="python: source_section_item[0] == 'Coramy'" >
<infostring align="left" x="1.4cm" y="28cm" size="40" <infostring align="left" x="1.4cm" y="28cm" size="40"
font="Times-Bold" color="(0,0,0)">Coramy</infostring> font="Times-Bold" color="(0,0,0)">Coramy</infostring>
</tal:block>
<rectangle x="1cm" y="28cm" width="0.3cm" height="0.4cm" <rectangle x="1cm" y="28cm" width="0.3cm" height="0.4cm"
linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/> linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/>
...@@ -528,15 +573,15 @@ ...@@ -528,15 +573,15 @@
linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/> linewidth="0.0" stroke="(1,1,1)" fill="(0.5,0.5,0.5)"/>
<infostring align="left" x="7cm" y="28.5cm" size="8" <infostring align="left" x="7cm" y="28.5cm" size="8"
font="Helvetica" color="(0,0,0)"> font="Helvetica" color="(0,0,0)" tal:content="python: '%s' % source_section_item[1]">
5 bis, rue Denis Cordonnier - F.59820 GRAVELINES - Tel. 33(0)3 28 51 91 51 - Fax 33(0)3 28 23 34 96 5 bis, rue Denis Cordonnier - F.59820 GRAVELINES - Tel. 33(0)3 28 51 91 51 - Fax 33(0)3 28 23 34 96
</infostring> </infostring>
<infostring align="left" x="10cm" y="28.1cm" size="8" <infostring align="left" x="10cm" y="28.1cm" size="8"
font="Helvetica" color="(1,1,1)"> font="Helvetica" color="(1,1,1)" tal:content="python: '%s' % source_section_item[2]">
MAILLOTS DE BAIN - GYM - SWIMSUITS - FITNESS MAILLOTS DE BAIN - GYM - SWIMSUITS - FITNESS
</infostring> </infostring>
<infostring align="left" x="6.8cm" y="27.7cm" size="6" <infostring align="left" x="6.8cm" y="27.7cm" size="6"
font="Helvetica" color="(0,0,0)"> font="Helvetica" color="(0,0,0)" tal:content="python: '%s' % source_section_item[3]">
SAS capital de 435.200 EUR - T.V.A. FR 67 611 750 274 - R.C. Dunkerque 611 750 274 - SIRET 611 750 274 00023 - CNUF 15971 SAS capital de 435.200 EUR - T.V.A. FR 67 611 750 274 - R.C. Dunkerque 611 750 274 - SIRET 611 750 274 00023 - CNUF 15971
</infostring> </infostring>
...@@ -556,6 +601,7 @@ ...@@ -556,6 +601,7 @@
Folio %(page)s Folio %(page)s
</infostring> </infostring>
<!-- Grand cadre de la facture --> <!-- Grand cadre de la facture -->
<line x1="1cm" x2="20.5cm" y1="25cm" y2="25cm" width="1"/> <line x1="1cm" x2="20.5cm" y1="25cm" y2="25cm" width="1"/>
<line x1="1cm" x2="1cm" y1="25cm" y2="4cm" width="1"/> <line x1="1cm" x2="1cm" y1="25cm" y2="4cm" width="1"/>
...@@ -644,9 +690,10 @@ ...@@ -644,9 +690,10 @@
<infostring align="center" x="2.2cm" y="4.5cm" size="9" <infostring align="center" x="2.2cm" y="4.5cm" size="9"
font="Helvetica" color="(0,0,0)" font="Helvetica" color="(0,0,0)"
tal:content="python: '%.2f' % income"> tal:content="python: '%.2f' % incomeHT">
income XXX income XXX
</infostring> </infostring>
<infostring align="center" x="3.8cm" y="4.5cm" size="9" <infostring align="center" x="3.8cm" y="4.5cm" size="9"
font="Helvetica" color="(0,0,0)"> font="Helvetica" color="(0,0,0)">
...@@ -684,7 +731,7 @@ ...@@ -684,7 +731,7 @@
</infostring> </infostring>
<infostring align="left" x="1.1cm" y="3.8cm" size="5" font="Helvetica" color="(0,0,0)"> <infostring align="left" x="1.1cm" y="3.8cm" size="5" font="Helvetica" color="(0,0,0)">
En application de la loi du 31/12/1992, nous vous prcisons que la presente facture devra tre rgle la date indique ci-dessus. En cas de rglement comptant sous 10 jours, date de facture, l'escompte ci-dessus mentionn pourra tre dduit du En application de la loi du 31/12/1992, nous vous prcisons que la prsente facture devra tre rgle la date indique ci-dessus. En cas de rglement comptant sous 10 jours, date de facture, l'escompte ci-dessus mentionn pourra tre dduit du
</infostring> </infostring>
<infostring align="left" x="1.1cm" y="3.5cm" size="5" font="Helvetica" color="(0,0,0)"> <infostring align="left" x="1.1cm" y="3.5cm" size="5" font="Helvetica" color="(0,0,0)">
montant H.T. de la facture, auquel cas le montant de TVA dductible par vous devra tre diminu du montant de celle affrente l'escompte. Son rglement donnera lieu au versement d'un intrt moratoire, calcul sur les sommes restant montant H.T. de la facture, auquel cas le montant de TVA dductible par vous devra tre diminu du montant de celle affrente l'escompte. Son rglement donnera lieu au versement d'un intrt moratoire, calcul sur les sommes restant
...@@ -709,7 +756,15 @@ ...@@ -709,7 +756,15 @@
</pagetemplate> </pagetemplate>
<pagetemplate id="TotalPage" >
<static>
<infostring align="left" x="19cm" y="26cm" size="8"
font="Helvetica-Bold" color="(0,0,0)">
%(page)s
</infostring>
</static>
</pagetemplate>
<pagetemplate id="Page" > <pagetemplate id="Page" >
......
...@@ -13,4 +13,4 @@ SELECT DISTINCT id, relative_url, path, Description ...@@ -13,4 +13,4 @@ SELECT DISTINCT id, relative_url, path, Description
FROM catalog FROM catalog
WHERE portal_type = "<dtml-var portal_type>" WHERE portal_type = "<dtml-var portal_type>"
AND Title REGEXP "<dtml-var title>" AND Title = "<dtml-var title>"
\ No newline at end of file \ No newline at end of file
...@@ -15,13 +15,13 @@ ...@@ -15,13 +15,13 @@
<field><id>listbox</id> <type>ListBox</type> <field><id>listbox</id> <type>ListBox</type>
<values> <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> <all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name> <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> <css_class></css_class>
<default></default> <default></default>
<default_params type="list">[('id', "''")]</default_params> <default_params type="list">[('reference', "''")]</default_params>
<description></description> <description></description>
<domain_root_list type="list">[]</domain_root_list> <domain_root_list type="list">[]</domain_root_list>
<domain_tree type="int">0</domain_tree> <domain_tree type="int">0</domain_tree>
...@@ -40,7 +40,7 @@ ...@@ -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> <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> <select type="int">1</select>
<selection_name>order_selection</selection_name> <selection_name>order_selection</selection_name>
<sort type="list">[('id', 'id')]</sort> <sort type="list">[('reference', 'reference')]</sort>
<stat_method></stat_method> <stat_method></stat_method>
<title>Factures</title> <title>Factures</title>
</values> </values>
......
...@@ -55,7 +55,7 @@ if len(condition_list) == 0 : ...@@ -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 # 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' # en intégrant un critère de recherche sur 'destination_decision'
elif len(condition_list) > 1 : 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 # resultat des courses sur le recherche
if len(condition_list ) == 0 : if len(condition_list ) == 0 :
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</TD> </TD>
<TD align="left" <TD align="left"
tal:condition="python:container_template[1][0]<>container_template[1][1]"> 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>
<TD tal:attributes="colspan python:taille_qty+1" align="center">Quantits rparties par tailles</TD> <TD tal:attributes="colspan python:taille_qty+1" align="center">Quantits rparties par tailles</TD>
</TR> </TR>
......
...@@ -471,6 +471,7 @@ ...@@ -471,6 +471,7 @@
<select type="int">0</select> <select type="int">0</select>
<selection_name>container_selection</selection_name> <selection_name>container_selection</selection_name>
<sort type="list">[('id', 'id')]</sort> <sort type="list">[('id', 'id')]</sort>
<sort_columns type="list">[]</sort_columns>
<stat_method></stat_method> <stat_method></stat_method>
<title>Colis</title> <title>Colis</title>
</values> </values>
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<SPAN tal:condition="python:len(morphologie_list)==0" <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 --> 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"> <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)" <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 --> tal:content="python:taille_list[1][index]">36</TD><!-- BOUCLE SUR LE NB DE TAILLES -->
<TD align="center" rowspan="2" nowrap>Total</TD> <TD align="center" rowspan="2" nowrap>Total</TD>
......
...@@ -231,6 +231,31 @@ ...@@ -231,6 +231,31 @@
<message name="too_long">Too much input was given.</message> <message name="too_long">Too much input was given.</message>
</messages> </messages>
</field> </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> <field><id>my_start_date</id> <type>DateTimeField</type>
<values> <values>
<alternate_name></alternate_name> <alternate_name></alternate_name>
...@@ -248,7 +273,7 @@ ...@@ -248,7 +273,7 @@
<title>Date d'expdition prvue</title> <title>Date d'expdition prvue</title>
</values> </values>
<tales> <tales>
<title>python:'Expdition prvue le : %s' % here.getStartDate()</title> <title>python:'Expdition prvue le : ' + here.getStartDate().strftime('%d/%m/%Y')</title>
</tales> </tales>
<messages> <messages>
<message name="external_validator_failed">The input failed the external validator.</message> <message name="external_validator_failed">The input failed the external validator.</message>
...@@ -299,7 +324,7 @@ ...@@ -299,7 +324,7 @@
<title>Date de livraison prvue</title> <title>Date de livraison prvue</title>
</values> </values>
<tales> <tales>
<title>python:'Livraison prvue le : %s' % here.getStopDate()</title> <title>python:'Livraison prvue le : ' + here.getStopDate().strftime('%d/%m/%Y')</title>
</tales> </tales>
<messages> <messages>
<message name="external_validator_failed">The input failed the external validator.</message> <message name="external_validator_failed">The input failed the external validator.</message>
......
...@@ -112,18 +112,26 @@ class Group(Implicit): ...@@ -112,18 +112,26 @@ class Group(Implicit):
def __init__(self, movement): def __init__(self, movement):
self.movement_list = [] 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 = movement.getResource()
self.resource_id = movement.getResourceId() self.resource_id = movement.getResourceId()
self.resource_title = movement.getResourceTitle() self.resource_title = movement.getResourceTitle()
self.variation_base_category_list = movement.getVariationBaseCategoryList() self.variation_base_category_list = movement.getVariationBaseCategoryList()
self.total_price = movement.getTotalPrice() # self.total_price = movement.getTotalPrice() # This is likely an error JPSforYO
self.total_quantity = movement.getTotalQuantity() # 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.matrix = XMLMatrix(None)
self.append(movement) self.append(movement)
def test(self, 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: movement.getVariationBaseCategoryList() == self.variation_base_category_list:
return 1 return 1
else: else:
...@@ -132,6 +140,13 @@ class Group(Implicit): ...@@ -132,6 +140,13 @@ class Group(Implicit):
def append(self, movement): def append(self, movement):
if not movement in self.movement_list: if not movement in self.movement_list:
self.movement_list.append(movement) 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): def finish(self):
# Make up a list of cell ranges for setCellRange. # Make up a list of cell ranges for setCellRange.
...@@ -172,6 +187,13 @@ class Group(Implicit): ...@@ -172,6 +187,13 @@ class Group(Implicit):
cell._setPrice(cell.getPrice() / float(quantity)) cell._setPrice(cell.getPrice() / float(quantity))
else: else:
cell._setPrice(0.0) # if quantity is zero, price is et to 0.0 as a convention 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) InitializeClass(Group)
#allow_class(Group) #allow_class(Group)
...@@ -918,7 +940,9 @@ une liste de mouvements...""" ...@@ -918,7 +940,9 @@ une liste de mouvements..."""
if movement_group is not None: if movement_group is not None:
for group in movement_group: for group in movement_group:
# Create each invoice_line in the new invoice. # 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', invoice_line = self.newContent(portal_type = 'Invoice Line',
resource = group.resource, resource = group.resource,
quantity_unit = group.quantity_unit) # FIXME: more args quantity_unit = group.quantity_unit) # FIXME: more args
...@@ -961,7 +985,7 @@ une liste de mouvements...""" ...@@ -961,7 +985,7 @@ une liste de mouvements..."""
else: else:
# There is no variation category. # There is no variation category.
invoice_line.edit(quantity = group.total_quantity, invoice_line.edit(quantity = group.total_quantity,
price = group.total_price, price = group.price,
force_update = 1) force_update = 1) # Use unit price JPSforYO
return invoice_line_list return invoice_line_list
...@@ -205,15 +205,10 @@ Une ligne tarifaire.""" ...@@ -205,15 +205,10 @@ Une ligne tarifaire."""
security.declareProtected( Permissions.AccessContentsInformation, 'getInventory' ) security.declareProtected( Permissions.AccessContentsInformation, 'getInventory' )
def getInventory(self): def getInventory(self):
""" """
Returns the quantity if defined on the cell No acquisition for inventories: either defined or None
or acquire it
""" """
# Call a script on the context
if 'inventory' in self.getMappedValuePropertyList([]): if 'inventory' in self.getMappedValuePropertyList([]):
if getattr(aq_base(self), 'inventory', None) is not None: return getattr(aq_base(self), 'inventory', None)
return getattr(self, 'inventory')
else:
return self.aq_parent.getProperty('inventory')
else: else:
return None # return None return None # return None
......
...@@ -139,7 +139,10 @@ An ERP5 Rule...""" ...@@ -139,7 +139,10 @@ An ERP5 Rule..."""
# Only expand if my_order is not None and state is not 'confirmed' # Only expand if my_order is not None and state is not 'confirmed'
if my_order is not None: 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 # First, check each contained movement and make
# a list of order ids which do not need to be copied # a list of order ids which do not need to be copied
# eventually delete movement which do not exist anylonger # eventually delete movement which do not exist anylonger
......
...@@ -296,6 +296,7 @@ a service in a public administration).""" ...@@ -296,6 +296,7 @@ a service in a public administration)."""
""" """
Returns list of future inventory grouped by section or site 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, return self.getInventoryList(at_date=None, section=section, node=node,
node_category=node_category, section_category=section_category, **kw) node_category=node_category, section_category=section_category, **kw)
...@@ -506,7 +507,7 @@ a service in a public administration).""" ...@@ -506,7 +507,7 @@ a service in a public administration)."""
context = self.asContext(context=context, REQUEST=REQUEST, **kw) context = self.asContext(context=context, REQUEST=REQUEST, **kw)
result = self._getIndustrialPrice(context) result = self._getIndustrialPrice(context)
if result is None: if result is None:
self._updateIndustrialPrice() self._updateIndustrialPrice(context)
result = self._getIndustrialPrice(context) result = self._getIndustrialPrice(context)
return result return result
......
...@@ -34,7 +34,7 @@ from Products.CMFCore.WorkflowCore import WorkflowMethod ...@@ -34,7 +34,7 @@ from Products.CMFCore.WorkflowCore import WorkflowMethod
from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface
from Products.ERP5.Core import MetaNode, MetaResource from Products.ERP5.Core import MetaNode, MetaResource
from Movement import Movement from Products.ERP5.Document.Movement import Movement
from zLOG import LOG from zLOG import LOG
......
...@@ -161,6 +161,7 @@ An ERP5 Rule...""" ...@@ -161,6 +161,7 @@ An ERP5 Rule..."""
if type(source) is type('a'): if type(source) is type('a'):
if source.find('site/Stock_PF/Gravelines') >= 0 : if source.find('site/Stock_PF/Gravelines') >= 0 :
return 1 return 1
return 0 return 0
# Simulation workflow # Simulation workflow
......
...@@ -40,7 +40,7 @@ node_type_list = ('Organisation','Person','Category','MetaNode',) ...@@ -40,7 +40,7 @@ node_type_list = ('Organisation','Person','Category','MetaNode',)
invoice_type_list = ('Invoice', 'Sale Invoice', 'Sales Invoice', 'Sale Invoice Transaction') invoice_type_list = ('Invoice', 'Sale Invoice', 'Sales Invoice', 'Sale Invoice Transaction')
order_type_list = ('Order', 'Project', 'Samples Order', order_type_list = ('Order', 'Project', 'Samples Order',
'Production Order', 'Purchase Order', 'Sale Order', 'Packing Order','Production Order', 'Purchase Order', 'Sale Order',
'Sales Order', ) 'Sales Order', )
delivery_type_list = ('Delivery', delivery_type_list = ('Delivery',
...@@ -76,6 +76,7 @@ order_movement_type_list = ( ...@@ -76,6 +76,7 @@ order_movement_type_list = (
'Sale Order Line', 'Sale Order Line',
'Sample Order Line', 'Sample Order Line',
'Production Order Line', 'Production Order Line',
'Packing Order Line',
'Delivery Cell', 'Delivery Cell',
) # Delivery Cell is both used for orders and deliveries XXX ) # Delivery Cell is both used for orders and deliveries XXX
......
...@@ -88,12 +88,20 @@ class InventoryListBrain(ZSQLBrain): ...@@ -88,12 +88,20 @@ class InventoryListBrain(ZSQLBrain):
def getInventory(self, at_date = None, ignore_variation=0, simulation_state=None, **kw): def getInventory(self, at_date = None, ignore_variation=0, simulation_state=None, **kw):
if type(simulation_state) is type('a'): if type(simulation_state) is type('a'):
simulation_state = [simulation_state] simulation_state = [simulation_state]
if getattr(self, 'group_by_section', 1):
result = self.Resource_zGetInventory( resource_uid = [self.resource_uid], result = self.Resource_zGetInventory( resource_uid = [self.resource_uid],
to_date=at_date, to_date=at_date,
section=self.section_relative_url, section=self.section_relative_url,
node=self.node_relative_url, node=self.node_relative_url,
variation_text = self.variation_text, variation_text = self.variation_text,
simulation_state=simulation_state) 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 inventory = None
if len(result) > 0: if len(result) > 0:
inventory = result[0].inventory inventory = result[0].inventory
......
...@@ -48,6 +48,10 @@ class Reference: ...@@ -48,6 +48,10 @@ class Reference:
'description' : 'The references of the document for default destinations', 'description' : 'The references of the document for default destinations',
'type' : 'string', 'type' : 'string',
'mode' : 'w' }, 'mode' : 'w' },
{ 'id' : 'document_reference', # XXX ERROR - we already have a reference
'description' : 'The references of the document itself',
'type' : 'string',
'mode' : 'w' },
) )
_categories = () _categories = ()
......
...@@ -241,6 +241,11 @@ class SimulationTool (Folder, UniqueObject): ...@@ -241,6 +241,11 @@ class SimulationTool (Folder, UniqueObject):
# This is a simulation movement # This is a simulation movement
order_value = movement.getRootAppliedRule().getCausalityValue( order_value = movement.getRootAppliedRule().getCausalityValue(
portal_type=order_type_list) 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: else:
# This is a temp movement # This is a temp movement
order_value = None order_value = None
...@@ -1057,12 +1062,23 @@ class SimulationTool (Folder, UniqueObject): ...@@ -1057,12 +1062,23 @@ class SimulationTool (Folder, UniqueObject):
if m.getSourceSectionValue() is not None and m.getSourceSectionValue().isMemberOf(section_category): 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 # 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 # 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): 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 # 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 # therefore there is only one and one only destination asset price
m._setDestinationAssetPrice(current_asset_price) #m._setDestinationAssetPrice(current_asset_price)
# Global reindexing required afterwards 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 return result
......
...@@ -37,4 +37,8 @@ if list_method_id: ...@@ -37,4 +37,8 @@ if list_method_id:
return getattr(context,form_id)(request) return getattr(context,form_id)(request)
else: else:
# Default behaviour is not as great but returns something # 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: ...@@ -6,7 +6,8 @@ if context.cb_dataValid:
new_item_list = context.manage_pasteObjects(REQUEST['__cp']) new_item_list = context.manage_pasteObjects(REQUEST['__cp'])
new_id_list = map(lambda i: i['new_id'],new_item_list) new_id_list = map(lambda i: i['new_id'],new_item_list)
for my_id in new_id_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.') return REQUEST.RESPONSE.redirect(context.absolute_url() + '/' + form_id + '?portal_status_message=Item(s)+Pasted.')
else: else:
return REQUEST.RESPONSE.redirect(context.absolute_url() + '/' + form_id + '?portal_status_message=Copy+or+cut+one+or+more+items+to+paste+first.') 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. ...@@ -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:use-macro="here/menu_box/macros/menu_box">
<div metal:fill-slot="buttons" <div metal:fill-slot="buttons"
tal:define="form_id form/id; tal:define="form_id form/id;
list_method_id request/list_method_id | nothing;
selection_name form/listbox/selection_name | string:"> selection_name form/listbox/selection_name | string:">
<input type="hidden" name="selection_name" value="selection_name" <input type="hidden" name="selection_name" value="selection_name"
tal:attributes="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; <img src="/images/pro/images/sepacla.png" alt="img"/>&nbsp;
<input type="image" src="/images/pro/images/editcopy.png" title="Copy" <input type="image" src="/images/pro/images/editcopy.png" title="Copy"
width="22" height="22" width="22" height="22"
......
...@@ -122,7 +122,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -122,7 +122,7 @@ class ListBoxWidget(Widget.Widget):
- sort_order -- the order of sorting - sort_order -- the order of sorting
""" """
property_names = Widget.Widget.property_names +\ 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', 'editable_columns', 'all_editable_columns', 'global_attributes',
'list_method', 'stat_method', 'selection_name', 'list_method', 'stat_method', 'selection_name',
'meta_types', 'portal_types', 'default_params', 'meta_types', 'portal_types', 'default_params',
...@@ -167,6 +167,13 @@ class ListBoxWidget(Widget.Widget): ...@@ -167,6 +167,13 @@ class ListBoxWidget(Widget.Widget):
default=[], default=[],
required=0) 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', sort = fields.ListTextAreaField('sort',
title='Default Sort', title='Default Sort',
description=('The default sort keys and order'), description=('The default sort keys and order'),
...@@ -306,6 +313,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -306,6 +313,7 @@ class ListBoxWidget(Widget.Widget):
editable_columns = field.get_value('editable_columns') editable_columns = field.get_value('editable_columns')
all_editable_columns = field.get_value('all_editable_columns') all_editable_columns = field.get_value('all_editable_columns')
search_columns = field.get_value('search_columns') search_columns = field.get_value('search_columns')
sort_columns = field.get_value('sort_columns')
domain_tree = field.get_value('domain_tree') domain_tree = field.get_value('domain_tree')
report_tree = field.get_value('report_tree') report_tree = field.get_value('report_tree')
domain_root_list = field.get_value('domain_root_list') domain_root_list = field.get_value('domain_root_list')
...@@ -317,13 +325,16 @@ class ListBoxWidget(Widget.Widget): ...@@ -317,13 +325,16 @@ class ListBoxWidget(Widget.Widget):
current_selection_name = REQUEST.get('selection_name','default') current_selection_name = REQUEST.get('selection_name','default')
list_action = here.absolute_url() + '/' + field.get_value('list_action') 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 == '': if search_columns == [] or search_columns is None or search_columns == '':
# We will set it as the schema # We will set it as the schema
search_columns = map(lambda x: [x,x],here.portal_catalog.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) 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 # We only display stats if a stat button exsists
# XXXXXXXXXXXX This is not necessarily a good # XXXXXXXXXXXX This is not necessarily a good
...@@ -337,11 +348,22 @@ class ListBoxWidget(Widget.Widget): ...@@ -337,11 +348,22 @@ class ListBoxWidget(Widget.Widget):
if k == 'catalog.path' or k == 'path': if k == 'catalog.path' or k == 'path':
has_catalog_path = k has_catalog_path = k
break 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: if selection is None:
selection = Selection(params=default_params, sort_on = sort) 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'): if not hasattr(selection, 'selection_flat_list_mode'):
selection.edit(flat_list_mode=(not (domain_tree or selection.edit(flat_list_mode=(not (domain_tree or
...@@ -389,6 +411,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -389,6 +411,7 @@ class ListBoxWidget(Widget.Widget):
params = selection.getSelectionParams() params = selection.getSelectionParams()
params.update(REQUEST.form) params.update(REQUEST.form)
for (k,v) in default_params: for (k,v) in default_params:
LOG("Default param",0,str((k,v)))
if REQUEST.form.has_key(k): if REQUEST.form.has_key(k):
params[k] = REQUEST.form[k] params[k] = REQUEST.form[k]
elif not params.has_key(k): elif not params.has_key(k):
...@@ -607,6 +630,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -607,6 +630,7 @@ class ListBoxWidget(Widget.Widget):
report_sections = ( (None, 0, 0, object_list, len(object_list), 0), ) report_sections = ( (None, 0, 0, object_list, len(object_list), 0), )
LOG("Selection", 0, str(selection.__dict__))
# Build the real list by slicing it # Build the real list by slicing it
# PERFORMANCE ANALYSIS: the result of the query should be # PERFORMANCE ANALYSIS: the result of the query should be
...@@ -623,7 +647,7 @@ class ListBoxWidget(Widget.Widget): ...@@ -623,7 +647,7 @@ class ListBoxWidget(Widget.Widget):
start = int(start) start = int(start)
end = min(start + lines, total_size) end = min(start + lines, total_size)
#object_list = object_list[start:end] #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) current_page = int(start / lines)
start = max(start, 0) start = max(start, 0)
start = min(start, max(0, total_pages * lines - lines) ) start = min(start, max(0, total_pages * lines - lines) )
...@@ -821,7 +845,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -821,7 +845,7 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
<tr > <tr >
%s %s
<td class="Data" width="50" align="center" valign="middle"> <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> </td>
""" % report_search """ % report_search
else: else:
...@@ -946,6 +970,10 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')"> ...@@ -946,6 +970,10 @@ onChange="submitAction(this.form,'%s/portal_selections/setReportRoot')">
except: except:
attribute_value = "Could not evaluate" attribute_value = "Could not evaluate"
if type(attribute_value) is type(0.0): if type(attribute_value) is type(0.0):
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 attribute_value = "%.2f" % attribute_value
td_align = "right" td_align = "right"
elif type(attribute_value) is type(1): elif type(attribute_value) is type(1):
......
from DublinCore import DublinCore
from Base import Base from Base import Base
from Folder import Folder
from SimpleItem import SimpleItem
from XMLObject import XMLObject from XMLObject import XMLObject
from SimpleItem import SimpleItem
from DublinCore import DublinCore
from Folder import Folder
\ No newline at end of file
...@@ -201,6 +201,7 @@ import imp, os, re ...@@ -201,6 +201,7 @@ import imp, os, re
try: try:
from App.config import getConfiguration from App.config import getConfiguration
except ImportError: except ImportError:
getConfiguration = None
pass pass
from Globals import InitializeClass from Globals import InitializeClass
...@@ -228,6 +229,7 @@ class DocumentConstructor(Method): ...@@ -228,6 +229,7 @@ class DocumentConstructor(Method):
python_file_parser = re.compile('^(.*)\.py$') python_file_parser = re.compile('^(.*)\.py$')
def getLocalPropertySheetList(): def getLocalPropertySheetList():
if not getConfiguration: return []
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "PropertySheet") path = os.path.join(instance_home, "PropertySheet")
file_list = os.listdir(path) file_list = os.listdir(path)
...@@ -265,6 +267,7 @@ def importLocalPropertySheet(class_id): ...@@ -265,6 +267,7 @@ def importLocalPropertySheet(class_id):
setattr(Products.ERP5Type.PropertySheet, class_id, getattr(module, class_id)) setattr(Products.ERP5Type.PropertySheet, class_id, getattr(module, class_id))
def getLocalExtensionList(): def getLocalExtensionList():
if not getConfiguration: return []
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Extensions") path = os.path.join(instance_home, "Extensions")
file_list = os.listdir(path) file_list = os.listdir(path)
...@@ -395,6 +398,7 @@ def importLocalDocument(class_id, document_path = None): ...@@ -395,6 +398,7 @@ def importLocalDocument(class_id, document_path = None):
def initializeLocalDocumentRegistry(): def initializeLocalDocumentRegistry():
if not getConfiguration: return
instance_home = getConfiguration().instancehome instance_home = getConfiguration().instancehome
document_path = os.path.join(instance_home, "Document") document_path = os.path.join(instance_home, "Document")
python_file_expr = re.compile("py$") 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