Commit 3583220f authored by Yoshinori Okuji's avatar Yoshinori Okuji

We do not use filesystem skins.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4516 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 490789a5
## Script (Python) "AccountModule_countAccountingTransactions"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=self
##title=
##
currency = None
if currency in (None, 'None'):
currency = context.currency.EUR
#inventory = context.Resource_zGetInventory(node_uid=context.getUid(), omit_simulation=1,
# resource_uid=(currency.getUid(),),
# simulation_state=('draft', 'planned', 'confirmed', 'stopped', 'delivered'))
inventory = context.Resource_zGetInventory(node_uid=self.uid, omit_simulation=1,
resource_uid=(currency.getUid(),),
simulation_state=('draft', 'planned', 'confirmed', 'stopped', 'delivered'))
inventory = inventory[0]
return str(inventory.stock_uid)
## 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_getTotalSourceCredit"
##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()
url = params.get('accounting_transaction_line_currency')
if url:
currency = context.restrictedTraverse(url)
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'))
kwd['section_category'] = params.get('transaction_section_category', 'group/nexedi')
total = 0.0
try:
inventory = context.Resource_zGetInventory(node_uid=context.getUid(), omit_output=1, omit_simulation=1,
**kwd)
total = inventory[0].inventory or 0.0
except:
pass
return '%.02f' % total
## Script (Python) "AccountModule_getTotalSourceDebit"
##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()
url = params.get('accounting_transaction_line_currency')
if url:
currency = context.restrictedTraverse(url)
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'))
kwd['section_category'] = params.get('transaction_section_category', 'group/nexedi')
total = 0.0
try:
inventory = context.Resource_zGetInventory(node_uid=context.getUid(), omit_input=1, omit_simulation=1,
**kwd) # XXX Choice of omit_input is very good.
total = - inventory[0].inventory or 0.0
except:
pass
return '%.02f' % total
## 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_stat"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kwd
##title=
##
return 'toto'
return repr(kwd)
## 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>Account List</title>
<row_length>4</row_length>
<name>AccountModule_viewAccountList</name>
<pt>form_list</pt>
<action>Base_doSelect</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>listbox</id> <type>ListBox</type>
<values>
<Base_viewSearchResultList type="int">1</Base_viewSearchResultList>
<all_columns type="list">[('id', 'id'), ('pcg_title', 'PCG'), ('Title', 'Title'), ('default_destination_title', 'Mirror'), ('AccountModule_getAccountingTransactionCount', 'Count'), ('AccountModule_getTotalSourceCredit', 'Credit'), ('AccountModule_getTotalSourceDebit', 'Debit'), ('accounting_transaction_line_currency', 'Currency')]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('id', 'id'), ('pcg_title', 'PCG'), ('Title', 'Title'), ('default_destination_title', 'Mirror'), ('AccountModule_getAccountingTransactionCount', 'Count'), ('AccountModule_getTotalSourceDebit', 'Debit'), ('AccountModule_getTotalSourceCredit', 'Credit')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[('id', "''"), ('pcg_title', "''"), ('Title', "''"), ('default_destination_title', "''")]</default_params>
<description></description>
<domain_root_list type="list">[('portal_categories/pcg', 'PCG'), ('portal_categories/account_type', 'Account Type'), ('portal_categories/financial_section', 'Balance Sheet')]</domain_root_list>
<domain_tree type="int">0</domain_tree>
<editable type="int">1</editable>
<editable_columns type="list">[]</editable_columns>
<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>list</list_action>
<list_method type="method">AccountModule_getAccountList</list_method>
<meta_types type="list">[]</meta_types>
<portal_types type="list">[('Account', 'Account')]</portal_types>
<report_root_list type="list">[('portal_categories/pcg', 'PCG'), ('portal_categories/account_type', 'Account Type')]</report_root_list>
<report_tree type="int">0</report_tree>
<search></search>
<search_columns type="list">[]</search_columns>
<select type="int">1</select>
<selection_name>account_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<sort_columns type="list">[]</sort_columns>
<stat_columns type="list">[('id', 'id'), ('Title', 'Title'), ('default_destination_title', 'default_destination_title'), ('AccountModule_getAccountingTransactionCount', 'AccountModule_statAccountingTransactionCount'), ('AccountModule_getTotalSourceDebit', 'AccountModule_statTotalSourceDebit'), ('AccountModule_getTotalSourceCredit', 'AccountModule_statTotalSourceCredit')]</stat_columns>
<stat_method type="method">portal_catalog</stat_method>
<title>Account Listbox</title>
<url_columns type="list">[('default_destination_title', 'AccountModule_getMirrorAccountUrl'), ('AccountModule_getAccountingTransactionCount', 'AccountModule_getTransactionListUrl'), ('AccountModule_getTotalSourceCredit', 'AccountModule_getCreditTransactionListUrl'), ('AccountModule_getTotalSourceDebit', 'AccountModule_getDebitTransactionListUrl'), ('accounting_transaction_line_currency', 'AccountModule_getCurrencyUrl')]</url_columns>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
<?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
<?xml version="1.0"?>
<form>
<title>Account</title>
<row_length>4</row_length>
<name>accounting_transaction_list</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>
<field><id>listbox</id> <type>ListBox</type>
<values>
<Base_viewSearchResultList type="int">1</Base_viewSearchResultList>
<all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('quantity', 'Quantity'), ('parent_title', 'Concerned Invoice'), ('type', 'Type'), ('date', 'Date')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
<description></description>
<domain_root_list type="list">[]</domain_root_list>
<domain_tree type="int">1</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>list</list_action>
<list_method type="method">Sql_zStockAccountParent</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')]</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">1</select>
<selection_name>account_selection</selection_name>
<sort type="list">[]</sort>
<sort_columns></sort_columns>
<stat_columns></stat_columns>
<stat_method></stat_method>
<title>Transactions concerned by this account</title>
<url_columns></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>
<group>
<title>bottom</title>
<fields>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
## Script (Python) "Account_getPcgItemList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
def display(x):
return "%s - %s" % (x.getId(), x.getTitle())
def sort(x,y):
return cmp(display(x), display(y))
obj = context.restrictedTraverse('portal_categories/pcg')
item_list = obj.getCategoryChildItemList(base=0, display_method=display, sort_method=sort)
return item_list
## Script (Python) "Account_search"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kwd
##title=
##
for cname in kwd.keys():
if kwd[cname] == '' or kwd[cname] is None:
del kwd[cname]
kwd['select_expression'] = "'EUR' AS accounting_transaction_line_currency"
return context.portal_catalog(**kwd)
This diff is collapsed.
<?xml version="1.0"?>
<form>
<title>Account</title>
<row_length>4</row_length>
<name>Account_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'), ('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">1</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_account=1</list_action>
<list_method type="method">Account_zGetTransactionList</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>account_history_selection</selection_name>
<sort type="list">[]</sort>
<sort_columns type="list">[]</sort_columns>
<stat_columns type="list">[('source_debit', 'Account_statSourceDebit'), ('source_credit', 'Account_statSourceCredit')]</stat_columns>
<stat_method></stat_method>
<title>Transactions related to this account</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
<?xml version="1.0"?>
<form>
<title>Accounting Transaction Line</title>
<row_length>4</row_length>
<name>accounting_transaction_list</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>
<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_destination_title</id> <type>RelationStringField</type>
<values>
<alternate_name></alternate_name>
<base_category>destination</base_category>
<catalog_index>Title</catalog_index>
<css_class></css_class>
<default></default>
<default_module>account</default_module>
<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>
<jump_method>Base_jumpToRelatedDocument</jump_method>
<max_length></max_length>
<portal_type type="list">[('Account', 'account')]</portal_type>
<relation_setter_id></relation_setter_id>
<required type="int">0</required>
<title>Destination</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<update_method>Base_updateRelation</update_method>
<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_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>account</default_module>
<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>
<jump_method>Base_jumpToRelatedDocument</jump_method>
<max_length></max_length>
<portal_type type="list">[('Account', 'account')]</portal_type>
<relation_setter_id></relation_setter_id>
<required type="int">0</required>
<title>Source</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<update_method>Base_updateRelation</update_method>
<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_source_credit</id> <type>FloatField</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>
<required type="int">0</required>
<title>Source Credit</title>
<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="not_float">You did not enter a floating point number.</message>
</messages>
</field>
<field><id>my_source_debit</id> <type>FloatField</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>
<required type="int">0</required>
<title>Source Debit</title>
<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="not_float">You did not enter a floating point number.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</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>Accounting Transactions</title>
<row_length>4</row_length>
<name>AccountingTransactionModule_viewAccountingTransactionList</name>
<pt>form_list</pt>
<action>Base_doSelect</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>listbox</id> <type>ListBox</type>
<values>
<Base_viewSearchResultList type="int">1</Base_viewSearchResultList>
<all_columns type="list">[('id', 'id'), ('Title', 'Title'), ('default_destination_section_title', 'Destination'), ('Type', 'Type'), ('getStopDate', 'Date'), ('reference', 'Invoice Number'), ('source_reference', 'Source Reference'), ('destination_reference', 'Destination Reference'), ('simulation_state', 'State'), ('AccountingTransactionModule_getSourceCredit', 'Credit'), ('AccountingTransactionModule_getSourceDebit', 'Debit')]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('id', 'id'), ('Title', 'Title'), ('default_destination_section_title', 'Destination'), ('Type', 'Type'), ('getStopDate', 'Date'), ('reference', 'Invoice Number'), ('source_reference', 'Source Reference'), ('destination_reference', 'Destination Reference'), ('simulation_state', 'State'), ('AccountingTransactionModule_getSourceDebit', 'Debit'), ('AccountingTransactionModule_getSourceCredit', 'Credit')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
<description></description>
<domain_root_list type="list">[]</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">30</lines>
<list_action>list</list_action>
<list_method type="method">AccountingTransactionModule_zGetAccountingTransactionList</list_method>
<meta_types type="list">[]</meta_types>
<not_viewable type="int">0</not_viewable>
<portal_types type="list">[('Accounting Transaction', 'Accounting Transaction'), ('Balance Transaction', 'Balance Transaction'), ('Purchase Invoice Transaction', 'Purchase Invoice Transaction'), ('Sale Invoice Transaction', 'Sale Invoice Transaction'), ('Pay Sheet Transaction', 'Pay Sheet Transaction'), ('Payment Transaction', 'Payment 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">1</select>
<selection_name>accounting_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<sort_columns type="list">[]</sort_columns>
<stat_columns type="list">[('AccountingTransactionModule_getSourceCredit', 'AccountingTransactionModule_statSourceCredit'), ('AccountingTransactionModule_getSourceDebit', 'AccountingTransactionModule_statSourceDebit')]</stat_columns>
<stat_method></stat_method>
<title>Accounting Transaction List</title>
<url_columns type="list">[('default_destination_section_title', 'AccountingTransactionModule_getDestinationSectionUrl')]</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>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</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
## Script (Python) "AccountingTransaction_searchInvoiceTransactionLines"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=**kw
##title=
##
sort_dict = { 'income': '\0\0',
'expense': '\0\0',
'receivable': '\0\1',
'payable': '\0\1',
'collected_vat': '\0\2',
'refundable_vat': '\0\3' }
def sortInvoiceTransactionLine(a, b):
a_id = a.getId()
if a_id in sort_dict:
a_id = sort_dict[a_id]
b_id = b.getId()
if b_id in sort_dict:
b_id = sort_dict[b_id]
return cmp(a_id, b_id)
object_list = []
for o in context.searchFolder(**kw):
obj = o.getObject()
object_list.append(obj)
object_list.sort(sortInvoiceTransactionLine)
return object_list
<?xml version="1.0"?>
<form>
<title></title>
<row_length>4</row_length>
<name>accounting_transaction_list</name>
<pt>form_list</pt>
<action></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>Default</title>
<fields>
<field><id>listbox</id> <type>ListBox</type>
<values>
<Base_viewSearchResultList type="int">1</Base_viewSearchResultList>
<all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('start_date', 'start_date'), ('stop_date', 'stop_date'), ('id', 'id'), ('Type', 'Type')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
<description></description>
<domain_root_list type="list">[('portal_categories/pcg', 'PCG'), ('portal_categories/financial_section', 'Financial Section'), ('portal_categories/account_type', 'Account type')]</domain_root_list>
<domain_tree type="int">1</domain_tree>
<editable type="int">1</editable>
<editable_columns type="list">[]</editable_columns>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<global_attributes type="list">[]</global_attributes>
<hidden type="int">0</hidden>
<lines type="int">30</lines>
<list_action>list</list_action>
<list_method type="method">Sql_zStockAccountDate</list_method>
<meta_types type="list">[]</meta_types>
<portal_types type="list">[('Accounting Transaction', 'Accounting Transaction'), ('Purchase Invoice Transaction', 'Purchase Invoice Transaction'), ('Sale Invoice Transaction', 'Sale Invoice Transaction')]</portal_types>
<report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree>
<search></search>
<search_columns></search_columns>
<select type="int">1</select>
<selection_name>transaction_line_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<sort_columns></sort_columns>
<stat_columns></stat_columns>
<stat_method type="method">Sql_zStockAccountDateStat</stat_method>
<title>Transaction Line List</title>
<url_columns></url_columns>
</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
<?xml version="1.0"?>
<form>
<title>Accounting Report</title>
<row_length>1</row_length>
<name>accounting_transaction_search</name>
<pt>form_dialog</pt>
<action>AccountingTransaction_viewAccountingTransactionLineList</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_start_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">0</date_only>
<date_separator>/</date_separator>
<default_now type="int">1</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">1</required>
<time_separator>:</time_separator>
<title>Start date</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_stop_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">0</date_only>
<date_separator>/</date_separator>
<default_now type="int">1</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">1</required>
<time_separator>:</time_separator>
<title>Stop date</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>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
<?xml version="1.0"?>
<form>
<title>Balance Transaction Line</title>
<row_length>4</row_length>
<name>BalanceTransactionLine_view</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>
<field><id>my_source</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>Account</title>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</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>
<field><id>my_source_payment</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>Bank Account</title>
<unicode type="int">0</unicode>
<whitespace_preserve type="int">0</whitespace_preserve>
</values>
<tales>
<items>python: here.AccountingTransactionLine_getSourcePaymentItemList()</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_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>
<editable type="int">1</editable>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<extra></extra>
<hidden type="int">0</hidden>
<jump_method>Base_jumpToRelatedDocument</jump_method>
<max_length></max_length>
<portal_type type="list">[('Organisation', 'Organisation'), ('Person', 'Person')]</portal_type>
<relation_setter_id></relation_setter_id>
<required type="int">0</required>
<title>Third Party</title>
<truncate type="int">0</truncate>
<unicode type="int">0</unicode>
<update_method>Base_updateRelation</update_method>
<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_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_source_credit</id> <type>FloatField</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>
<required type="int">0</required>
<title>Credit</title>
<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="not_float">You did not enter a floating point number.</message>
</messages>
</field>
<field><id>my_source_debit</id> <type>FloatField</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>
<required type="int">0</required>
<title>Debit</title>
<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="not_float">You did not enter a floating point number.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
<?xml version="1.0"?>
<form>
<title>Currency List</title>
<row_length>4</row_length>
<name>CurrencyModule_viewCurrencyList</name>
<pt>form_list</pt>
<action>Base_doSelect</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>listbox</id> <type>ListBox</type>
<values>
<Base_viewSearchResultList type="int">1</Base_viewSearchResultList>
<all_columns type="list">[]</all_columns>
<all_editable_columns type="list">[]</all_editable_columns>
<alternate_name></alternate_name>
<columns type="list">[('id', 'id'), ('title', 'Title')]</columns>
<css_class></css_class>
<default></default>
<default_params type="list">[]</default_params>
<description></description>
<domain_root_list type="list">[]</domain_root_list>
<domain_tree type="int">0</domain_tree>
<editable type="int">1</editable>
<editable_columns type="list">[]</editable_columns>
<enabled type="int">1</enabled>
<external_validator></external_validator>
<global_attributes type="list">[]</global_attributes>
<hidden type="int">0</hidden>
<lines type="int">10</lines>
<list_action>list</list_action>
<list_method type="method">portal_catalog</list_method>
<meta_types type="list">[]</meta_types>
<portal_types type="list">[('Currency', 'Currency')]</portal_types>
<report_root_list type="list">[]</report_root_list>
<report_tree type="int">0</report_tree>
<search></search>
<search_columns></search_columns>
<select type="int">1</select>
<selection_name>currency_selection</selection_name>
<sort type="list">[('id', 'id')]</sort>
<sort_columns></sort_columns>
<stat_columns></stat_columns>
<stat_method></stat_method>
<title>Currency Listbox</title>
<url_columns></url_columns>
</values>
<tales>
</tales>
<messages>
<message name="external_validator_failed">The input failed the external validator.</message>
</messages>
</field>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</fields>
</group>
</groups>
</form>
\ No newline at end of file
<?xml version="1.0"?>
<form>
<title>Currency</title>
<row_length>4</row_length>
<name>Currency_view</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>
<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>
</fields>
</group>
<group>
<title>right</title>
<fields>
</fields>
</group>
<group>
<title>center</title>
<fields>
</fields>
</group>
<group>
<title>bottom</title>
<fields>
</fields>
</group>
</groups>
</form>
\ 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
## Script (Python) "Folder_addPurchaseInvoice"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=folder, id
##title=
##
product = container.manage_addProduct[ 'ERP5' ]
product.addTransaction(id)
my_transaction = folder[id]
product = my_transaction.manage_addProduct[ 'ERP5' ]
context.portal_types.constructContent(type_name= 'Purchase Invoice Transaction Line',
container=my_transaction,
id='expense')
context.portal_types.constructContent(type_name= 'Purchase Invoice Transaction Line',
container=my_transaction,
id='payable')
context.portal_types.constructContent(type_name= 'Purchase Invoice Transaction Line',
container=my_transaction,
id='collected_vat')
context.portal_types.constructContent(type_name= 'Purchase Invoice Transaction Line',
container=my_transaction,
id='refundable_vat')
expense=my_transaction.expense
payable=my_transaction.payable
collected_vat=my_transaction.collected_vat
refundable_vat=my_transaction.refundable_vat
return my_transaction
## Script (Python) "Folder_addSaleInvoice"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=folder, id
##title=
##
product = container.manage_addProduct[ 'ERP5' ]
product.addTransaction(id)
my_transaction = folder[id]
product = my_transaction.manage_addProduct[ 'ERP5' ]
context.portal_types.constructContent(type_name= 'Sale Invoice Transaction Line',
container=my_transaction,
id='income')
context.portal_types.constructContent(type_name= 'Sale Invoice Transaction Line',
container=my_transaction,
id='receivable')
context.portal_types.constructContent(type_name= 'Sale Invoice Transaction Line',
container=my_transaction,
id='collected_vat')
income=my_transaction.income
receivable=my_transaction.receivable
collected_vat=my_transaction.collected_vat
return my_transaction
## Script (Python) "InvoiceTransactionLine_getDestinationItemList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
from Products.ERP5Type.Cache import CachingMethod
category_dict = {'income': 'portal_categories/account_type/expense',
'expense': 'portal_categories/account_type/income',
'payable': 'portal_categories/account_type/asset/receivable',
'receivable': 'portal_categories/account_type/liability/payable',
'collected_vat': 'portal_categories/account_type/asset/receivable/refundable_vat',
'refundable_vat': 'portal_categories/account_type/liability/payable/collected_vat',
'bank': 'portal_categories/account_type/asset/cash',
}
if context.id in category_dict:
category = category_dict[context.id]
else:
category = 'portal_categories/account_type'
display_dict = {}
def display(x):
if x not in display_dict:
pcg_id = x.getPcgId()
account_title = x.getTitle()
display_dict[x] = "%s - %s" % (pcg_id, account_title)
return display_dict[x]
def sort(x,y):
return cmp(display(x), display(y))
def getItemList(category=None):
obj = context.restrictedTraverse(category)
item_list = obj.getCategoryMemberItemList(portal_type='Account', base=0,
display_method=display, sort_method=sort)
return item_list
getItemList = CachingMethod(getItemList, id=('getInvoiceTransactionLineItemList', 'getItemList'))
return getItemList(category=category)
## Script (Python) "InvoiceTransactionLine_getSourceItemList"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
from Products.ERP5Type.Cache import CachingMethod
category_dict = {'income': 'portal_categories/account_type/income',
'expense': 'portal_categories/account_type/expense',
'payable': 'portal_categories/account_type/liability/payable',
'receivable': 'portal_categories/account_type/asset/receivable',
'collected_vat': 'portal_categories/account_type/liability/payable/collected_vat',
'refundable_vat': 'portal_categories/account_type/asset/receivable/refundable_vat',
'bank': 'portal_categories/account_type/asset/cash',
}
if context.id in category_dict:
category = category_dict[context.id]
else:
category = 'portal_categories/account_type'
display_dict = {}
def display(x):
if x not in display_dict:
pcg_id = x.getPcgId()
account_title = x.getTitle()
display_dict[x] = "%s - %s" % (pcg_id, account_title)
return display_dict[x]
def sort(x,y):
return cmp(display(x), display(y))
def getItemList(category=None):
obj = context.restrictedTraverse(category)
item_list = obj.getCategoryMemberItemList(portal_type='Account', base=0,
display_method=display, sort_method=sort)
return item_list
getItemList = CachingMethod(getItemList, id=('getInvoiceTransactionLineItemList', 'getItemList'))
return getItemList(category=category)
## Script (Python) "PaySheetTransaction_checkParameters"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=
##title=
##
paysheet = context.getObject()
paysheet_type = paysheet.getPortalType()
employee = paysheet.getDestinationSection()
employer = paysheet.getSourceSection()
if paysheet.getGrossSalary() == None:
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + '?portal_status_message=Gross+salary+is+required')
if employee in ('', None):
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + '?portal_status_message=The+employee+is+required')
if employer in ('', None):
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + '?portal_status_message=The+employer+is+required')
employee_obj = paysheet.getDestinationSectionValue()
employer_obj = paysheet.getSourceSectionValue()
if employee_obj.getCareerGrade() in ('', None):
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + '?portal_status_message=The+employee+must+have+a+career+grade')
if employer_obj.getCreationDate() in ('', None):
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + '?portal_status_message=The+employer+must+have+an+organisation+creation+date')
if employer_obj.getDefaultAddress().getZipCode() in ('', None):
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + '?portal_status_message=The+employer+must+have+a+zip+code')
# parameters are OK, go to the pre-calculation form
return context.REQUEST.RESPONSE.redirect(context.absolute_url() + "/PaySheetTransaction_viewPreview?selection_name=default&amp;dialog_category=object_action&amp;form_id=PaySheetTransaction_view")
<dtml-comment>
title:
connection_id:MySQL
max_rows:1000
max_cache:100
cache_time:0
class_name:
class_file:
</dtml-comment>
<params>year</params>
SELECT
YEAR(movement.target_stop_date) as target_stop_date,
movement.variation_text AS variation_text,
destination.title as destination_title,
- SUM(movement.total_price) as total_price
FROM
catalog
LEFT JOIN
movement ON (movement.uid = catalog.uid)
LEFT JOIN
catalog AS destination ON (movement.destination_uid = destination.uid)
WHERE
catalog.portal_type = "Pay Sheet Cell" <dtml-if year>and YEAR(movement.target_stop_date)=<dtml-sqlvar year type="int"> </dtml-if>
GROUP BY
movement.target_stop_date, movement.destination_uid, movement.variation_text
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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