Commit 5439dc02 authored by Jérome Perrin's avatar Jérome Perrin

Enable coding style on more business templates

authentication policy, invoicing, ingestion and credential

See merge request !1081
parents a8cd4c03 c9b43e4b
Pipeline #8593 passed with stage
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>password, request={}</string> </value>
<value> <string>password, request=None</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
"""
File a failed authentication attempt.
"""
from DateTime import DateTime
portal = context.getPortalObject()
portal_preferences = portal.portal_preferences
......
......@@ -10,8 +10,6 @@ if not portal.portal_preferences.isAuthenticationPolicyEnabled():
now = DateTime()
one_second = 1/24.0/60.0/60.0
check_duration = portal_preferences.getPreferredAuthenticationFailureCheckDuration()
block_duration = portal_preferences.getPreferredAuthenticationFailureBlockDuration()
max_authentication_failures = portal_preferences.getPreferredMaxAuthenticationFailure()
check_time = now - check_duration*one_second
# acknowledge last authentication events for user
......
......@@ -3,7 +3,6 @@
"""
from DateTime import DateTime
from Products.ZSQLCatalog.SQLCatalog import Query
from Products.ERP5Type.Document import newTempBase
portal = context.getPortalObject()
portal_preferences = portal.portal_preferences
......
......@@ -30,46 +30,41 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Ticket import Ticket
from erp5.component.mixin.EncryptedPasswordMixin import EncryptedPasswordMixin
try:
from Products import PluggableAuthService
from Products.ERP5Security.ERP5UserManager import ERP5UserManager
except ImportError:
PluggableAuthService = None
class CredentialRecovery(Ticket, EncryptedPasswordMixin):
"""
"""
"""
"""
meta_type = 'ERP5 Credential Recovery'
portal_type = 'Credential Recovery'
add_permission = Permissions.AddPortalContent
meta_type = 'ERP5 Credential Recovery'
portal_type = 'Credential Recovery'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.CredentialQuestion
, PropertySheet.DefaultCredentialQuestion
, PropertySheet.Login
, PropertySheet.Codification
, PropertySheet.Person
, PropertySheet.Url
)
# Declarative properties
property_sheets = ( PropertySheet.CredentialQuestion
, PropertySheet.DefaultCredentialQuestion
, PropertySheet.Login
, PropertySheet.Codification
, PropertySheet.Person
, PropertySheet.Url
)
security.declareProtected(Permissions.AccessContentsInformation,
'isAnswerCorrect')
def isAnswerCorrect(self):
'''
Check if the given answer match the real answer
The answer is not case sensitive
'''
related_person = self.getDestinationDecisionValue()
if related_person is not None:
real_answer = related_person.getDefaultCredentialQuestionAnswer()
if real_answer is not None:
proposed_answer = self.getDefaultCredentialQuestionAnswer()
if proposed_answer is not None:
return real_answer.lower() == proposed_answer.lower()
return False
security.declareProtected(Permissions.AccessContentsInformation,
'isAnswerCorrect')
def isAnswerCorrect(self):
'''
Check if the given answer match the real answer
The answer is not case sensitive
'''
related_person = self.getDestinationDecisionValue()
if related_person is not None:
real_answer = related_person.getDefaultCredentialQuestionAnswer()
if real_answer is not None:
proposed_answer = self.getDefaultCredentialQuestionAnswer()
if proposed_answer is not None:
return real_answer.lower() == proposed_answer.lower()
return False
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CredentialRecovery</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.CredentialRecovery</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,26 +98,30 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -31,58 +31,59 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Ticket import Ticket
from erp5.component.mixin.EncryptedPasswordMixin import EncryptedPasswordMixin
class CredentialRequest(Ticket, EncryptedPasswordMixin):
"""
"""
"""
"""
meta_type = 'ERP5 Credential Request'
portal_type = 'Credential Request'
add_permission = Permissions.AddPortalContent
meta_type = 'ERP5 Credential Request'
portal_type = 'Credential Request'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.CredentialQuestion
, PropertySheet.DefaultCredentialQuestion
, PropertySheet.Login
, PropertySheet.Codification
, PropertySheet.Person
, PropertySheet.Reference
, PropertySheet.Url
)
# Declarative properties
property_sheets = ( PropertySheet.CredentialQuestion
, PropertySheet.DefaultCredentialQuestion
, PropertySheet.Login
, PropertySheet.Codification
, PropertySheet.Person
, PropertySheet.Reference
, PropertySheet.Url
)
def checkUserCanChangePassword(self):
# every body can change a password of a credential request as annonymous
# should be able to do it
pass
def checkUserCanChangePassword(self):
# every body can change a password of a credential request as annonymous
# should be able to do it
pass
def checkPasswordValueAcceptable(self, value):
# all passwords are acceptable on Credential Request
pass
def checkPasswordValueAcceptable(self, value):
# all passwords are acceptable on Credential Request
pass
security.declareProtected(Permissions.AccessContentsInformation,
'getTitle')
def getTitle(self, **kw):
"""
Returns the title if it exists or a combination of
first name and last name
"""
if self.title == '':
name_list = []
if self.getFirstName() not in (None, ''):
name_list.append(self.getFirstName())
if self.getLastName() not in (None, ''):
name_list.append(self.getLastName())
if name_list:
return ' '.join(name_list)
return self.getReference() or self.getId()
else:
return self.title
security.declareProtected(Permissions.AccessContentsInformation,
'getTitle')
def getTitle(self, **kw):
"""
Returns the title if it exists or a combination of
first name and last name
"""
if self.title == '':
name_list = []
if self.getFirstName() not in (None, ''):
name_list.append(self.getFirstName())
if self.getLastName() not in (None, ''):
name_list.append(self.getLastName())
if name_list:
return ' '.join(name_list)
return self.getReference() or self.getId()
else:
return self.title
security.declareProtected(Permissions.AccessContentsInformation,
'hasTitle')
def hasTitle(self):
return self.title or self.hasFirstName() or self.hasLastName()
security.declareProtected(Permissions.AccessContentsInformation,
'hasTitle')
def hasTitle(self):
return self.title or self.hasFirstName() or self.hasLastName()
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>CredentialRequest</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.CredentialRequest</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,26 +98,30 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -71,9 +71,9 @@ def isSingleSignOnEnable(self):
if isinstance(acl_users,PluggableAuthServiceTool):
#List plugin which make authentication
plugin_list = acl_users.plugins.listPlugins(IAuthenticationPlugin)
for plugin_name, plugin_value in plugin_list:
for _, plugin_value in plugin_list:
#Try to find an ERP5RemoteUserManager
if isinstance(plugin_value,ERP5RemoteUserManager):
if isinstance(plugin_value, ERP5RemoteUserManager):
#SSO is enable
return True
return False
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Credential</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.Credential</string> </value>
......@@ -24,6 +36,18 @@
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
......@@ -31,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -50,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -59,26 +98,30 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<tuple>
<none/>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</tuple>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
if context.getParentValue().portal_type == 'Credential Request':
return {'Address':dict(organisation_default_address='Organisation Default Address')}
return {'Address': dict(organisation_default_address='Organisation Default Address')}
return {}
......@@ -3,7 +3,6 @@ send the password reset link by mail
"""
portal = context.getPortalObject()
person = context.getDestinationDecisionValue(portal_type="Person")
reference = context.getReference()
if context.hasDocumentReference():
message_reference = context.getDocumentReference()
......
......@@ -2,6 +2,7 @@
Parameters:
value -- field value (string)
REQUEST -- standard REQUEST variable"""
portal = context.getPortalObject()
if value:
# Same tag is used as in ERP5 Login _setReference, in order to protect against
......@@ -13,7 +14,6 @@ def getRealContext():
if not REQUEST:
return context
object_path = REQUEST.get("object_path")
portal = context.getPortalObject()
return portal.restrictedTraverse(object_path)
#Allow user to create a request with it's username
......@@ -29,7 +29,7 @@ if context.getPortalType() == "Credential Request":
related_person = context.getDestinationDecisionValue(portal_type="Person")
if related_person is not None:
for erp5_login_value in related_person.objectValues(
portal_type=self.getPortalObject().getPortalLoginTypeList(),
portal_type=portal.getPortalLoginTypeList(),
):
if erp5_login_value.getValidationState() == 'validated' and erp5_login_value.getReference() == value:
return True
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>role=[],comment=""</string> </value>
<value> <string>role=(), comment=""</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -9,8 +9,6 @@
if REQUEST is not None:
return None
portal = context.getPortalObject()
portal_preferences = context.portal_preferences
# XXX by default we don't want to automatically create/update organisation
# Someone should confirm this informations before creating the organisation
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>related_portal_type = [\'Person\'], REQUEST=None</string> </value>
<value> <string>related_portal_type=(\'Person\', ), REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>create_portal_type=["Person"], REQUEST=None</string> </value>
<value> <string>create_portal_type=("Person",), REQUEST=None</string> </value>
</item>
<item>
<key> <string>id</string> </key>
......
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
"""Copy subscription information to the related organisation"""
context.Credential_checkConsistency(['Organisation'])
......@@ -19,5 +20,5 @@ context.Credential_copyRegistredInformation(organisation, organisation_mapping)
#Try to validate
try:
organisation.validate()
except:
except UnsupportedWorkflowMethod:
pass
......@@ -7,7 +7,6 @@ if REQUEST is not None:
return None
from Products.ERP5Type.Errors import UnsupportedWorkflowMethod
from Products.ERP5Type.Utils import sleep
context.Credential_checkConsistency(['Person'])
person = context.getDestinationDecisionValue(portal_type="Person")
......
......@@ -8,7 +8,6 @@ if REQUEST is not None:
person = context.getDestinationDecisionValue(portal_type="Person")
organisation = context.getDestinationDecisionValue(portal_type="Organisation")
assignment_configuration = {}
#Look on current assignment
old_role_list = context.portal_categories.role.getCategoryChildLogicalPathItemList()[1:]
#old_role_list look like [['title','logical_path'],]
......
......@@ -5,21 +5,21 @@ Manager -- allow to update all image property"""
if REQUEST is not None:
raise ValueError, "This script can not be call from url"
def getAccessor(property):
return "".join([x.capitalize() for x in property.split('_')])
def getAccessor(prop):
return "".join([x.capitalize() for x in prop.split('_')])
def copyValue(source_document, source_accessor,
destination_document, destination_accessor):
getter = getattr(source_document, 'get%s' % source_accessor)
value = getter()
setter = getattr(destination_document, 'set%s' % destination_accessor)
setter(value)
getter = getattr(source_document, 'get%s' % source_accessor)
value = getter()
setter = getattr(destination_document, 'set%s' % destination_accessor)
setter(value)
def copyDocument(source_document, destination_document, mapping):
for source_property, destination_property in mapping:
source_accessor, destination_accessor = getAccessor(source_property), getAccessor(destination_property)
copyValue(source_document, source_accessor,
destination_document, destination_accessor)
for source_property, destination_property in mapping:
source_accessor, destination_accessor = getAccessor(source_property), getAccessor(destination_property)
copyValue(source_document, source_accessor,
destination_document, destination_accessor)
new_default_image = context.getDefaultImageValue()
if new_default_image is not None:
......
......@@ -50,7 +50,7 @@
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>destination_decision_type=[\'Person\']</string> </value>
<value> <string>destination_decision_type=(\'Person\', )</string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
......
......@@ -4,25 +4,25 @@ destination -- Object where copy property value
mapping -- Define property mapping (List of tuple of 2 property)
copy_none_value -- Copy or not None value of context to destination
erase_empty_value -- Erase or not empty value of destination"""
def getAccessor(property):
return "".join([x.capitalize() for x in property.split('_')])
def getAccessor(prop):
return "".join([x.capitalize() for x in prop.split('_')])
def copyValue(source_document, source_accessor,
destination_document, destination_accessor):
getter = getattr(source_document, 'get%s' % source_accessor)
value = getter()
if value is None and copy_none_value or value is not None:
old_getter = getattr(destination_document, 'get%s' % destination_accessor)
old_value = old_getter()
if not old_value and erase_empty_value or old_value:
setter = getattr(destination_document, 'set%s' % destination_accessor)
setter(value)
getter = getattr(source_document, 'get%s' % source_accessor)
value = getter()
if value is None and copy_none_value or value is not None:
old_getter = getattr(destination_document, 'get%s' % destination_accessor)
old_value = old_getter()
if not old_value and erase_empty_value or old_value:
setter = getattr(destination_document, 'set%s' % destination_accessor)
setter(value)
def copyDocument(source_document, destination_document, mapping):
for source_property, destination_property in mapping:
source_accessor, destination_accessor = getAccessor(source_property), getAccessor(destination_property)
copyValue(source_document, source_accessor,
destination_document, destination_accessor)
for source_property, destination_property in mapping:
source_accessor, destination_accessor = getAccessor(source_property), getAccessor(destination_property)
copyValue(source_document, source_accessor,
destination_document, destination_accessor)
......
......@@ -87,7 +87,7 @@
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Base_viewFieldLibrary</string> </value>
<value> <string>Base_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>required</string> </key>
......
object = state_change['object']
object.Base_checkConsistency()
state_change['object'].Base_checkConsistency()
# This script uses file= argument
# pylint: disable=redefined-builtin
"""
Use to contribute file to ERP5.
"""
......
......@@ -88,7 +88,7 @@ elif group_reference_path:
if category is None:
break
if category is not None:
new_dict['group'] = '/'.join(category.getRelativeUrl().split('/')[1:])
new_dict['group'] = '/'.join(category.getRelativeUrl().split('/')[1:])
else:
......
autorized_format_list = []
format_list = context.getTargetFormatItemList()
for format in format_list:
if context.Document_isTargetFormatPermitted(format[1]):
autorized_format_list.append(format)
return autorized_format_list
autorized_format_item_list = []
for format_item_list in context.getTargetFormatItemList():
if context.Document_isTargetFormatPermitted(format_item_list[1]):
autorized_format_item_list.append(format_item_list)
return autorized_format_item_list
# This script uses file= argument
# pylint: disable=redefined-builtin
"""
This script provides a facility to permit conversion by format.
"""
......@@ -25,7 +27,7 @@ if format in ('html', 'stripped-html', 'text', 'txt', 'pdf', 'png', 'jpg', 'gif'
if format.endswith('pdf'):
return True
if format.endswith('html'):
return True
return True
##
## # All other formats are prohibitted
return False
erp5_full_text_mroonga_catalog
erp5_ingestion_mysql_innodb_catalog
erp5_ingestion_test
\ No newline at end of file
erp5_ingestion_mysql_innodb_catalog
\ No newline at end of file
......@@ -4,12 +4,12 @@ if resource is not None:
base_category_list = resource.getVariationBaseCategoryList(omit_optional_variation=1)
for base_category in base_category_list:
if matrixbox == 1:
if matrixbox:
# XXX matrixbox is right_display (not as listfield) => invert display and value in item
cell_range.append( map(lambda x: (x[1],x[0]), context.getVariationCategoryItemList(base_category_list = (base_category,) ) ) )
cell_range.append([(x[1], x[0]) for x in context.getVariationCategoryItemList(base_category_list=(base_category,))])
else:
cell_range.append( context.getVariationCategoryList(base_category_list = (base_category,) ) )
cell_range = filter(lambda x: x != [], cell_range )
cell_range = [x for x in cell_range if x != []]
return cell_range
"""This script is called on the Invoice after the delivery builder has created
the new Invoice.
"""
from Products.ERP5Type.Message import translateString
if related_simulation_movement_path_list is None:
raise RuntimeError, 'related_simulation_movement_path_list is missing. Update ERP5 Product.'
......
......@@ -24,4 +24,4 @@ for movement in movement_list:
if line is not None:
deliveries_keys[line.getExplanationValue()] = 1
return filter(lambda x : x is not None, deliveries_keys.keys())
return [x for x in deliveries_keys.keys() if x is not None]
......@@ -17,14 +17,8 @@ def recursiveCopyLine(to_document, from_document):
recursiveCopyLine(reverse_line, line)
newCell = reverse_line.newContent
for cell in line.objectValues(portal_type='Invoice Cell'):
raise NotImplementedError
newCell(
# TODO: what properties ?
portal_type=cell.getPortalType(),
category_list=cell.getCategoryList(),
)
raise NotImplementedError("NotImplemented: Should do something with %s and %s" % (cell, newCell))
portal = context.getPortalObject()
reverse_invoice = context.getParentValue().newContent(
portal_type=context.getPortalType(),
created_by_builder=1, # tell init script to not create lines
......
......@@ -7,7 +7,7 @@ def getSourceReference(line):
for predicate in predicate_list:
source_reference = predicate.getSourceReference()
if source_reference:
return source_reference
return source_reference
return ''
def getDestinationReference(line):
......@@ -19,7 +19,7 @@ def getDestinationReference(line):
for predicate in predicate_list:
destination_reference = predicate.getDestinationReference()
if destination_reference:
return destination_reference
return destination_reference
return ''
#if context.getPortalType() in context.getPortalSaleTypeList():
......
......@@ -2,5 +2,7 @@
If the business template 'erp5_advanced_invoicing' is installed, returns True.
If it is not, returns False.
"""
business_template_list = context.portal_templates.getInstalledBusinessTemplateList()
return filter(lambda x: x.getTitle() == "erp5_advanced_invoicing", business_template_list, False)
for bt in context.portal_templates.getInstalledBusinessTemplateList():
if bt.getTitle() == "erp5_advanced_invoicing":
return True
return False
# This script uses format= argument
# pylint: disable=redefined-builtin
if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
erp5_advanced_invoicing
\ No newline at end of file
......@@ -167,6 +167,16 @@ ignored_skin_id_set = {
'FCKeditor_getDocumentListQuery',
'FCKeditor_getImageList',
'FCKeditor_getSetReferenceUrl',
'Credential_accept',
'Credential_checkConsistency',
'Credential_copyRegistredInformation',
'Credential_updatePersonPassword',
'InvoiceTransaction_postGeneration',
'InvoiceTransaction_postTransactionLineGeneration',
'InvoiceTransaction_selectDelivery',
'InvoiceTransaction_selectInvoiceMovement',
'PurchaseInvoice_selectTradeModelMovementList',
'SaleInvoice_selectTradeModelMovementList',
}
# Generic method to check consistency of a skin item
......
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