Commit 6e5c996b authored by Yoshinori Okuji's avatar Yoshinori Okuji

Initial import.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1734 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 70d3c3f9
## Script (Python) "AccountModule_getAccountList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kwd
##title=
##
try:
currency = kwd['accounting_transaction_line_currency']
id = currency.split('/')[-1]
except:
id = ''
if not id:
id = ' '
kwd['select_expression'] = "'%s' AS accounting_transaction_line_currency" % id
return context.portal_catalog(**kwd)
## Script (Python) "AccountModule_getAccountingTransactionCount"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain, selection, **kw
##title=
##
params = selection.getParams()
url = params.get('accounting_transaction_line_currency') # XXX This should be called resource
if url:
currency = context.restrictedTraverse(url) # XXX portal_categories.resolveCategory(resource)
else:
currency = None
kwd = {}
if params.get('from_date'):
kwd['from_date'] = params['from_date']
if params.get('to_date'):
kwd['to_date'] = params['to_date']
if currency is not None:
kwd['resource_uid'] = [currency.getUid()]
kwd['simulation_state'] = params.get('transaction_simulation_state', ('delivered', 'stopped')) # XXX Why not simulation_state ? choice of state should be in ERP5Globals or equiv.
kwd['section_category'] = params.get('transaction_section_category', 'group/nexedi') # XXX Why not section_category ? also, default value should be defined for now in ERP5Globals and later through ERP5Site method
inventory = context.Resource_zGetInventory(node_uid=context.getUid(), omit_simulation=1,
**kwd)
inventory = inventory[0]
return str(inventory.stock_uid)
# XXX should be return currency.getInventoryCount(from_date = params.get('from_date'), to_date=params.get('to_date'), )
# XXX should be actually return currency.getInventoryCount(**params )
## Script (Python) "AccountModule_getCreditTransactionListUrl"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None, **kwd
##title=
##
from ZTUtils import make_query
index = selection.getIndex()
name = selection.getName()
object = brain.getObject()
url = object.absolute_url()
method = 'Account_viewAccountingTransactionList'
kw = { 'selection_index': str(index),
'selection_name' : name,
'reset' : '1',
'omit_output' : '1',
}
params = selection.getParams()
try:
path = params.get('accounting_transaction_line_currency')
if path:
currency = context.restrictedTraverse(path)
else:
currency = None
except:
currency = None
if params.get('from_date'):
kw['from_date'] = params['from_date']
if params.get('to_date'):
kw['to_date'] = params['to_date']
if currency is not None:
kw['resource_uid'] = [currency.getUid()]
if params.get('transaction_simulation_state'):
kw['transaction_simulation_state'] = params['transaction_simulation_state']
if params.get('transaction_section_category'):
kw['transaction_section_category'] = params['transaction_section_category']
return url + '/' + method + '?' + make_query(kw)
## Script (Python) "AccountModule_getCurrencyUrl"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None
##title=
##
from ZTUtils import make_query
params = selection.getParams()
object = context.restrictedTraverse(params['accounting_transaction_line_currency'])
url = object.absolute_url()
method = 'view'
kw = {
'reset' : '1',
}
return url + '/' + method + '?' + make_query(kw)
## Script (Python) "AccountModule_getDebitTransactionListUrl"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None
##title=
##
from ZTUtils import make_query
index = selection.getIndex()
name = selection.getName()
object = brain.getObject()
url = object.absolute_url()
method = 'Account_viewAccountingTransactionList'
kw = { 'selection_index': str(index),
'selection_name' : name,
'reset' : '1',
'omit_input' : '1',
}
params = selection.getParams()
try:
path = params.get('accounting_transaction_line_currency')
if path:
currency = context.restrictedTraverse(path)
else:
currency = None
except:
currency = None
if params.get('from_date'):
kw['from_date'] = params['from_date']
if params.get('to_date'):
kw['to_date'] = params['to_date']
if currency is not None:
kw['resource_uid'] = [currency.getUid()]
if params.get('transaction_simulation_state'):
kw['transaction_simulation_state'] = params['transaction_simulation_state']
if params.get('transaction_section_category'):
kw['transaction_section_category'] = params['transaction_section_category']
return url + '/' + method + '?' + make_query(kw)
## Script (Python) "AccountModule_getMirrorAccountUrl"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None
##title=
##
index = selection.getIndex()
name = selection.getName()
object = brain.getObject()
object = object.getDestinationValue()
if object is None:
url = None
else:
url = object.absolute_url() + '/view?selection_index=%s&selection_name=%s&reset=1' % (index, name)
return url
## Script (Python) "AccountModule_getTransactionListUrl"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None, **kwd
##title=
##
from ZTUtils import make_query
index = selection.getIndex()
name = selection.getName()
object = brain.getObject()
url = object.absolute_url()
method = 'Account_viewAccountingTransactionList'
kw = { 'selection_index': str(index),
'selection_name' : name,
'reset' : '1',
}
params = selection.getParams()
try:
path = params.get('accounting_transaction_line_currency')
if path:
currency = context.restrictedTraverse(path)
else:
currency = None
except:
currency = None
if params.get('from_date'):
kw['from_date'] = params['from_date']
if params.get('to_date'):
kw['to_date'] = params['to_date']
if currency is not None:
kw['resource_uid'] = [currency.getUid()]
if params.get('transaction_simulation_state'):
kw['transaction_simulation_state'] = params['transaction_simulation_state']
if params.get('transaction_section_category'):
kw['transaction_section_category'] = params['transaction_section_category']
return url + '/' + method + '?' + make_query(kw)
## Script (Python) "AccountModule_statAccountingTransactionCount"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kw
##title=
##
try:
url = kw['accounting_transaction_line_currency']
if url:
currency = context.restrictedTraverse(url)
else:
currency = None
except:
currency = None
params = {}
if kw.get('query'):
params['query'] = kw['query']
if kw.get('from_date'):
params['from_date'] = kw['from_date']
if kw.get('to_date'):
params['to_date'] = kw['to_date']
if currency is not None:
params['resource_uid'] = [currency.getUid()]
params['simulation_state'] = kw.get('transaction_simulation_state', ('delivered', 'stopped'))
params['section_category'] = kw.get('transaction_section_category', 'group/nexedi')
result = context.Resource_zStatInventory(omit_simulation=1,
**params)
row = result[0]
return str(row.count or 0.0)
## Script (Python) "AccountModule_statTotalSourceCredit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kw
##title=
##
try:
url = kw['accounting_transaction_line_currency']
if url:
currency = context.restrictedTraverse(url)
else:
currency = None
except:
currency = None
params = {}
if kw.get('where_expression'):
params['where_expression'] = kw['where_expression']
if kw.get('from_date'):
params['from_date'] = kw['from_date']
if kw.get('to_date'):
params['to_date'] = kw['to_date']
if currency is not None:
params['resource_uid'] = [currency.getUid()]
params['simulation_state'] = kw.get('transaction_simulation_state', ('delivered', 'stopped'))
params['section_category'] = kw.get('transaction_section_category', 'group/nexedi')
result = context.Resource_zStatInventory(omit_simulation=1,
omit_output=1,
**params)
row = result[0]
return '%.02f' % (row.quantity or 0.0)
## Script (Python) "AccountModule_statTotalSourceDebit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kw
##title=
##
try:
url = kw['accounting_transaction_line_currency']
if url:
currency = context.restrictedTraverse(url)
else:
currency = None
except:
currency = None
params = {}
if kw.get('query'):
params['query'] = kw['query']
if kw.get('from_date'):
params['from_date'] = kw['from_date']
if kw.get('to_date'):
params['to_date'] = kw['to_date']
if currency is not None:
params['resource_uid'] = [currency.getUid()]
params['simulation_state'] = kw.get('transaction_simulation_state', ('delivered', 'stopped'))
params['section_category'] = kw.get('transaction_section_category', 'group/nexedi')
result = context.Resource_zStatInventory(omit_simulation=1,
omit_input=1,
**params)
row = result[0]
try:
quantity = - row.quantity
except:
quantity = 0.0
return '%.02f' % quantity
<?xml version="1.0"?>
<form>
<title>Search</title>
<row_length>4</row_length>
<name>AccountModule_viewSearchDialog</name>
<pt>form_dialog</pt>
<action>AccountModule_viewAccountList</action>
<update_action></update_action>
<method>POST</method>
<enctype></enctype>
<encoding>UTF-8</encoding>
<stored_encoding>UTF-8</stored_encoding>
<unicode_mode>false</unicode_mode>
<groups>
<group>
<title>left</title>
<fields>
<field><id>my_id</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>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<max_length></max_length>
<required type="int">1</required>
<title>Id</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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_title</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>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<max_length></max_length>
<required type="int">1</required>
<title>Title</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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_transaction_simulation_state</id> <type>MultiListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default type="list">['stopped', 'delivered']</default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<hidden type="int">0</hidden>
<items type="list">[('cancelled', 'cancelled'), ('confirmed', 'confirmed'), ('delivered', 'delivered'), ('draft', 'draft'), ('planned', 'planned'), ('stopped', 'stopped')]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>State</title>
<unicode type="int">0</unicode>
<view_separator>&lt;br /&gt;</view_separator>
</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="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>right</title>
<fields>
<field><id>my_from_date</id> <type>DateTimeField</type>
<values>
<allow_empty_time type="int">0</allow_empty_time>
<alternate_name></alternate_name>
<ampm_time_style type="int">0</ampm_time_style>
<css_class></css_class>
<date_only type="int">1</date_only>
<date_separator>/</date_separator>
<default_now type="int">0</default_now>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<hidden type="int">0</hidden>
<input_order>ymd</input_order>
<input_style>text</input_style>
<required type="int">0</required>
<time_separator>:</time_separator>
<title>From</title>
</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="not_datetime">You did not enter a valid date and time.</message>
<message name="datetime_out_of_range">The date and time you entered were out of range.</message>
</messages>
</field>
<field><id>my_to_date</id> <type>DateTimeField</type>
<values>
<allow_empty_time type="int">0</allow_empty_time>
<alternate_name></alternate_name>
<ampm_time_style type="int">0</ampm_time_style>
<css_class></css_class>
<date_only type="int">1</date_only>
<date_separator>/</date_separator>
<default_now type="int">0</default_now>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<hidden type="int">0</hidden>
<input_order>ymd</input_order>
<input_style>text</input_style>
<required type="int">0</required>
<time_separator>:</time_separator>
<title>To</title>
</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="not_datetime">You did not enter a valid date and time.</message>
<message name="datetime_out_of_range">The date and time you entered were out of range.</message>
</messages>
</field>
<field><id>my_accounting_transaction_line_currency</id> <type>ListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<first_item type="int">0</first_item>
<hidden type="int">0</hidden>
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">1</size>
<title>Currency</title>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</values>
<tales>
<items>python:[['', '']]+map(lambda x:(x.id,'currency/%s' %x.id),here.currency.objectValues())</items>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_transaction_section_category</id> <type>ListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<first_item type="int">0</first_item>
<hidden type="int">0</hidden>
<items type="list">[('Nexedi', 'group/nexedi')]</items>
<required type="int">0</required>
<size type="int">1</size>
<title>Section</title>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
## Script (Python) "AccountingTransactionModule_getAccountingTransactionList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**params
##title=
##
# XXX workarounds for DTML limitation
# Because DTML cannot do <dtml-if node or resource or...>
# If Python is used, it does not check the existence of a variable automatically
if 'node' not in params:
params['node'] = []
if 'resource' not in params:
params['resource'] = []
if 'from_date' not in params:
params['from_date'] = ''
if 'to_date' not in params:
params['to_date'] = ''
if 'section_category' not in params:
params['section_category'] = ''
return context.AccountingTransactionModule_zGetAccountingTransactionList(**params)
## Script (Python) "AccountingTransactionModule_getDestinationSectionUrl"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None, **kwd
##title=
##
from ZTUtils import make_query
index = selection.getIndex()
name = selection.getName()
object = brain.getObject()
url = object.getDestinationSectionValue().absolute_url()
method = 'Entity_viewAccountingTransactionList'
kw = {
'reset' : '1',
}
return url + '/' + method + '?' + make_query(kw)
## Script (Python) "AccountingTransactionModule_getSourceCredit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None, **kw
##title=
##
params = selection.getParams()
kw = {}
kw['section_category'] = params.get('section_category', 'group/nexedi')
kw['stat'] = 1
kw['omit_output'] = 1
kw['transaction'] = context.getUid()
result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, **kw)
row = result[0]
return '%.02f' % (row.quantity or 0.0)
## Script (Python) "AccountingTransactionModule_getSourceDebit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=brain=None, selection=None, **kw
##title=
##
params = selection.getParams()
kw = {}
kw['section_category'] = params.get('section_category', 'group/nexedi')
kw['stat'] = 1
kw['omit_input'] = 1
kw['transaction'] = context.getUid()
result = context.AccountingTransactionModule_zGetAccountingTransactionList(selection=selection, **kw)
row = result[0]
return '%.02f' % (row.quantity and - row.quantity or 0.0)
## Script (Python) "AccountingTransactionModule_statSourceCredit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kw
##title=
##
kw['selection_params'] = kw
kw['section_category'] = kw.get('section_category', 'group/nexedi')
kw['stat'] = 1
kw['omit_output'] = 1
result = context.AccountingTransactionModule_zGetAccountingTransactionList(**kw)
row = result[0]
return '%.02f' % (row.quantity or 0.0)
## Script (Python) "AccountingTransactionModule_statSourceDebit"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kw
##title=
##
kw['selection_params'] = kw
kw['section_category'] = kw.get('section_category', 'group/nexedi')
kw['stat'] = 1
kw['omit_input'] = 1
result = context.AccountingTransactionModule_zGetAccountingTransactionList(**kw)
row = result[0]
return '%.02f' % (row.quantity and - row.quantity or 0.0)
<?xml version="1.0"?>
<form>
<title>Search</title>
<row_length>4</row_length>
<name>AccountingTransactionModule_viewSearchDialog</name>
<pt>form_dialog</pt>
<action>AccountingTransactionModule_viewAccountingTransactionList</action>
<update_action></update_action>
<method>POST</method>
<enctype></enctype>
<encoding>UTF-8</encoding>
<stored_encoding>UTF-8</stored_encoding>
<unicode_mode>false</unicode_mode>
<groups>
<group>
<title>left</title>
<fields>
<field><id>my_id</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>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<max_length></max_length>
<required type="int">1</required>
<title>Id</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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_Title</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>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<max_length></max_length>
<required type="int">1</required>
<title>Title</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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_simulation_state</id> <type>MultiListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default type="list">[]</default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<hidden type="int">0</hidden>
<items type="list">[('cancelled', 'cancelled'), ('confirmed', 'confirmed'), ('delivered', 'delivered'), ('draft', 'draft'), ('planned', 'planned'), ('stopped', 'stopped')]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>State</title>
<unicode type="int">0</unicode>
<view_separator>&lt;br /&gt;</view_separator>
</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="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_node</id> <type>MultiListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default type="list">[]</default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<hidden type="int">0</hidden>
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">5</size>
<title>Account</title>
<unicode type="int">0</unicode>
<view_separator>&lt;br /&gt;</view_separator>
</values>
<tales>
<items>python: here.InvoiceTransactionLine_getSourceItemList()</items>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>right</title>
<fields>
<field><id>my_from_date</id> <type>DateTimeField</type>
<values>
<allow_empty_time type="int">0</allow_empty_time>
<alternate_name></alternate_name>
<ampm_time_style type="int">0</ampm_time_style>
<css_class></css_class>
<date_only type="int">1</date_only>
<date_separator>/</date_separator>
<default_now type="int">0</default_now>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<hidden type="int">0</hidden>
<input_order>ymd</input_order>
<input_style>text</input_style>
<required type="int">0</required>
<time_separator>:</time_separator>
<title>From</title>
</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="not_datetime">You did not enter a valid date and time.</message>
<message name="datetime_out_of_range">The date and time you entered were out of range.</message>
</messages>
</field>
<field><id>my_to_date</id> <type>DateTimeField</type>
<values>
<allow_empty_time type="int">0</allow_empty_time>
<alternate_name></alternate_name>
<ampm_time_style type="int">0</ampm_time_style>
<css_class></css_class>
<date_only type="int">1</date_only>
<date_separator>/</date_separator>
<default_now type="int">0</default_now>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<hidden type="int">0</hidden>
<input_order>ymd</input_order>
<input_style>text</input_style>
<required type="int">0</required>
<time_separator>:</time_separator>
<title>To</title>
</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="not_datetime">You did not enter a valid date and time.</message>
<message name="datetime_out_of_range">The date and time you entered were out of range.</message>
</messages>
</field>
<field><id>my_resource</id> <type>ListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<first_item type="int">0</first_item>
<hidden type="int">0</hidden>
<items type="list">[]</items>
<required type="int">0</required>
<size type="int">1</size>
<title>Currency</title>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</values>
<tales>
<items>python:[['', '']]+map(lambda x:(x.id,'currency/%s' %x.id),here.currency.objectValues())</items>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
<message name="required_not_found">Input is required but no input given.</message>
<message name="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
<field><id>my_section_category</id> <type>ListField</type>
<values>
<alternate_name></alternate_name>
<css_class></css_class>
<default></default>
<description></description>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<extra_item></extra_item>
<first_item type="int">0</first_item>
<hidden type="int">0</hidden>
<items type="list">[('Nexedi', 'group/nexedi')]</items>
<required type="int">0</required>
<size type="int">1</size>
<title>Section</title>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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="unknown_selection">You selected an item that was not in the list.</message>
</messages>
</field>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params>selection=""
selection_params=""
selection_domain
selection_report
select_expression
from_date=""
to_date=""
node=""
resource=""
entity=""
stat=""
omit_input
omit_output
transaction=""
section_category=""</params>
<dtml-let params="selection and selection.getParams() or selection_params">
<dtml-let allowed_roles_and_users="portal_catalog.getAllowedRolesAndUsers(**params)">
<dtml-comment>do something to have a query without RolesAndUsers security for global stats</dtml-comment>
<dtml-let query="(stat and not transaction) and portal_catalog.buildSQLQuery(**params) or portal_catalog.buildSQLQuery(allowedRolesAndUsers=allowed_roles_and_users, **params)">
<dtml-comment>do something to prevent having entity and section_category set at the same time</dtml-comment>
<dtml-let section_category="not entity and section_category or ''">
SELECT
<dtml-if stat>
SUM(stock.quantity) AS quantity
<dtml-else>
DISTINCT
<dtml-in "portal_catalog.getCatalogSearchResultKeys()"> <dtml-var sequence-item> <dtml-unless sequence-end>,</dtml-unless> </dtml-in>
<dtml-if select_expression>, <dtml-var select_expression> </dtml-if>
</dtml-if>
FROM
<dtml-var "','.join(query['from_table_list'])">
<dtml-if selection_domain>, <dtml-var "selection_domain.asSqlJoinExpression()"> </dtml-if>
<dtml-if selection_report>, <dtml-var "selection_report.asSqlJoinExpression()"> </dtml-if>
<dtml-if "from_date or to_date or node or resource or entity or stat or section_category">, catalog AS child </dtml-if>
<dtml-if "from_date or to_date or node or resource or stat">, movement </dtml-if>
<dtml-if "entity or stat or section_category">, stock </dtml-if>
<dtml-if node>, catalog AS source_account </dtml-if>
<dtml-if resource>, catalog AS currency </dtml-if>
<dtml-if entity>, catalog AS related_entity </dtml-if>
<dtml-if section_category>, category, catalog AS section_c </dtml-if>
WHERE
1 = 1
<dtml-in "query['from_table_list']"><dtml-if "_['sequence-item']=='roles_and_users'">AND catalog.security_uid = <dtml-var sequence-item>.uid <dtml-else> AND catalog.uid = <dtml-var sequence-item>.uid </dtml-if> </dtml-in>
<dtml-if "query['where_expression']">
AND <dtml-var "query['where_expression']">
</dtml-if>
<dtml-if selection_domain>
AND <dtml-var "selection_domain.asSqlExpression()">
</dtml-if>
<dtml-if selection_report>
AND <dtml-var "selection_report.asSqlExpression(strict_membership=1)">
</dtml-if>
<dtml-if "from_date or to_date or node or resource or entity or stat or section_category"> AND child.parent_uid = catalog.uid </dtml-if>
<dtml-if "from_date or to_date or node or resource or stat"> AND movement.uid = child.uid </dtml-if>
<dtml-if "entity or stat or section_category"> AND stock.uid = child.uid </dtml-if>
<dtml-if node> AND source_account.uid = movement.source_uid </dtml-if>
<dtml-if resource> AND currency.uid = movement.resource_uid </dtml-if>
<dtml-if entity> AND related_entity.uid = stock.section_uid </dtml-if>
<dtml-if section_category> AND category.uid = stock.section_uid AND section_c.uid = category.category_uid </dtml-if>
<dtml-if from_date> AND movement.stop_date >= <dtml-sqlvar from_date type="string"> </dtml-if>
<dtml-if to_date> AND movement.stop_date <= <dtml-sqlvar to_date type="string"> </dtml-if>
<dtml-if node> AND ( <dtml-in node> <dtml-unless sequence-start>OR</dtml-unless> source_account.relative_url = '<dtml-var sequence-item>' </dtml-in> ) </dtml-if>
<dtml-if resource> AND currency.relative_url = '<dtml-var resource>' </dtml-if>
<dtml-if entity> AND related_entity.relative_url = '<dtml-var entity>' </dtml-if>
<dtml-if stat> AND movement.is_accountable = 1 </dtml-if>
<dtml-if omit_input> AND stock.quantity < 0 </dtml-if>
<dtml-if omit_output> AND stock.quantity > 0 </dtml-if>
<dtml-if transaction> AND catalog.uid = '<dtml-var transaction>' </dtml-if>
<dtml-if section_category> AND section_c.relative_url = '<dtml-var section_category>' </dtml-if>
<dtml-if "query['order_by_expression']">
ORDER BY <dtml-var "query['order_by_expression']">
</dtml-if>
</dtml-let>
</dtml-let>
</dtml-let>
</dtml-let>
\ No newline at end of file
<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>query
node:list
simulation_state:list
from_date
to_date
resource:list
section_category
transaction
omit_input
omit_output</params>
SELECT
SUM(stock.quantity) AS quantity
FROM
catalog
, catalog AS child
, movement
, stock
<dtml-if resource>
, catalog AS resource
</dtml-if>
<dtml-if node>
, catalog AS node
</dtml-if>
<dtml-if section_category>
, catalog AS section_c
, catalog AS section_bc
, category AS section_membership
, catalog AS section
</dtml-if>
<dtml-if query>
, category
, roles_and_users
, subject
</dtml-if>
WHERE
catalog.uid = child.parent_uid
AND child.uid = stock.uid
AND child.uid = movement.uid
AND movement.is_accountable = 1
<dtml-if transaction>
AND catalog.uid = <dtml-sqlvar transaction type="int">
</dtml-if>
<dtml-if resource>
AND movement.resource_uid = resource.uid
AND (
<dtml-in resource>
resource.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
)
</dtml-if>
<dtml-if node>
AND stock.node_uid = node.uid
AND (
<dtml-in node>
node.relative_url = <dtml-sqlvar sequence-item type="string"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
)
</dtml-if>
<dtml-if from_date>
AND movement.stop_date >= <dtml-sqlvar from_date type="string">
</dtml-if>
<dtml-if to_date>
AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if>
<dtml-if 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 section_category>
AND section.uid = stock.section_uid
AND section_c.relative_url = <dtml-sqlvar section_category type="string">
AND section_membership.category_uid = section_c.uid
AND section_membership.base_category_uid = section_bc.uid
AND section_membership.uid = section.uid
</dtml-if>
<dtml-if omit_input>
AND stock.quantity < 0
</dtml-if>
<dtml-if omit_output>
AND stock.quantity > 0
</dtml-if>
<dtml-if query>
AND catalog.uid = category.uid
AND catalog.uid = roles_and_users.uid
AND catalog.uid = subject.uid
AND <dtml-var query>
</dtml-if>
<dtml-if sort_on>
ORDER BY <dtml-var sort_on>
</dtml-if>
\ No newline at end of file
<?xml version="1.0"?>
<form>
<title>Transactions</title>
<row_length>4</row_length>
<name>Entity_viewAccountingTransactionList</name>
<pt>form_view</pt>
<action>Base_edit</action>
<update_action></update_action>
<method>POST</method>
<enctype></enctype>
<encoding>UTF-8</encoding>
<stored_encoding>UTF-8</stored_encoding>
<unicode_mode>false</unicode_mode>
<groups>
<group>
<title>left</title>
<fields>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
<field><id>listbox</id> <type>ListBox</type>
<values>
<Base_viewSearchResultList type="int">0</Base_viewSearchResultList>
<all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('Title', 'Title'), ('default_source_section_title', 'Section'), ('getStopDate', 'Date'), ('Type', 'Type'), ('reference', 'Invoice Number'), ('simulation_state', 'State'), ('source_debit', 'Debit'), ('source_credit', 'Credit')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
<description></description>
<domain_root_list type="list">[('portal_categories/group', 'Group'), ('portal_categories/region', 'Region')]</domain_root_list>
<domain_tree type="int">0</domain_tree>
<editable type="int">1</editable>
<editable_columns type="list">[]</editable_columns>
<editable_expression></editable_expression>
<editable_permission type="list">[]</editable_permission>
<editable_role type="list">[]</editable_role>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<global_attributes type="list">[]</global_attributes>
<hidden type="int">0</hidden>
<lines type="int">25</lines>
<list_action>Base_jumpToAccountingTransaction?from_entity=1</list_action>
<list_method type="method">Entity_zGetAccountingTransactionList</list_method>
<meta_types type="list">[]</meta_types>
<not_viewable type="int">0</not_viewable>
<portal_types type="list">[('Accounting Transaction', 'Accounting Transaction'), ('Purchase Invoice Transaction', 'Purchase Invoice Transaction'), ('Sale Invoice Transaction', 'Sale Invoice Transaction'), ('Balance Transaction', 'Balance Transaction')]</portal_types>
<read_only type="int">0</read_only>
<report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree>
<search></search>
<search_columns type="list">[]</search_columns>
<select type="int">0</select>
<selection_name>entity_transaction_selection</selection_name>
<sort type="list">[]</sort>
<sort_columns type="list">[]</sort_columns>
<stat_columns type="list">[('source_debit', 'Entity_statSourceDebit'), ('source_credit', 'Entity_statSourceCredit')]</stat_columns>
<stat_method></stat_method>
<title>Transactions related to this entity</title>
<url_columns type="list">[]</url_columns>
<viewable_expression></viewable_expression>
<viewable_permission type="list">[]</viewable_permission>
<viewable_role type="list">[]</viewable_role>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
</messages>
</field>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:ZSQLBrain
class_file:zsqlbrain.py
</dtml-comment>
<params>getUid
query
omit_input
omit_output
resource_uid:list
from_date
to_date
transaction_simulation_state:list
transaction_section_category
node_uid:list
stat</params>
<dtml-if getUid>
SELECT
<dtml-if stat>
SUM(stock.quantity) AS quantity
<dtml-else>
DISTINCT catalog.*
, IFNULL(SUM(IF(stock.quantity > 0, stock.quantity, 0)), 0) AS source_credit
, IFNULL(SUM(IF(stock.quantity < 0, - stock.quantity, 0)), 0) AS source_debit
</dtml-if>
FROM
movement
, stock
, catalog AS child
, catalog
, catalog AS node
, category AS node_category
<dtml-if query>
, category
</dtml-if>
WHERE stock.mirror_section_uid = <dtml-var getUid>
AND child.uid = stock.uid
AND child.parent_uid = catalog.uid
AND movement.uid = stock.uid
AND movement.is_accountable = 1
AND node.uid = stock.node_uid
AND node.uid = node_category.uid
AND (node_category.category_uid = <dtml-sqlvar "portal_categories.account_type.asset.receivable.getUid()" type="int">
OR node_category.category_uid = <dtml-sqlvar "portal_categories.account_type.liability.payable.getUid()" type="int">
)
<dtml-if node_uid>
AND (
<dtml-in node_uid>
stock.node_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
)
</dtml-if>
<dtml-if resource_uid>
AND (
<dtml-in resource_uid>
movement.resource_uid = <dtml-sqlvar sequence-item type="int"><dtml-if sequence-end><dtml-else> OR </dtml-if>
</dtml-in>
)
</dtml-if>
<dtml-if from_date>
AND movement.stop_date >= <dtml-sqlvar from_date type="string">
</dtml-if>
<dtml-if to_date>
AND movement.stop_date < <dtml-sqlvar to_date type="string">
</dtml-if>
<dtml-if omit_input>
AND stock.quantity < 0
</dtml-if>
<dtml-if omit_output>
AND stock.quantity > 0
</dtml-if>
<dtml-if transaction_simulation_state>
AND (
<dtml-in transaction_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 = stock.section_uid
AND <dtml-var query>
</dtml-if>
<dtml-unless stat>
GROUP BY catalog.uid
</dtml-unless>
</dtml-if>
\ No newline at end of file
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