Discussion:
[Erp5-dev] Setting operation (or any other category) as resource on Invoice Line is a problem...?
Łukasz Nowak
2007-11-06 09:30:34 UTC
Permalink
Hello,

Invoice has resource set to price_currency (title: Polski Zloty).

If Product (title: product) is set as resource on Invoice Line then:

- invoice_line.getResourceValue -> Product
- invoice_line.getResource -> product_module/1
- invoice_line.getResourceTitle -> product

But when category operation (title: operation_title) is set on resource:

- invoice_line.getResourceValue -> operation
- invoice_line.getResource -> operation/operation
- invoice_line.getResourceTitlte -> Polski Zloty - which is wrong

Is it a bug/feature/configuration problem?

Attached unit test to prove above scenario, checked on clean revision
17405

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testBugResourceTitleOnSaleInvoiceLine.py
Type: text/x-python
Size: 8012 bytes
Desc: not available
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20071106/5246cc89/attachment.py>
Jérome Perrin
2007-11-06 18:18:17 UTC
Permalink
Post by Łukasz Nowak
Hello,
Invoice has resource set to price_currency (title: Polski Zloty).
- invoice_line.getResourceValue -> Product
- invoice_line.getResource -> product_module/1
- invoice_line.getResourceTitle -> product
- invoice_line.getResourceValue -> operation
- invoice_line.getResource -> operation/operation
- invoice_line.getResourceTitlte -> Polski Zloty - which is wrong
Is it a bug/feature/configuration problem?
hello,

resource_title is not a standard accessor. This is in property sheet
Amount.py :

{ 'id' : 'resource_title',
'description' : "The resource title involved",
'type' : 'string',
'acquisition_base_category' : ('resource',),
'acquisition_portal_type' : Expression('python:
portal.getPortalResourceTypeList()'),
'acquisition_copy_value' : 0,
'acquisition_mask_value' : 0,
'acquisition_sync_value' : 0,
'acquisition_accessor_id' : 'getTitle',
'acquisition_depends' : None,
'alt_accessor_id' : ('_categoryGetResourceTitle', ),
'mode' : 'w' },

This means that getResourceTitle accessor is somehow equivalent to
getResourceValue(portal_type=portal.getPortalResourceTypeList()).getTitle()

'operation' is a Category, which is not in resource portal type group.

The question is: do we still need this property definition ?
This property sheet is here since the first revision, I guess it was
added because at that time 'title' accessors were not generated for
categories.

J?rome
Łukasz Nowak
2007-11-07 15:43:06 UTC
Permalink
Hello,

On 2007-11-06, 19:18:17
J?rome Perrin <jerome at nexedi.com> wrote:

(...)
Post by Jérome Perrin
hello,
resource_title is not a standard accessor. This is in property sheet
(...)
Post by Jérome Perrin
This means that getResourceTitle accessor is somehow equivalent to
getResourceValue(portal_type=portal.getPortalResourceTypeList()).getTitle()
'operation' is a Category, which is not in resource portal type group.
The question is: do we still need this property definition ?
This property sheet is here since the first revision, I guess it was
added because at that time 'title' accessors were not generated for
categories.
You're right as always :)

But I've spotted some kind of strange problem. To test what you
provided above I've copied ERP5/PropertySheet/Amount.py into
INSTANCE_HOME/PropertySheet, commented out resource_title key and...it
hadn't worked. But while editing directly ERP5/PropertySheet/Amount.py
all worked well.

What could be a problem?
Revision: 17264

Regards,
Luke
--
?ukasz Nowak R&D Ventis http://www.ventis.com.pl/
tel: +48 32 768 16 85 fax: +48 32 392 10 61
``Use the Source, Luke...'' I am only craftsman.
Loading...