Commit ed656a30 authored by Jérome Perrin's avatar Jérome Perrin

Merge remote-tracking branch 'upstream/master' into zope4py2

parents 6ee4cfe5 adcb959e
Pipeline #23551 failed with stage
in 0 seconds
......@@ -52,7 +52,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -53,7 +53,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -27,6 +27,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>category_type</string> </key>
<value>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
......
......@@ -28,6 +28,14 @@
</tuple>
</value>
</item>
<item>
<key> <string>category_type</string> </key>
<value>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
......
......@@ -124,11 +124,18 @@ class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
kw = {'delivery': None, 'resource': resource, 'price': 1}
return kw
def getGeneratedMovementList(self, movement_list=None, rounding=False):
movement_list = super(InvoiceTransactionRuleMovementGenerator, self).getGeneratedMovementList(movement_list=movement_list, rounding=rounding)
def _updateGeneratedMovementList(self, input_movement, generated_movement_list):
portal = self._applied_rule.getPortalObject()
for arrow in 'destination', 'source':
for movement in movement_list:
generated_movement_list = super(
InvoiceTransactionRuleMovementGenerator,
self,
)._updateGeneratedMovementList(
input_movement,
generated_movement_list,
)
for arrow, sign in ('destination', 1), ('source', -1):
for movement in generated_movement_list:
resource = movement.getResource()
if resource is not None:
section = movement.getDefaultAcquiredValue(arrow + '_section')
......@@ -144,13 +151,8 @@ class InvoiceTransactionRuleMovementGenerator(MovementGeneratorMixin):
categories=('price_currency/' + currency_url,
'resource/' + resource)))
if exchange_ratio is not None:
if arrow == 'destination':
sign = 1
else:
sign = -1
movement.setProperty(arrow + '_total_asset_price', movement.getQuantity() * exchange_ratio * sign)
return movement_list
return generated_movement_list
def _getInputMovementList(self, movement_list=None, rounding=False):
simulation_movement = self._applied_rule.getParentValue()
......
......@@ -32,67 +32,37 @@ from erp5.component.document.InvoiceTransactionSimulationRule import (InvoiceTra
class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleMovementGenerator):
"""
"""
# CMF Type Definition
meta_type = 'ERP5 Inventory Asset Price Accounting Simulation Rule'
portal_type = 'Inventory Asset Price Accounting Simulation Rule'
# XXX: Copy/paste from erp5.component.mixin.RuleMixin to support Transit use case
def getGeneratedMovementList(self, movement_list=None, rounding=False):
"""
Returns a list of movements generated by that rule.
movement_list - optional IMovementList which can be passed explicitely
rounding - boolean argument, which controls if rounding shall be applied on
generated movements or not
NOTE:
- implement rounding appropriately (True or False seems
simplistic)
def _updateGeneratedMovementList(self, input_movement, generated_movement_list):
"""Support Transit use case
"""
# Default implementation below can be overriden by subclasses
# however it should be generic enough not to be overriden
# by most classes
# Results will be appended to result
result = []
# Build a list of movement and business path
input_movement_list = self._getInputMovementList(
movement_list=movement_list, rounding=rounding)
for input_movement in input_movement_list:
# Merge movement and business path properties (core implementation)
# Lookup Business Process through composition (NOT UNION)
business_process = input_movement.asComposedDocument()
explanation = self._applied_rule # We use applied rule as local explanation
trade_phase = self._getTradePhaseList(input_movement, business_process) # XXX-JPS not convenient to handle
update_property_dict = self._getUpdatePropertyDict(input_movement)
for movement in business_process.getTradePhaseMovementList(explanation, input_movement,
trade_phase=trade_phase, delay_mode=None,
update_property_dict=update_property_dict):
# PATCH-BEGIN
update_dict = {}
if movement.getLedger() in ('stock/stock/entree',
'stock/preparation/entree',
'stock/transit/sortie',
'stock/customs/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStopDate()
elif movement.getLedger() in ('stock/stock/sortie',
'stock/preparation/sortie',
'stock/transit/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate()
movement._edit(**update_dict)
input_movement.log("%r (input_movement=%r): ledger=%r, start_date=%r, stop_date=%r" %
(movement,
input_movement,
movement.getLedger(),
movement.getStartDate(),
movement.getStopDate()))
# PATCH-END
result.append(movement)
# And return list of generated movements
return result
generated_movement_list = super(
InventoryAssetPriceAccountingRuleMovementGenerator,
self,
)._updateGeneratedMovementList(
input_movement,
generated_movement_list,
)
for movement in generated_movement_list:
update_dict = {}
if movement.getLedger() in ('stock/stock/entree',
'stock/preparation/entree',
'stock/transit/sortie',
'stock/customs/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStopDate()
elif movement.getLedger() in ('stock/stock/sortie',
'stock/preparation/sortie',
'stock/transit/entree'):
update_dict['start_date'] = update_dict['stop_date'] = input_movement.getStartDate()
movement._edit(**update_dict)
input_movement.log("%r (input_movement=%r): ledger=%r, start_date=%r, stop_date=%r" %
(movement,
input_movement,
movement.getLedger(),
movement.getStartDate(),
movement.getStopDate()))
return generated_movement_list
def _getInputMovementList(self, movement_list=None, rounding=False):
simulation_movement = self._applied_rule.getParentValue()
......@@ -115,7 +85,12 @@ class InventoryAssetPriceAccountingRuleMovementGenerator(InvoiceTransactionRuleM
return update_property_dict
class InventoryAssetPriceAccountingSimulationRule(InvoiceTransactionSimulationRule):
# CMF Type Definition
meta_type = 'ERP5 Inventory Asset Price Accounting Simulation Rule'
portal_type = 'Inventory Asset Price Accounting Simulation Rule'
def _getMovementGenerator(self, context):
return InventoryAssetPriceAccountingRuleMovementGenerator(
applied_rule=context, rule=self)
......@@ -114,22 +114,7 @@ class TradeModelPath(Path):
Returns all categories which are used to define the source
of this Arrow
"""
# Naive implementation - we must use category groups instead - XXX
return ('source',
'source_account',
'source_administration',
#'source_advice',
'source_carrier',
'source_decision',
'source_function',
'source_funding',
'source_payment',
'source_project',
'source_referral',
'source_section',
'source_trade',
#'source_transport'
)
return self.getPortalObject().getPortalSourceArrowBaseCategoryList()
security.declareProtected(Permissions.AccessContentsInformation,
'getDestinationArrowBaseCategoryList')
......@@ -138,22 +123,7 @@ class TradeModelPath(Path):
Returns all categories which are used to define the destination
of this Arrow
"""
# Naive implementation - we must use category groups instead - XXX-JPS review this later
return ('destination',
'destination_account',
'destination_administration',
#'destination_advice',
#'destination_carrier',
'destination_decision',
'destination_function',
'destination_funding',
'destination_payment',
'destination_project',
'destination_referral',
'destination_section',
'destination_trade',
#'destination_transport'
)
return self.getPortalObject().getPortalDestinationArrowBaseCategoryList()
# XXX-JPS UNkonwn ?
security.declareProtected(Permissions.AccessContentsInformation,
......
......@@ -938,6 +938,22 @@ class ERP5Site(ResponseHeaderGenerator, FolderMixIn, PortalObjectBase, CacheCook
"""
return self._getPortalGroupedCategoryList('sub_variation')
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalSourceArrowBaseCategoryList')
def getPortalSourceArrowBaseCategoryList(self):
"""
Return source arrow base categories.
"""
return self._getPortalGroupedCategoryList('source_arrow')
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalDestinationArrowBaseCategoryList')
def getPortalDestinationArrowBaseCategoryList(self):
"""
Return destination arrow base categories.
"""
return self._getPortalGroupedCategoryList('destination_arrow')
security.declareProtected(Permissions.AccessContentsInformation,
'getPortalVariationTypeList')
def getPortalVariationTypeList(self):
......
......@@ -68,7 +68,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -52,7 +52,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -50,7 +50,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -50,7 +50,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -70,7 +70,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -118,7 +118,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -50,7 +50,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -119,7 +119,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -71,7 +71,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -68,7 +68,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -71,7 +71,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>destination_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -115,7 +115,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -53,7 +53,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -50,7 +50,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -50,7 +50,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -70,7 +70,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -118,7 +118,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -50,7 +50,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -119,7 +119,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -118,7 +118,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -68,7 +68,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -72,7 +72,9 @@
<item>
<key> <string>category_type</string> </key>
<value>
<tuple/>
<tuple>
<string>source_arrow</string>
</tuple>
</value>
</item>
<item>
......
......@@ -74,9 +74,6 @@ class MovementGeneratorMixin(object):
- implement rounding appropriately (True or False seems
simplistic)
"""
# Default implementation below can be overriden by subclasses
# however it should be generic enough not to be overriden
# by most classes
# Results will be appended to result
result = []
# Build a list of movement and business path
......@@ -89,9 +86,13 @@ class MovementGeneratorMixin(object):
explanation = self._applied_rule # We use applied rule as local explanation
trade_phase = self._getTradePhaseList(input_movement, business_process) # XXX-JPS not convenient to handle
update_property_dict = self._getUpdatePropertyDict(input_movement)
result.extend(business_process.getTradePhaseMovementList(explanation, input_movement,
trade_phase=trade_phase, delay_mode=None,
update_property_dict=update_property_dict))
generated_movement_list = business_process.getTradePhaseMovementList(
explanation,
input_movement,
trade_phase=trade_phase,
delay_mode=None,
update_property_dict=update_property_dict)
result.extend(self._updateGeneratedMovementList(input_movement, generated_movement_list))
# And return list of generated movements
return result
......@@ -102,6 +103,9 @@ class MovementGeneratorMixin(object):
# Other movement generators usually want to reset delivery.
return {'delivery': input_movement.getRelativeUrl()}
def _updateGeneratedMovementList(self, input_movement, generated_movement_list):
return generated_movement_list
def _getTradePhaseList(self, input_movement, business_process): # XXX-JPS WEIRD
if self._trade_phase_list:
return self._trade_phase_list
......
......@@ -10,9 +10,9 @@
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>title</string>
<string>items</string>
<string>size</string>
<string>title</string>
</list>
</value>
</item>
......@@ -113,6 +113,14 @@
<string>sub_variation</string>
<string>sub_variation</string>
</tuple>
<tuple>
<string>Source Arrow</string>
<string>source_arrow</string>
</tuple>
<tuple>
<string>Destination Arrow</string>
<string>destination_arrow</string>
</tuple>
</list>
</value>
</item>
......
......@@ -2,3 +2,22 @@ div[data-gadget-url$="gadget_editor.html"] > textarea,
div[data-gadget-url$="gadget_editor.html"] > pre code {
font-family: "Courier New", Courier, monospace;
}
/*
* xhtml: make editors in bottom group use full height
*/
.main_form,
.main_form .master,
.main_form .master .document,
.main_form .master .document .content,
.main_form fieldset.bottom,
.main_form fieldset.bottom > .field,
.main_form fieldset.bottom > .field > .input,
.main_form fieldset.bottom > .field > .input > div[data-gadget-url$="gadget_editor.html"],
.main_form fieldset.bottom > .field > .input > div[data-gadget-url$="gadget_editor.html"] div[data-gadget-scope="editor"],
.main_form fieldset.bottom > .field > .input > div[data-gadget-url$="gadget_editor.html"] iframe {
height: 100%;
display: flex;
flex-direction: column;
flex: 1 1 auto;
}
......@@ -19,6 +19,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
html, body {
height: 100%;
}
input, textarea, select, button, body, div, span, fieldset {
font-family: <dtml-var font_family>;
font-size: <dtml-var font_size>;
......@@ -28,7 +32,7 @@ input, textarea, select, button, body, div, span, fieldset {
iframe {
width: 100%;
height: 50vh;
min-height: 50vh;
}
div.input > select, div.input > input, div.listbox select {
......
......@@ -436,6 +436,9 @@ def synchronizeDynamicModules(context, force=False):
import erp5
with aq_method_lock:
# bootstrap the site and perform some "critical" migrations that can not be
# performed using upgrader, because the migrations are required to run upgrader.
#
# Thanks to TransactionalResource, the '_bootstrapped' global variable
# is updated in a transactional way. Without it, it would be required to
# restart the instance if anything went wrong.
......@@ -464,7 +467,7 @@ def synchronizeDynamicModules(context, force=False):
if tool is None:
if tool_class == ERP5CatalogTool:
# Wait till we find that SQL Catalog Tool is installed
# Simpy said, we don't want ERP5 Catalog Tool to be installed
# Simply said, we don't want ERP5 Catalog Tool to be installed
# from here. So, we come to 2 cases:
# 1. Running ERP5Site with sql catalog_tool : In that case, we end up
# running _bootstrap from here, leading to migration.
......
......@@ -15,8 +15,7 @@
from threading import local
from Acquisition import aq_inner, aq_parent
from AccessControl.PermissionRole import _what_not_even_god_should_do
from AccessControl.User import BasicUser, SimpleUser
from AccessControl.User import SimpleUser
from App.config import getConfiguration
from ..TransactionalVariable import TransactionalVariable
......
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