Discussion:
[Erp5-dev] translating accounting transaction lines
Bartłomiej Górny
2006-01-21 20:09:48 UTC
Permalink
Hi

For Polish accounting, I needed to translate labels of transaction lines
(like 'income', 'collected_vat' etc.). At the moment they do not
translate, since they are only raw ids of the line objects.

The solution I came up with was to change SaleInvoiceTransaction_init so
that it does:

transaction.newContent(portal_type='Sale Invoice Transaction Line',
id='income',
title='income',
quantity=0,
immediate_reindex=1)

and to change listbox cols in transaction view so that it displays
translated_title instead of id.

Is it ok? If so, do you want patches to transactions init scripts and views?

Bartek
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Yoshinori Okuji
2006-01-21 20:16:35 UTC
Permalink
Post by Bartłomiej Górny
Hi
For Polish accounting, I needed to translate labels of transaction lines
(like 'income', 'collected_vat' etc.). At the moment they do not
translate, since they are only raw ids of the line objects.
The solution I came up with was to change SaleInvoiceTransaction_init so
transaction.newContent(portal_type='Sale Invoice Transaction Line',
id='income',
title='income',
quantity=0,
immediate_reindex=1)
and to change listbox cols in transaction view so that it displays
translated_title instead of id.
For the title, please use Income instead of income. Please consult the naming
conventions for more information.
Post by Bartłomiej Górny
Is it ok? If so, do you want patches to transactions init scripts and views?
This is not required for your purpose, but personally I think it would be
better to specify income to reference rather than id. But this would require
modifying some scripts.

YO
--
Yoshinori Okuji, Nexedi Research Director
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Free / Open Source ERP Software for small and medium companies
http://www.erp5.org
Storever: OpenBrick, WiFi infrastructure, notebooks and servers
http://www.storever.com
Bartłomiej Górny
2006-01-21 21:03:51 UTC
Permalink
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Hi
For Polish accounting, I needed to translate labels of transaction lines
(like 'income', 'collected_vat' etc.). At the moment they do not
translate, since they are only raw ids of the line objects.
The solution I came up with was to change SaleInvoiceTransaction_init so
transaction.newContent(portal_type='Sale Invoice Transaction Line',
id='income',
title='income',
quantity=0,
immediate_reindex=1)
and to change listbox cols in transaction view so that it displays
translated_title instead of id.
For the title, please use Income instead of income. Please consult the naming
conventions for more information.
Post by Bartłomiej Górny
Is it ok? If so, do you want patches to transactions init scripts and views?
This is not required for your purpose, but personally I think it would be
better to specify income to reference rather than id. But this would require
modifying some scripts.
I'm afraid I don't understand... Could you elaborate?

BG
Post by Yoshinori Okuji
YO
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Yoshinori Okuji
2006-01-21 21:23:16 UTC
Permalink
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it would be
better to specify income to reference rather than id. But this would
require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me. Usually,
we use the property "reference" or a category to refer to a certain object,
so I prefer to change the implementation.

YO
--
Yoshinori Okuji, Nexedi Research Director
Nexedi: Consulting and Development of Free / Open Source Software
http://www.nexedi.com
ERP5: Free / Open Source ERP Software for small and medium companies
http://www.erp5.org
Storever: OpenBrick, WiFi infrastructure, notebooks and servers
http://www.storever.com
Bartłomiej Górny
2006-01-22 20:18:54 UTC
Permalink
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it would be
better to specify income to reference rather than id. But this would
require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me. Usually,
we use the property "reference" or a category to refer to a certain object,
so I prefer to change the implementation.
Organisation and Person modules do the same - they have predefined,
automatically added lines ('default_address', 'default_telephone' etc.)
and they show their id's in the listbox.

This is a big problem when it comes to i18n, because when the lines are
automatically added, I need to (a) be able to translate what is shown in
the listbox, and (b) distribute translation via bt5. So, for example, my
'hack' doesn't solve thw problem, because getTranslatedTitle uses the
'content' message catalog, which doesn't go to bt5.

Bartek
Post by Yoshinori Okuji
YO
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Jean-Paul Smets
2006-01-23 09:48:39 UTC
Permalink
Post by Bartłomiej Górny
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it
would be better to specify income to reference rather than id. But
this would require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me.
Usually, we use the property "reference" or a category to refer to a
certain object, so I prefer to change the implementation.
Organisation and Person modules do the same - they have predefined,
automatically added lines ('default_address', 'default_telephone' etc.)
and they show their id's in the listbox.
This is a big problem when it comes to i18n, because when the lines are
automatically added, I need to (a) be able to translate what is shown in
the listbox, and (b) distribute translation via bt5. So, for example, my
'hack' doesn't solve thw problem, because getTranslatedTitle uses the
'content' message catalog, which doesn't go to bt5.
The id is not supposed to be displayed and is not supposed to be used for
user interface but only for programming (lust like properties such as price
or quantity in objects which are not translated of course). So, I do not
think the problem you mention exists in reality (beyond the fact that IDs
are still displayed in some places in ERP5 and should stop being
displayed).

