diff --git a/product/CMFCategory/CategoryTool.py b/product/CMFCategory/CategoryTool.py index 176c698442dab5dc9223aa7acbded42e90f2fa51..5912c7efabcfb3412f7d8b3837c128b7ff30373d 100755 --- a/product/CMFCategory/CategoryTool.py +++ b/product/CMFCategory/CategoryTool.py @@ -903,6 +903,21 @@ class CategoryTool( UniqueObject, Folder, Base ): return 1 return 0 + security.declareProtected( Permissions.AccessContentsInformation, 'isAcquiredMemberOf' ) + def isAcquiredMemberOf(self, context, category): + """ + Tests if an object if member of a given category + Category is a string here. It could be more than a string (ex. an object) + + XXX Should include acquisition ? + """ + if getattr(aq_base(context), 'isCategory', 0): + return context.isAcquiredMemberOf(category) + for c in self._getAcquiredCategoryList(context): + if c.find(category) >= 0: + return 1 + return 0 + security.declareProtected( Permissions.AccessContentsInformation, 'getCategoryList' ) def getCategoryList(self, context): self._cleanupCategories(context) diff --git a/product/Coramy/Document/Modele.py b/product/Coramy/Document/Modele.py index db6b0dedd1c4244094a79176f06d77e4c4f2731c..39d2c7da16f09ccb0729d7f2307669aadd159dc9 100755 --- a/product/Coramy/Document/Modele.py +++ b/product/Coramy/Document/Modele.py @@ -178,3 +178,4 @@ un modele...""" #pass self.modele_compute_pri(batch_mode=1) + diff --git a/product/Coramy/skins/coramy_crm/person_view.form b/product/Coramy/skins/coramy_crm/person_view.form index 76d167d99a0cfdc01ea65d4ad7f9a9df3e32eb20..4b3f132ea0a9e3275d0d09e1bad3a5f33193673c 100755 --- a/product/Coramy/skins/coramy_crm/person_view.form +++ b/product/Coramy/skins/coramy_crm/person_view.form @@ -217,60 +217,60 @@ <title>Right</title> <fields> - <field><id>my_organisation_title</id> <type>RelationStringField</type> + <field><id>my_default_email_text</id> <type>EmailField</type> <values> <alternate_name></alternate_name> - <base_category>subordination</base_category> - <catalog_index>Title</catalog_index> <css_class></css_class> <default></default> - <default_module>organisation</default_module> <description></description> <display_maxwidth></display_maxwidth> - <display_width type="int">20</display_width> + <display_width type="int">30</display_width> <external_validator></external_validator> <extra></extra> <hidden type="int">0</hidden> - <jump_method>base_jump_relation</jump_method> <max_length></max_length> - <portal_type type="list">[('Organisation', 'Organisation')]</portal_type> <required type="int">0</required> - <title>Organisation</title> + <title>Email</title> <truncate type="int">0</truncate> - <update_method>base_update_relation</update_method> </values> <tales> + <default>here/getDefaultEmailText</default> </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> + <message name="not_email">You did not enter an email address.</message> </messages> </field> - <field><id>my_default_email_text</id> <type>EmailField</type> + <field><id>my_organisation_title</id> <type>RelationStringField</type> <values> <alternate_name></alternate_name> + <base_category>subordination</base_category> + <catalog_index>Title</catalog_index> <css_class></css_class> <default></default> + <default_module>organisation</default_module> <description></description> <display_maxwidth></display_maxwidth> - <display_width type="int">30</display_width> + <display_width type="int">20</display_width> <external_validator></external_validator> <extra></extra> <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation')]</portal_type> <required type="int">0</required> - <title>Email</title> + <title>Organisation</title> <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> </values> <tales> - <default>here/getDefaultEmailText</default> </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> - <message name="not_email">You did not enter an email address.</message> </messages> </field> <field><id>my_default_telephone_text</id> <type>StringField</type> diff --git a/product/Coramy/skins/coramy_erp5/Delivery_rescueOrphanedMovement.py b/product/Coramy/skins/coramy_erp5/Delivery_rescueOrphanedMovement.py index 0b4aba4a5354b4bd361e2a2ec795875420f53b67..4f627d5d9ea3fb493bb0b71668980e709dedfe7a 100755 --- a/product/Coramy/skins/coramy_erp5/Delivery_rescueOrphanedMovement.py +++ b/product/Coramy/skins/coramy_erp5/Delivery_rescueOrphanedMovement.py @@ -76,4 +76,10 @@ if fix: for delivery in delivery_list: print " New delivery %s for causality %s" % (delivery.getRelativeUrl(), ' '.join(delivery.getCausalityList())) +# Invoke delivery rule +if len(requires_delivery_rule) > 0: + if fix: + context.updateAppliedRule() + print "Building new delivery rule" + return printed diff --git a/product/Coramy/skins/coramy_erp5/SQLDict_readMessage.zsql b/product/Coramy/skins/coramy_erp5/SQLDict_readMessage.zsql index ce5303535097791fdffcf198b252dcf747971ab5..fd34f808c755fb0a345efc24140a8ed345aa0f71 100755 --- a/product/Coramy/skins/coramy_erp5/SQLDict_readMessage.zsql +++ b/product/Coramy/skins/coramy_erp5/SQLDict_readMessage.zsql @@ -17,4 +17,4 @@ WHERE <dtml-if priority> AND priority = <dtml-sqlvar priority type="int"> </dtml-if> ORDER BY - priority, date \ No newline at end of file + priority, date diff --git a/product/Coramy/skins/coramy_erp5/SQLDict_readMessageList.zsql b/product/Coramy/skins/coramy_erp5/SQLDict_readMessageList.zsql index e4e3fefa5ad0dda9656ce053773d6010c2266fb0..b198b085fb1d76a6d6caa3ce8998817574c0a5f7 100755 --- a/product/Coramy/skins/coramy_erp5/SQLDict_readMessageList.zsql +++ b/product/Coramy/skins/coramy_erp5/SQLDict_readMessageList.zsql @@ -22,4 +22,4 @@ WHERE GROUP BY path, method_id, processing_node, processing ORDER BY - priority, date \ No newline at end of file + priority, date diff --git a/product/Coramy/skins/coramy_erp5/SQLDict_writeMessage.zsql b/product/Coramy/skins/coramy_erp5/SQLDict_writeMessage.zsql index b7d026d9111101a212042f51946a9065c0009748..70fbb74a37d2907f9de2e4c21734c0226d78e1aa 100755 --- a/product/Coramy/skins/coramy_erp5/SQLDict_writeMessage.zsql +++ b/product/Coramy/skins/coramy_erp5/SQLDict_writeMessage.zsql @@ -19,4 +19,4 @@ SET processing_node = -1, processing = -1, priority = <dtml-sqlvar priority type="int">, - message = <dtml-sqlvar message type="string"> \ No newline at end of file + message = <dtml-sqlvar message type="string"> diff --git a/product/Coramy/skins/coramy_erp5/assign_gestionaire_designe_roles.py b/product/Coramy/skins/coramy_erp5/assign_gestionaire_designe_roles.py index a01a9c56e488b736a5b166024583bbf53deafbe3..a246b44f6c3e42e9b08f2f4917e335db32c804c7 100755 --- a/product/Coramy/skins/coramy_erp5/assign_gestionaire_designe_roles.py +++ b/product/Coramy/skins/coramy_erp5/assign_gestionaire_designe_roles.py @@ -26,4 +26,6 @@ elif local_user in equipe2 : elif local_user in equipe3 : object.AssignLocalRole(user_list=equipe3,role_list=['GestionaireDesigne',]) else : - object.AssignLocalRole(user_list=[local_user,],role_list=['GestionaireDesigne',]) + if user_name == "AnimatriceAppros" : + local_user = 'Michele_Kmiecik' + object.AssignLocalRole(user_list=[local_user,],role_list=['GestionaireDesigne',]) diff --git a/product/Coramy/skins/coramy_mrp/Resource_zGetInventory.zsql b/product/Coramy/skins/coramy_mrp/Resource_zGetInventory.zsql index 611cc67aee144957167c2cb0c4c36b7e90fba722..a9b9a1d307a6cde169b07d7eb4c9a9c292f6efdf 100755 --- a/product/Coramy/skins/coramy_mrp/Resource_zGetInventory.zsql +++ b/product/Coramy/skins/coramy_mrp/Resource_zGetInventory.zsql @@ -68,8 +68,8 @@ AND resource_membership.category_uid = resource_c.uid AND resource_membership.base_category_uid = resource_bc.uid AND resource_membership.uid = resource.uid </dtml-if><dtml-if omit_simulation>AND catalog.portal_type != "Simulation Movement" -</dtml-if><dtml-if omit_input>AND stock.quantity < 0 -</dtml-if><dtml-if omit_output>AND stock.quantity > 0 +</dtml-if><dtml-if omit_input>AND stock.quantity < 0 AND movement.source_uid <> movement.destination_uid +</dtml-if><dtml-if omit_output>AND stock.quantity > 0 AND movement.source_uid <> movement.destination_uid </dtml-if><dtml-if simulation_state>AND (<dtml-in simulation_state> catalog.simulation_state = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if></dtml-in>) </dtml-if><dtml-if query>AND category.uid = node.uid AND <dtml-var query></dtml-if> \ No newline at end of file diff --git a/product/Coramy/skins/coramy_mrp/Resource_zGetMovementHistoryList.zsql b/product/Coramy/skins/coramy_mrp/Resource_zGetMovementHistoryList.zsql index 186fe2e01e909994fb472a72130c6a8e5728d713..d427aa213604616061f4379b8a695e6bc04d04e1 100755 --- a/product/Coramy/skins/coramy_mrp/Resource_zGetMovementHistoryList.zsql +++ b/product/Coramy/skins/coramy_mrp/Resource_zGetMovementHistoryList.zsql @@ -67,8 +67,8 @@ AND movement.resource_uid = resource.uid </dtml-if><dtml-if to_date>AND movement.stop_date < <dtml-sqlvar to_date type="string"> </dtml-if><dtml-if "variation_text is not None">AND movement.variation_text = <dtml-sqlvar variation_text type="string"> </dtml-if><dtml-if omit_simulation>AND catalog.portal_type != "Simulation Movement" -</dtml-if><dtml-if omit_input>AND stock.quantity < 0 -</dtml-if><dtml-if omit_output>AND stock.quantity > 0 +</dtml-if><dtml-if omit_input>AND stock.quantity < 0 AND movement.source_uid <> movement.destination_uid +</dtml-if><dtml-if omit_output>AND stock.quantity > 0 AND movement.source_uid <> movement.destination_uid </dtml-if><dtml-if node_category>AND node_c.relative_url = <dtml-sqlvar node_category type="string"> AND node_membership.category_uid = node_c.uid AND node_membership.base_category_uid = node_bc.uid diff --git a/product/Coramy/skins/coramy_trade/SalesOrder_importEdi.py b/product/Coramy/skins/coramy_trade/SalesOrder_importEdi.py index 7a2fc43d57c31ede53bc5a5888a46f2f71a0817b..784d2eac3d4100291a4fc33d9f0925d2cef784db 100755 --- a/product/Coramy/skins/coramy_trade/SalesOrder_importEdi.py +++ b/product/Coramy/skins/coramy_trade/SalesOrder_importEdi.py @@ -4,7 +4,7 @@ ##bind namespace= ##bind script=script ##bind subpath=traverse_subpath -##parameters=import_file, segmentation_strategique='2003-2004', incoterm='DAF',delivery_mode='Transporteur', order_type='Approvisionnement', travel_duration=0, batch_mode=0,**kw +##parameters=import_file, segmentation_strategique='2003-2004', incoterm='DAF',delivery_mode='Transporteur', order_type='Approvisionnement', travel_duration=0, batch_mode=0,user_name='',**kw ##title= ## # import d'un fichier EDI @@ -70,9 +70,11 @@ sales_order.setDeliveryMode(delivery_mode) sales_order.setIncoterm(incoterm) sales_order.setOrderType(order_type) + # set the source administration -local_user = container.portal_membership.getAuthenticatedMember() -local_user_name = string.replace(local_user.getUserName(), ' ', '_') +#local_user = container.portal_membership.getAuthenticatedMember() +#local_user_name = string.replace(local_user.getUserName(), '_', ' ') +local_user_name = string.replace(user_name, '_', ' ') local_persons = sales_order.item_by_title_sql_search(title = local_user_name, portal_type = 'Person') if len(local_persons) > 0: sales_order.setSourceAdministration(local_persons[0].relative_url) @@ -272,7 +274,11 @@ sales_order.flushActivity(invoke=1) # try to apply a sale condition sales_order.sales_order_apply_condition(my_id, 1) - +# change the workflow to create the sales packing list +# give the role to user +sales_order.Item_doWorkflowTransition(workflow_action='user_order', workflow_id='order_workflow') +#sales_order.flushActivity(invoke=1) +sales_order.Item_doWorkflowTransition(workflow_action='user_confirm', workflow_id='order_workflow') # and this is the end .... if batch_mode: diff --git a/product/Coramy/skins/coramy_trade/default_pdf_template.pt b/product/Coramy/skins/coramy_trade/default_pdf_template.pt index 538125b95544dc70c5651f5d221a2f18282cbb86..7d7b8f1c93ce405e0df65167d3a10491c081b8b1 100755 --- a/product/Coramy/skins/coramy_trade/default_pdf_template.pt +++ b/product/Coramy/skins/coramy_trade/default_pdf_template.pt @@ -526,6 +526,28 @@ <infostring align="left" x="1.1cm" y="3.2cm" size="5" font="Helvetica" color="(0,0,0)"> dues à cette date de règlement en principal, frais et taxes inclus, et au taux de l'intérêt légal majoré de 5 points, sans que cette pénalité puisse être en toute hypothèse inférieure à 1,5 fois le taux de l'intérêt légal. </infostring> + <infostring align="left" x="10cm" y="24.7cm" size="9" + font="Helvetica-Oblique" color="(0,0,0)"> + Répartition par tailles + </infostring> + <infostring align="left" x="15.4cm" y="24.7cm" size="9" + font="Helvetica-Oblique" color="(0,0,0)"> + Quantité + </infostring> + <infostring align="left" x="17.1cm" y="24.7cm" size="9" + font="Helvetica-Oblique" color="(0,0,0)"> + P.U.H.T. + </infostring> + <infostring align="left" x="18.8cm" y="24.7cm" size="9" + font="Helvetica-Oblique" color="(0,0,0)"> + Total H.T. + </infostring> + + <!-- Pied de facture --> + <rectangle x="1cm" y="5.0cm" width="19.5cm" height="0.8cm" + linewidth="0" fill="(0.75,0.75,0.75)"/> + <line x1="1cm" x2="20.5cm" y1="5.8cm" y2="5.8cm" width="1"/> + <line x1="1cm" x2="20.5cm" y1="5.0cm" y2="5.0cm" width="1"/> </static> @@ -608,7 +630,7 @@ <line x1="20.5cm" x2="20.5cm" y1="25cm" y2="4cm" width="1"/> <line x1="1cm" x2="20.5cm" y1="4cm" y2="4cm" width="1"/> - + <!-- Détail de la facture --> <rectangle x="1cm" y="24.6cm" width="19.5cm" height="0.4cm" linewidth="0" fill="(0.75,0.75,0.75)"/> @@ -696,12 +718,12 @@ <infostring align="center" x="3.8cm" y="4.5cm" size="9" font="Helvetica" color="(0,0,0)"> - + </infostring> <infostring align="left" x="6.5cm" y="4.5cm" size="9" font="Helvetica" color="(0,0,0)" tal:content="python: '%.2f' % income"> - + </infostring> <tal:block tal:condition="python: vad_recoverable"> <infostring align="center" x="9.7cm" y="4.5cm" size="9" @@ -712,7 +734,7 @@ </tal:block> <infostring align="left" x="10.7cm" y="4.5cm" size="9" font="Helvetica" color="(0,0,0)"> - + </infostring> <infostring align="center" x="13.8cm" y="4.5cm" size="10" font="Helvetica-Bold" color="(0,0,0)" @@ -722,7 +744,7 @@ <infostring align="center" x="16cm" y="4.5cm" size="10" font="Helvetica-Bold" color="(0,0,0)" tal:content="python: resource_id"> - resource_id XXX + resource_id XXX </infostring> <infostring align="left" x="18cm" y="4.5cm" size="10" font="Helvetica-Bold" color="(0,0,0)" diff --git a/product/Coramy/skins/coramy_trade/sales_packing_list_aggregated_view.form b/product/Coramy/skins/coramy_trade/sales_packing_list_aggregated_view.form index c101c8318bf75758d5668bbc91b31e864ccfa306..3fccc19e08a5bac6a9a75c8c4ead6d1f11f20403 100755 --- a/product/Coramy/skins/coramy_trade/sales_packing_list_aggregated_view.form +++ b/product/Coramy/skins/coramy_trade/sales_packing_list_aggregated_view.form @@ -140,6 +140,36 @@ <message name="unknown_selection">You selected an item that was not in the list.</message> </messages> </field> + <field><id>my_source_title</id> <type>RelationStringField</type> + <values> + <alternate_name></alternate_name> + <base_category>source</base_category> + <catalog_index>Title</catalog_index> + <css_class></css_class> + <default></default> + <default_module>organisation</default_module> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> + <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type> + <required type="int">0</required> + <title>Expédié par</title> + <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> + </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_long">Too much input was given.</message> + </messages> + </field> </fields> </group> <group> @@ -231,6 +261,61 @@ <message name="too_long">Too much input was given.</message> </messages> </field> + <field><id>destination_address</id> <type>StringField</type> + <values> + <alternate_name></alternate_name> + <css_class></css_class> + <default></default> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">1</hidden> + <max_length></max_length> + <required type="int">0</required> + <title>Lieu livraison : inconnu</title> + <truncate type="int">0</truncate> + </values> + <tales> + <title>python: here.getDestinationValue(portal_type=['Organisation']).Organisation_getOneLineAddress()</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_destination_section_title</id> <type>RelationStringField</type> + <values> + <alternate_name></alternate_name> + <base_category>destination_section</base_category> + <catalog_index>Title</catalog_index> + <css_class></css_class> + <default></default> + <default_module>organisation</default_module> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> + <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type> + <required type="int">0</required> + <title>Pour le compte de</title> + <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> + </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_long">Too much input was given.</message> + </messages> + </field> <field><id>my_start_date</id> <type>DateTimeField</type> <values> <alternate_name></alternate_name> @@ -248,7 +333,7 @@ <title>Date d'expédition prévue</title> </values> <tales> - <title>python:'Date d'expédition prévue : %s' % here.getStartDate()</title> + <title>python:'Expédition prévue le : ' + here.getStartDate().strftime('%d/%m/%Y')</title> </tales> <messages> <message name="external_validator_failed">The input failed the external validator.</message> @@ -299,7 +384,7 @@ <title>Date de livraison prévue</title> </values> <tales> - <title>python:'Date de livraison prévue : %s' % here.getStopDate()</title> + <title>python:'Livraison prévue le : ' + here.getStopDate().strftime('%d/%m/%Y')</title> </tales> <messages> <message name="external_validator_failed">The input failed the external validator.</message> diff --git a/product/Coramy/skins/coramy_trade/sales_packing_list_container_view.form b/product/Coramy/skins/coramy_trade/sales_packing_list_container_view.form index e5585965e1f7e01182333dc36ee5124fa3ed0614..56c2714f31b688993f50bf42f2865cec0cd8a9a3 100755 --- a/product/Coramy/skins/coramy_trade/sales_packing_list_container_view.form +++ b/product/Coramy/skins/coramy_trade/sales_packing_list_container_view.form @@ -140,6 +140,36 @@ <message name="unknown_selection">You selected an item that was not in the list.</message> </messages> </field> + <field><id>my_source_title</id> <type>RelationStringField</type> + <values> + <alternate_name></alternate_name> + <base_category>source</base_category> + <catalog_index>Title</catalog_index> + <css_class></css_class> + <default></default> + <default_module>organisation</default_module> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> + <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type> + <required type="int">0</required> + <title>Expédié par</title> + <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> + </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_long">Too much input was given.</message> + </messages> + </field> </fields> </group> <group> @@ -231,6 +261,61 @@ <message name="too_long">Too much input was given.</message> </messages> </field> + <field><id>destination_address</id> <type>StringField</type> + <values> + <alternate_name></alternate_name> + <css_class></css_class> + <default></default> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">1</hidden> + <max_length></max_length> + <required type="int">0</required> + <title>Lieu livraison : inconnu</title> + <truncate type="int">0</truncate> + </values> + <tales> + <title>python: here.getDestinationValue(portal_type=['Organisation']).Organisation_getOneLineAddress()</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_destination_section_title</id> <type>RelationStringField</type> + <values> + <alternate_name></alternate_name> + <base_category>destination_section</base_category> + <catalog_index>Title</catalog_index> + <css_class></css_class> + <default></default> + <default_module>organisation</default_module> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> + <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type> + <required type="int">0</required> + <title>Pour le compte de</title> + <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> + </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_long">Too much input was given.</message> + </messages> + </field> <field><id>my_start_date</id> <type>DateTimeField</type> <values> <alternate_name></alternate_name> @@ -248,7 +333,7 @@ <title>Date d'expédition prévue</title> </values> <tales> - <title>python:'Date d'expédition prévue : %s' % here.getStartDate()</title> + <title>python:'Expédition prévue le : ' + here.getStartDate().strftime('%d/%m/%Y')</title> </tales> <messages> <message name="external_validator_failed">The input failed the external validator.</message> @@ -299,7 +384,7 @@ <title>Date de livraison prévue</title> </values> <tales> - <title>python:'Date de livraison prévue : %s' % here.getStopDate()</title> + <title>python:'Livraison prévue le : ' + here.getStopDate().strftime('%d/%m/%Y')</title> </tales> <messages> <message name="external_validator_failed">The input failed the external validator.</message> diff --git a/product/Coramy/skins/coramy_trade/sales_packing_list_print.pt b/product/Coramy/skins/coramy_trade/sales_packing_list_print.pt index f54aa27139bfa49d6932c8df299795bb226c130c..038ab2075b5878d2115de6f8f8acd895c702155b 100755 --- a/product/Coramy/skins/coramy_trade/sales_packing_list_print.pt +++ b/product/Coramy/skins/coramy_trade/sales_packing_list_print.pt @@ -8,7 +8,7 @@ page_number python:[0]"> <TABLE tal:repeat="delivery delivery_list" width="660" height="955" cellpadding="0" cellspacing="0" tal:attributes="class python:here.PT_pageBreak(page_number)"> <TABLE border="0" width="660" height="900" cellpadding="0" cellspacing="0" - tal:define="order python:delivery.getCausalityValue(portal_type=['Sales Order']); + tal:define="order python:delivery.getCausalityValue(portal_type=['Sales Order','Sales Packing List']); destination python:delivery.getDestinationValue(portal_type=['Organisation']); delivery_line_list python:filter(lambda line_item: line_item.getTargetTotalQuantity() > 0, delivery.contentValues(filter={'portal_type': 'Sales Packing List Line'})); diff --git a/product/Coramy/skins/coramy_trade/sales_packing_list_view.form b/product/Coramy/skins/coramy_trade/sales_packing_list_view.form index 1ec05e614ec4b947cd653d35dd748e5e32c01cd2..cbaa677233c878e77eaa11e6391cdd495659debf 100755 --- a/product/Coramy/skins/coramy_trade/sales_packing_list_view.form +++ b/product/Coramy/skins/coramy_trade/sales_packing_list_view.form @@ -140,6 +140,36 @@ <message name="unknown_selection">You selected an item that was not in the list.</message> </messages> </field> + <field><id>my_source_title</id> <type>RelationStringField</type> + <values> + <alternate_name></alternate_name> + <base_category>source</base_category> + <catalog_index>Title</catalog_index> + <css_class></css_class> + <default></default> + <default_module>organisation</default_module> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> + <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type> + <required type="int">0</required> + <title>Expédié par</title> + <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> + </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_long">Too much input was given.</message> + </messages> + </field> </fields> </group> <group> @@ -248,7 +278,37 @@ <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> + <title>python: here.getDestinationValue(portal_type=['Organisation']).Organisation_getOneLineAddress()</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_destination_section_title</id> <type>RelationStringField</type> + <values> + <alternate_name></alternate_name> + <base_category>destination_section</base_category> + <catalog_index>Title</catalog_index> + <css_class></css_class> + <default></default> + <default_module>organisation</default_module> + <description></description> + <display_maxwidth></display_maxwidth> + <display_width type="int">20</display_width> + <external_validator></external_validator> + <extra></extra> + <hidden type="int">0</hidden> + <jump_method>base_jump_relation</jump_method> + <max_length></max_length> + <portal_type type="list">[('Organisation', 'Organisation'), ('Category', 'Category'), ('Person', 'Person')]</portal_type> + <required type="int">0</required> + <title>Pour le compte de</title> + <truncate type="int">0</truncate> + <update_method>base_update_relation</update_method> + </values> + <tales> </tales> <messages> <message name="external_validator_failed">The input failed the external validator.</message> @@ -587,4 +647,4 @@ </fields> </group> </groups> -</form> \ No newline at end of file +</form> diff --git a/product/ERP5/Document/AppliedRule.py b/product/ERP5/Document/AppliedRule.py index ed7969dc4301a4b553da6838c48764a0d4725795..5c322d44c2f62bba12d041feab240493fabe082a 100755 --- a/product/ERP5/Document/AppliedRule.py +++ b/product/ERP5/Document/AppliedRule.py @@ -163,7 +163,7 @@ An ERP5 Rule...""" rule.reset(self) security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self): + def expand(self, **kw): """ Expands the current movement downward. diff --git a/product/ERP5/Document/DeliveryRule.py b/product/ERP5/Document/DeliveryRule.py index 4769f07de4668620dcb99f3db3dcaa28bca78fba..edfe7a66074960c4bfb0dfc77a089e0d379fb865 100755 --- a/product/ERP5/Document/DeliveryRule.py +++ b/product/ERP5/Document/DeliveryRule.py @@ -120,7 +120,7 @@ An ERP5 Rule...""" # Simulation workflow security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule): + def expand(self, applied_rule, **kw): """ Expands the current movement downwards. @@ -136,7 +136,9 @@ An ERP5 Rule...""" # Only expand if my_delivery is not None and state is not 'confirmed' if my_delivery is not None: - if my_delivery.getSimulationState() not in ('delivered', ): + #if my_delivery.getSimulationState() not in ('delivered', ): + # Even if delivered, we should always calculate consequences + if 1: # First, check each contained movement and make # a list of delivery ids which do not need to be copied # eventually delete movement which do not exist anylonger @@ -216,7 +218,7 @@ An ERP5 Rule...""" % delivery_line_object.absolute_url()) # Pass to base class - Rule.expand(self, applied_rule) + Rule.expand(self, applied_rule, **kw) security.declareProtected(Permissions.ModifyPortalContent, 'solve') def solve(self, applied_rule, solution_list): diff --git a/product/ERP5/Document/Order.py b/product/ERP5/Document/Order.py index f8296ab3bacbe05236621cae9457d31989832118..30892ecf194086763c246345c31b7d720e2f9845 100755 --- a/product/ERP5/Document/Order.py +++ b/product/ERP5/Document/Order.py @@ -236,20 +236,24 @@ An order...""" my_applied_rule_list = self.getCausalityRelatedValueList(portal_type='Applied Rule') if len(my_applied_rule_list) != 1: # XXX This is an error - return + raise CategoryError, "Order has no or too many order rule(s)" applied_rule = my_applied_rule_list[0].getObject() if applied_rule is None: # XXX This is an error - return + raise CategoryError, "Order has None order rule" # Make sure applied rule has been reindexed - applied_rule.flushActivity(invoke=1) # Make sure there are no more activities on this order related to expand - self.flushActivity(invoke=1, method_id='expand') # Make sure expand is finished + self.flushActivity(invoke=0, method_id='expand') # Make sure expand is finished + # We are expanding but are not allowed to if state wrong... + # (ex. confirmed) + applied_rule.expand(force = 1) # thus, we mist force expand of applied order rule + applied_rule.flushActivity(invoke=1) # Build delivery list on applied rule # Currently, we build it 'again' but we should actually only build # deliveries for orphaned movements if self.getPortalType() == 'Production Order' : delivery_list = self.ProductionOrder_buildDeliveryList() # Coramy specific moved to portal_simulation + #else: elif self.getPortalType() in ('Purchase Order', 'Sales Order') : delivery_list = self.order_create_packing_list() # Coramy specific should be moved to portal_simulation #self.informDeliveryList(delivery_list=delivery_list, comment=repr(delivery_list)) # XXX Not ready diff --git a/product/ERP5/Document/OrderRule.py b/product/ERP5/Document/OrderRule.py index ac4e693d0ec16ee80126967f501ad1c9b4860f38..0c23ae4f6f9991a7a1286dabba8e5542fc968d44 100755 --- a/product/ERP5/Document/OrderRule.py +++ b/product/ERP5/Document/OrderRule.py @@ -29,7 +29,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, Interface from Products.ERP5.Document.Rule import Rule -from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list +from Products.ERP5.ERP5Globals import movement_type_list, order_movement_type_list, reserved_inventory_state_list, current_inventory_state_list from zLOG import LOG @@ -121,7 +121,7 @@ An ERP5 Rule...""" # Simulation workflow security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule): + def expand(self, applied_rule, force=0, **kw): """ Expands the current movement downward. @@ -141,8 +141,9 @@ An ERP5 Rule...""" if my_order is not None: # 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: + if force or \ + (my_order.getSimulationState() not in reserved_inventory_state_list and \ + my_order.getSimulationState() not in current_inventory_state_list): # First, check each contained movement and make # a list of order ids which do not need to be copied # eventually delete movement which do not exist anylonger @@ -198,7 +199,7 @@ An ERP5 Rule...""" % order_line_object.absolute_url()) # Pass to base class - Rule.expand(self, applied_rule) + Rule.expand(self, applied_rule, force=force, **kw) security.declareProtected(Permissions.ModifyPortalContent, 'solve') def solve(self, applied_rule, solution_list): diff --git a/product/ERP5/Document/Rule.py b/product/ERP5/Document/Rule.py index 5d6e2782c1a94832676fa0dd4a3efb0a2a09f0ae..683e9e6cecef95c497b5798c76b092fe664b8372 100755 --- a/product/ERP5/Document/Rule.py +++ b/product/ERP5/Document/Rule.py @@ -167,7 +167,7 @@ An ERP5 Rule...""" """ security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule): + def expand(self, applied_rule, **kw): """ Expands the current movement downward. @@ -177,7 +177,7 @@ An ERP5 Rule...""" is expanded. """ for o in applied_rule.objectValues(): - o.expand() + o.expand(**kw) security.declareProtected(Permissions.ModifyPortalContent, 'solve') def solve(self, applied_rule, solution_list): diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 39966ef73153891a0fa31c10a95623f7086fb2b5..d9aab201ee19d4cc59570ae773e0b3c08cd4fdd0 100755 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -236,7 +236,7 @@ a service in a public administration).""" # Causality Workflow Methods security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self): + def expand(self, **kw): """ -> new status : expanded @@ -252,7 +252,7 @@ a service in a public administration).""" if self.getCausalityState() is 'expanded': # Reexpand for my_applied_rule in self.objectValues(): - my_applied_rule.expand() + my_applied_rule.expand(**kw) else: portal_rules = getToolByName(self, 'portal_rules') # Parse each applied rule and test if it applied diff --git a/product/ERP5/Document/TransformationRule.py b/product/ERP5/Document/TransformationRule.py index 533dfab4c52731f2559e0a2634f624d2b79558ca..b7805bbc1b416fbc602a20e7cdedf177fc1980da 100755 --- a/product/ERP5/Document/TransformationRule.py +++ b/product/ERP5/Document/TransformationRule.py @@ -166,7 +166,7 @@ An ERP5 Rule...""" # Simulation workflow security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule): + def expand(self, applied_rule, **kw): """ Expands the current movement downward. @@ -289,7 +289,7 @@ An ERP5 Rule...""" applied_rule._delObject(movement.getId()) # XXXX Make sur this is not deleted if already in delivery # Pass to base class - Rule.expand(self, applied_rule) + Rule.expand(self, applied_rule, **kw) security.declareProtected(Permissions.ModifyPortalContent, 'solve') def solve(self, applied_rule, solution_list): diff --git a/product/ERP5/Document/TransformationSourcingRule.py b/product/ERP5/Document/TransformationSourcingRule.py index c0e0c975c8ac6b2f49ddfa39be915969395612fa..c117ecf0afbf2c258dccafeaef8665e742d595fc 100755 --- a/product/ERP5/Document/TransformationSourcingRule.py +++ b/product/ERP5/Document/TransformationSourcingRule.py @@ -153,7 +153,7 @@ An ERP5 Rule...""" """ security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule): + def expand(self, applied_rule, **kw): """ Expands the current movement downward. @@ -219,7 +219,7 @@ An ERP5 Rule...""" my_context_movement.getVariationCategoryList()) # Create one submovement which sources the transformation - Rule.expand(self, applied_rule) + Rule.expand(self, applied_rule, **kw) security.declareProtected(Permissions.ModifyPortalContent, 'solve') def solve(self, applied_rule, solution_list): diff --git a/product/ERP5/Document/ZeroStockRule.py b/product/ERP5/Document/ZeroStockRule.py index a88c7ff1abc35ce4f9fd1abefd63e556199e77e4..a15b64f9578fe7c304fee62d5d7c2e6405f56355 100755 --- a/product/ERP5/Document/ZeroStockRule.py +++ b/product/ERP5/Document/ZeroStockRule.py @@ -123,7 +123,7 @@ An ERP5 Rule...""" # Simulation workflow security.declareProtected(Permissions.ModifyPortalContent, 'expand') - def expand(self, applied_rule): + def expand(self, applied_rule, **kw): """ An applied rule can be expanded only if its parent movement is expanded. diff --git a/product/ERP5/Tool/SimulationTool.py b/product/ERP5/Tool/SimulationTool.py index 6696e40c8b0fbfced8b79f910cc8e50a4f571e82..b661a927d89b7ef249784f5f764c84e9c7353b2a 100755 --- a/product/ERP5/Tool/SimulationTool.py +++ b/product/ERP5/Tool/SimulationTool.py @@ -505,10 +505,12 @@ class SimulationTool (Folder, UniqueObject): if movement_group is not None: for order_group in movement_group.group_list: # Order should never be None + LOG("buildDeliveryList", 0, str(order_group.__dict__)) if order_group.order is not None: order = self.portal_categories.resolveCategory(order_group.order) if order is not None: # define some variables + LOG("order", 0, str(order.__dict__)) if order.getPortalType() == 'Purchase Order' : delivery_module = order.getPortalObject().livraison_achat delivery_type = 'Purchase Packing List' @@ -519,139 +521,151 @@ class SimulationTool (Folder, UniqueObject): delivery_type = 'Sales Packing List' delivery_line_type = delivery_type + ' Line' delivery_cell_type = 'Delivery Cell' - else: - #LOG("ERP5 Simulation", 100, "None order makes no sense") + else : # should never be none + LOG("order is None", 0, str(order.__dict__)) return delivery_list + else: # order is None + order = None + # possible when we build deliveries for tranfer of property + delivery_module = self.getPortalObject().livraison_vente + delivery_type = 'Sales Packing List' + delivery_line_type = delivery_type + ' Line' + delivery_cell_type = 'Delivery Cell' + + for path_group in order_group.group_list : + # we create a new delivery for each DateGroup + + # if path is internal ??? + # JPS NEW + if path_group.source is None or path_group.destination is None: + # Production Path + LOG("Builder",0, "Strange Path %s " % path_group.source) + LOG("Builder",0, "Strange Path %s " % path_group.destination) + + if path_group.source is None or path_group.destination is None: + delivery_module = self.rapport_fabrication + delivery_type = 'Production Report' + delivery_line_type = 'Production Report Line' + delivery_cell_type = 'Production Report Cell' + elif path_group.destination.find('site/Stock_PF') >= 0 and \ + path_group.source.find('site/Piquage') >= 0: + delivery_module = self.livraison_fabrication + delivery_type = 'Production Packing List' + delivery_line_type = delivery_type + ' Line' + delivery_cell_type = 'Delivery Cell' + elif path_group.source.find('site/Stock_MP') >= 0 and \ + path_group.destination.find('site/Piquage') >= 0: + delivery_module = self.livraison_fabrication + delivery_type = 'Production Packing List' + delivery_line_type = delivery_type + ' Line' + delivery_cell_type = 'Delivery Cell' + + for date_group in path_group.group_list : + + # Create a new packing list + new_delivery_id = str(delivery_module.generateNewId()) + self.portal_types.constructContent(type_name = delivery_type, + container = delivery_module, + id = new_delivery_id, + target_start_date = date_group.start_date, + target_stop_date = date_group.stop_date, + start_date = date_group.start_date, + stop_date = date_group.stop_date, + source = path_group.source, + destination = path_group.destination, + source_section = path_group.source_section, + destination_section = path_group.destination_section + ) + delivery = delivery_module[new_delivery_id] + if order is not None : + delivery.edit(title = order.getTitle(), + causality_value = order, + incoterm = order.getIncoterm(), + delivery_mode = order.getDeliveryMode() + ) + # the new delivery is added to the delivery_list + delivery_list.append(delivery) + # LOG('Livraison créée',0,str(delivery.getId())) + + # Create each delivery_line in the new delivery + + for resource_group in date_group.group_list : + if delivery_type == 'Production Report': + if resource_group.resource.find('operation') == 0: + delivery_line_type = 'Production Report Operation' + else: + delivery_line_type = 'Production Report Component' + + new_delivery_line_id = str(delivery.generateNewId()) + self.portal_types.constructContent(type_name = delivery_line_type, + container = delivery, + id = new_delivery_line_id, + resource = resource_group.resource, + ) + delivery_line = delivery[new_delivery_line_id] + #LOG('Ligne créée',0,str(delivery_line.getId())+' '+str(delivery_line.getResource())) + + line_variation_category_list = [] + line_variation_base_category_dict = {} + + # compute line_variation_base_category_list and + # line_variation_category_list for new delivery_line + for variant_group in resource_group.group_list : + for variation_item in variant_group.category_list : + if not variation_item in line_variation_category_list : + line_variation_category_list.append(variation_item) + variation_base_category_items = variation_item.split('/') + if len(variation_base_category_items) > 0 : + line_variation_base_category_dict[variation_base_category_items[0]] = 1 + + # update variation_base_category_list and line_variation_category_list for delivery_line + line_variation_base_category_list = line_variation_base_category_dict.keys() + delivery_line._setVariationBaseCategoryList(line_variation_base_category_list) + delivery_line.setVariationCategoryList(line_variation_category_list) + + # IMPORTANT : delivery cells are automatically created during setVariationCategoryList + + # update target_quantity for each delivery_cell + for variant_group in resource_group.group_list : + #LOG('Variant_group examin?,0,str(variant_group.category_list)) + object_to_update = None + # if there is no variation of the resource, update delivery_line with quantities and price + if len(variant_group.category_list) == 0 : + object_to_update = delivery_line + # else find which delivery_cell is represented by variant_group + else : + categories_identity = 0 + #LOG('Before Check cell',0,str(delivery_cell_type)) + #LOG('Before Check cell',0,str(delivery_line.contentValues())) + for delivery_cell in delivery_line.contentValues( + filter={'portal_type':delivery_cell_type}) : + #LOG('Check cell',0,str(delivery_cell)) + if len(variant_group.category_list) == len(delivery_cell.getVariationCategoryList()) : + #LOG('Parse category',0,str(delivery_cell.getVariationCategoryList())) + for category in delivery_cell.getVariationCategoryList() : + if not category in variant_group.category_list : + #LOG('Not found category',0,str(category)) + break + else : + categories_identity = 1 + + if categories_identity : + object_to_update = delivery_cell + break - for path_group in order_group.group_list : - # we create a new delivery for each DateGroup - - # if path is internal ??? - # JPS NEW - if path_group.source is None or path_group.destination is None: - # Production Path - #LOG("Builder",0, "Strange Path %s " % path_group.source) - #LOG("Builder",0, "Strange Path %s " % path_group.destination) - delivery_module = self.rapport_fabrication - delivery_type = 'Production Report' - delivery_line_type = 'Production Report Line' - delivery_cell_type = 'Production Report Cell' - elif path_group.destination.find('site/Stock_PF') >= 0 and \ - path_group.source.find('site/Piquage') >= 0: - delivery_module = self.livraison_fabrication - delivery_type = 'Production Packing List' - delivery_line_type = delivery_type + ' Line' - delivery_cell_type = 'Delivery Cell' - elif path_group.source.find('site/Stock_MP') >= 0 and \ - path_group.destination.find('site/Piquage') >= 0: - delivery_module = self.livraison_fabrication - delivery_type = 'Production Packing List' - delivery_line_type = delivery_type + ' Line' - delivery_cell_type = 'Delivery Cell' - - for date_group in path_group.group_list : - - # Create a new packing list - new_delivery_id = str(delivery_module.generateNewId()) - self.portal_types.constructContent(type_name = delivery_type, - container = delivery_module, - id = new_delivery_id, - title = order.getTitle(), - causality_value = order, - incoterm = order.getIncoterm(), - delivery_mode = order.getDeliveryMode(), - target_start_date = date_group.start_date, - target_stop_date = date_group.stop_date, - start_date = date_group.start_date, - stop_date = date_group.stop_date, - source = path_group.source, - destination = path_group.destination, - source_section = path_group.source_section, - destination_section = path_group.destination_section - ) - delivery = delivery_module[new_delivery_id] - # the new delivery is added to the delivery_list - delivery_list.append(delivery) - # LOG('Livraison créée',0,str(delivery.getId())) - - # Create each delivery_line in the new delivery - - for resource_group in date_group.group_list : - if delivery_type == 'Production Report': - if resource_group.resource.find('operation') == 0: - delivery_line_type = 'Production Report Operation' - else: - delivery_line_type = 'Production Report Component' - - new_delivery_line_id = str(delivery.generateNewId()) - self.portal_types.constructContent(type_name = delivery_line_type, - container = delivery, - id = new_delivery_line_id, - resource = resource_group.resource, - ) - delivery_line = delivery[new_delivery_line_id] - #LOG('Ligne créée',0,str(delivery_line.getId())+' '+str(delivery_line.getResource())) - - line_variation_category_list = [] - line_variation_base_category_dict = {} - - # compute line_variation_base_category_list and - # line_variation_category_list for new delivery_line - for variant_group in resource_group.group_list : - for variation_item in variant_group.category_list : - if not variation_item in line_variation_category_list : - line_variation_category_list.append(variation_item) - variation_base_category_items = variation_item.split('/') - if len(variation_base_category_items) > 0 : - line_variation_base_category_dict[variation_base_category_items[0]] = 1 - - # update variation_base_category_list and line_variation_category_list for delivery_line - line_variation_base_category_list = line_variation_base_category_dict.keys() - delivery_line._setVariationBaseCategoryList(line_variation_base_category_list) - delivery_line.setVariationCategoryList(line_variation_category_list) - - # IMPORTANT : delivery cells are automatically created during setVariationCategoryList - - # update target_quantity for each delivery_cell - for variant_group in resource_group.group_list : - #LOG('Variant_group examin',0,str(variant_group.category_list)) - object_to_update = None - # if there is no variation of the resource, update delivery_line with quantities and price - if len(variant_group.category_list) == 0 : - object_to_update = delivery_line - # else find which delivery_cell is represented by variant_group - else : - categories_identity = 0 - #LOG('Before Check cell',0,str(delivery_cell_type)) - #LOG('Before Check cell',0,str(delivery_line.contentValues())) - for delivery_cell in delivery_line.contentValues( - filter={'portal_type':delivery_cell_type}) : - #LOG('Check cell',0,str(delivery_cell)) - if len(variant_group.category_list) == len(delivery_cell.getVariationCategoryList()) : - #LOG('Parse category',0,str(delivery_cell.getVariationCategoryList())) - for category in delivery_cell.getVariationCategoryList() : - if not category in variant_group.category_list : - #LOG('Not found category',0,str(category)) - break - else : - categories_identity = 1 - - if categories_identity : - object_to_update = delivery_cell - break - - # compute target_quantity, quantity and price for delivery_cell or delivery_line and - # build relation between simulation_movement and delivery_cell or delivery_line - if object_to_update is not None : - cell_target_quantity = 0 - cell_total_price = 0 - for movement in variant_group.movement_list : - cell_target_quantity += movement.getNetConvertedTargetQuantity() - try: - cell_total_price += movement.getNetConvertedTargetQuantity()*movement.getPrice() # XXX WARNING - ADD PRICED QUANTITY - except: - cell_total_price = None - + # compute target_quantity, quantity and price for delivery_cell or delivery_line and + # build relation between simulation_movement and delivery_cell or delivery_line + if object_to_update is not None : + cell_target_quantity = 0 + cell_total_price = 0 + for movement in variant_group.movement_list : + cell_target_quantity += movement.getNetConvertedTargetQuantity() + try: + cell_total_price += movement.getNetConvertedTargetQuantity()*movement.getPrice() # XXX WARNING - ADD PRICED QUANTITY + except: + cell_total_price = None + + if movement.getPortalType() == 'Simulation Movement' : # update every simulation_movement # we set delivery_value and target dates and quantity movement._setDeliveryValue(object_to_update) @@ -665,16 +679,16 @@ class SimulationTool (Folder, UniqueObject): # We will reindex later reindexable_movement_list.append(movement) - if cell_target_quantity <> 0 and cell_total_price is not None: - average_price = cell_total_price/cell_target_quantity - else : - average_price = 0 - #LOG('object mis ?jour',0,str(object_to_update.getRelativeUrl())) - object_to_update._edit(target_quantity = cell_target_quantity, - quantity = cell_target_quantity, - price = average_price, - force_update = 1, - ) + if cell_target_quantity <> 0 and cell_total_price is not None: + average_price = cell_total_price/cell_target_quantity + else : + average_price = 0 + #LOG('object mis ?jour',0,str(object_to_update.getRelativeUrl())) + object_to_update._edit(target_quantity = cell_target_quantity, + quantity = cell_target_quantity, + price = average_price, + force_update = 1, + ) # If we reach this point, it means we could # create deliveries diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index 426081e26e5d79363e82fd66d3abac504b43202a..1854a8c3e5746a49e8e376502d45dde6e4dc1c8b 100755 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -495,6 +495,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana security.declareProtected( Permissions.ModifyPortalContent, 'edit' ) def edit(self, REQUEST=None, force_update = 0, reindex_object=1, **kw): return self._edit(REQUEST=REQUEST, force_update=force_update, reindex_object=reindex_object, **kw) + edit = WorkflowMethod( edit ) # Accessing object property Ids