The right approach is to use properties such as title for user interface and
not to display ids. The case of title is a bit complex (this is a known
issue) because titles sometimes belong to content (ex. person title) and
sometimes to user interface (ex. module title). Until a perfect solution is
found, I suggest the following approach.

- define a title on transaction lines
- display the translated title rather than the id in listbox
- force the use of ui message catalog to translate title in listbox for
accounting transactions

JPS.
Post by Bartłomiej Górny
Bartek
Post by Yoshinori Okuji
YO
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
Bartłomiej Górny
2006-01-23 10:36:55 UTC
Permalink
Post by Jean-Paul Smets
Post by Bartłomiej Górny
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it
would be better to specify income to reference rather than id. But
this would require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me.
Usually, we use the property "reference" or a category to refer to a
certain object, so I prefer to change the implementation.
Organisation and Person modules do the same - they have predefined,
automatically added lines ('default_address', 'default_telephone' etc.)
and they show their id's in the listbox.
This is a big problem when it comes to i18n, because when the lines are
automatically added, I need to (a) be able to translate what is shown in
the listbox, and (b) distribute translation via bt5. So, for example, my
'hack' doesn't solve thw problem, because getTranslatedTitle uses the
'content' message catalog, which doesn't go to bt5.
The id is not supposed to be displayed and is not supposed to be used for
user interface but only for programming (lust like properties such as price
or quantity in objects which are not translated of course). So, I do not
think the problem you mention exists in reality (beyond the fact that IDs
are still displayed in some places in ERP5 and should stop being
displayed).
The right approach is to use properties such as title for user interface and
not to display ids. The case of title is a bit complex (this is a known
issue) because titles sometimes belong to content (ex. person title) and
sometimes to user interface (ex. module title). Until a perfect solution is
found, I suggest the following approach.
- define a title on transaction lines
- display the translated title rather than the id in listbox
- force the use of ui message catalog to translate title in listbox for
accounting transactions
Could you advise how force the use of ui catalog? I thought about such a
solution - I put translated_title into the listbox, but couldn't figure
out how to change the way it is translated.

BG
Post by Jean-Paul Smets
JPS.
Post by Bartłomiej Górny
Bartek
Post by Yoshinori Okuji
YO
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Jean-Paul Smets
2006-01-23 12:06:25 UTC
Permalink
Post by Bartłomiej Górny
Post by Jean-Paul Smets
Post by Bartłomiej Górny
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it
would be better to specify income to reference rather than id. But
this would require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me.
Usually, we use the property "reference" or a category to refer to a
certain object, so I prefer to change the implementation.
Organisation and Person modules do the same - they have predefined,
automatically added lines ('default_address', 'default_telephone'
etc.) and they show their id's in the listbox.
This is a big problem when it comes to i18n, because when the lines
are automatically added, I need to (a) be able to translate what is
shown in the listbox, and (b) distribute translation via bt5. So, for
example, my 'hack' doesn't solve thw problem, because
getTranslatedTitle uses the 'content' message catalog, which doesn't
go to bt5.
The id is not supposed to be displayed and is not supposed to be used
for user interface but only for programming (lust like properties such
as price or quantity in objects which are not translated of course).
So, I do not think the problem you mention exists in reality (beyond
the fact that IDs are still displayed in some places in ERP5 and should
stop being displayed).
The right approach is to use properties such as title for user
interface and not to display ids. The case of title is a bit complex
(this is a known issue) because titles sometimes belong to content (ex.
person title) and sometimes to user interface (ex. module title). Until
a perfect solution is found, I suggest the following approach.
- define a title on transaction lines
- display the translated title rather than the id in listbox
- force the use of ui message catalog to translate title in listbox
for accounting transactions
Could you advise how force the use of ui catalog? I thought about such a
solution - I put translated_title into the listbox, but couldn't figure
out how to change the way it is translated.
An quick way is to use a script (Base_getUiTranslatedTitle) but I would
prefer to discuss first with Yoshinori about this general issue.

JPS.
Post by Bartłomiej Górny
BG
Post by Jean-Paul Smets
JPS.
Post by Bartłomiej Górny
Bartek
Post by Yoshinori Okuji
YO
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
Bartłomiej Górny
2006-01-23 14:38:18 UTC
Permalink
Post by Jean-Paul Smets
Post by Bartłomiej Górny
Post by Jean-Paul Smets
Post by Bartłomiej Górny
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it
would be better to specify income to reference rather than id. But
this would require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me.
Usually, we use the property "reference" or a category to refer to a
certain object, so I prefer to change the implementation.
Organisation and Person modules do the same - they have predefined,
automatically added lines ('default_address', 'default_telephone'
etc.) and they show their id's in the listbox.
This is a big problem when it comes to i18n, because when the lines
are automatically added, I need to (a) be able to translate what is
shown in the listbox, and (b) distribute translation via bt5. So, for
example, my 'hack' doesn't solve thw problem, because
getTranslatedTitle uses the 'content' message catalog, which doesn't
go to bt5.
The id is not supposed to be displayed and is not supposed to be used
for user interface but only for programming (lust like properties such
as price or quantity in objects which are not translated of course).
So, I do not think the problem you mention exists in reality (beyond
the fact that IDs are still displayed in some places in ERP5 and should
stop being displayed).
The right approach is to use properties such as title for user
interface and not to display ids. The case of title is a bit complex
(this is a known issue) because titles sometimes belong to content (ex.
person title) and sometimes to user interface (ex. module title). Until
a perfect solution is found, I suggest the following approach.
- define a title on transaction lines
- display the translated title rather than the id in listbox
- force the use of ui message catalog to translate title in listbox
for accounting transactions
Could you advise how force the use of ui catalog? I thought about such a
solution - I put translated_title into the listbox, but couldn't figure
out how to change the way it is translated.
An quick way is to use a script (Base_getUiTranslatedTitle) but I would
Of course, the question is how to put it into listbox column? From what
I figured out so far, listbox columns accept only methods and properties
that have getters - how can I put script results into a listbox col?

B.
Post by Jean-Paul Smets
prefer to discuss first with Yoshinori about this general issue.
JPS.
Post by Bartłomiej Górny
BG
Post by Jean-Paul Smets
JPS.
Post by Bartłomiej Górny
Bartek
Post by Yoshinori Okuji
YO
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Bartłomiej Górny
2006-01-23 18:04:37 UTC
Permalink
Post by Bartłomiej Górny
Post by Jean-Paul Smets
Post by Bartłomiej Górny
Post by Jean-Paul Smets
Post by Bartłomiej Górny
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it
would be better to specify income to reference rather than id. But
this would require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me.
Usually, we use the property "reference" or a category to refer to a
certain object, so I prefer to change the implementation.
Organisation and Person modules do the same - they have predefined,
automatically added lines ('default_address', 'default_telephone'
etc.) and they show their id's in the listbox.
This is a big problem when it comes to i18n, because when the lines
are automatically added, I need to (a) be able to translate what is
shown in the listbox, and (b) distribute translation via bt5. So, for
example, my 'hack' doesn't solve thw problem, because
getTranslatedTitle uses the 'content' message catalog, which doesn't
go to bt5.
The id is not supposed to be displayed and is not supposed to be used
for user interface but only for programming (lust like properties such
as price or quantity in objects which are not translated of course).
So, I do not think the problem you mention exists in reality (beyond
the fact that IDs are still displayed in some places in ERP5 and should
stop being displayed).
The right approach is to use properties such as title for user
interface and not to display ids. The case of title is a bit complex
(this is a known issue) because titles sometimes belong to content (ex.
person title) and sometimes to user interface (ex. module title). Until
a perfect solution is found, I suggest the following approach.
- define a title on transaction lines
- display the translated title rather than the id in listbox
- force the use of ui message catalog to translate title in listbox
for accounting transactions
Could you advise how force the use of ui catalog? I thought about such a
solution - I put translated_title into the listbox, but couldn't figure
out how to change the way it is translated.
An quick way is to use a script (Base_getUiTranslatedTitle) but I would
Of course, the question is how to put it into listbox column? From what
I figured out so far, listbox columns accept only methods and properties
that have getters - how can I put script results into a listbox col?
Eee... ok, forget my previous email :)

B.
Post by Bartłomiej Górny
B.
Post by Jean-Paul Smets
prefer to discuss first with Yoshinori about this general issue.
JPS.
Post by Bartłomiej Górny
BG
Post by Jean-Paul Smets
JPS.
Post by Bartłomiej Górny
Bartek
Post by Yoshinori Okuji
YO
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
Jean-Paul Smets
2006-01-23 09:30:32 UTC
Permalink
Post by Yoshinori Okuji
Post by Bartłomiej Górny
Post by Yoshinori Okuji
This is not required for your purpose, but personally I think it
would be better to specify income to reference rather than id. But
this would require modifying some scripts.
I'm afraid I don't understand... Could you elaborate?
Only the accounting transaction lines use "id" to specify the
purpose/indications of the objects. This looks inconsistent to me.
Usually, we use the property "reference" or a category to refer to a
certain object, so I prefer to change the implementation.
I do not agree. IDs are used in other places to specify the purpose of an
object (ex. default_career, default_address), etc. In a sense, IDs are also
used to name properties of an object (this is a troll).

I think it is useful to access an object by id, including for accounting.
(However, I think ids should be hidden and must be not be translated).

If you think about redesigning this, please consider other cases (default
phone, default picture of a person, default task line in a task, default
documentation file for a product) and the impact on performance of using
references in those cases (10 object lookups in avge instead of 1).

JPS.
--
Jean-Paul Smets-Solanes, Nexedi CEO - Tel. +33(0)6 62 05 76 14
Nexedi: Consulting and Development of Libre / Open Source Software
http://www.nexedi.com
ERP5: Libre/ Open Source ERP Software for small and medium companies
http://www.erp5.org
Rentalinux: Desktop Linux Server
http://www.rentalinux.com
Loading...