[6.0] SERVER : Can not add a osv.memory field from the Openerp interface

Bug #731487 reported by Sébastien BEAU - http://www.akretion.com
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Odoo Server (MOVED TO GITHUB)
Fix Committed
Undecided
OpenERP's Framework R&D

Bug Description

Hi I may found a bug (maybe it's an unimplemented feature on osv.memory)
Scenario
Open the menu Administration=>Customization=>Database Structure=> Objects
Open an object with the in memory model (In our case we will open the object delivery.sale.order)
Add a new field (name it x_my_field)
Check the view name name in the tab view (Delivery Costs)
Open this view menu 'Administration=>Users interface=>views
Add the field in the xml
<form string="Create Deliveries">
                   <separator colspan="4" string="Delivery Method super"/>
                   <field name="carrier_id" widget="selection"/>
+ <field name="x_my_field"/>
                    <newline/>
                    <separator colspan="4"/>

Now try to open the in memory object
in our case :
-create a new sale order
- click on add delivery cost

Openerp will raise an error
Can't find field 'x_my_field' in the following view parts composing the view of object model 'delivery.sale.order':
 * Delivery Costs

This bug occure only with osv.memory object and it's work perfectly for the osv.osv object

Best Regards

Related branches

summary: - [6.0] Server can not add a osv.memory field from the openerp interface
+ [6.0] SERVER : Can not add a osv.memory field from the Openerp interface
Revision history for this message
xrg (xrg) wrote : Re: [Bug 731487] Re: [6.0] SERVER : Can not add a osv.memory field from the Openerp interface

On Tuesday 08 March 2011, you wrote:
> ** Summary changed:
>
> - [6.0] Server can not add a osv.memory field from the openerp interface
> + [6.0] SERVER : Can not add a osv.memory field from the Openerp interface

I confirm the issue:
at orm.py:class orm_memory, there is no _auto_init() at all for them. Means,
the _columns of an osv_memory object are never changed through the database.

Moreover, creating a manual field (like 'x_foobar') and changing any of its
properties will result in an exception, since my "monster" patch would be
trying to treat it as a regular orm model.

Would flag this as a "low priority" issue, because I can't see how an
osv_memory object could be extended to do anything useful through the openerp
interface (without, that is, writting any python code at all).

Still, agree that it is a missing feature.

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Hi xrg.

I found this bug because I wanted to add dynamically field to my wizard depending of the field imported from Magento (an e-commerce platform).
Indeed in Magento the product form can be customized by the customer and so custom fields can be added to the object product. When the object are imported in OpenERP a python function will create this fields and after the function 'fields_view_get' will bluid a custom view dynamically.
It's already works pretty well for the osv.osv, you can see an example in the module magentoerpconnect https://launchpad.net/magentoerpconnect
You can look in the file magentoerpconnect/product.py
- line 296 in the function 'create', openerp field are created dynamically
- line 819 in the function 'fields_view_get', the view is overwritten dynamically

Hope my explication will help you to understand why I need this feature. And also maybe give some idea of that is posible to do with OpenERP.

Best Regards

Revision history for this message
xrg (xrg) wrote :

On Wednesday 09 March 2011, you wrote:
> Hi xrg.
>
> Hope my explication will help you to understand why I need this feature.
> And also maybe give some idea of that is posible to do with OpenERP.
>
Your explanation is reasonable. I see your point.

So, we would need to go ahead and implement the _auto_init() for orm_memory
class.

Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Thanks a lots xrg ;) OpenERP rocks

Revision history for this message
xrg (xrg) wrote : Re: [Bug 731487] [NEW] [6.0] Server can not add a osv.memory field from the openerp interface

On Tuesday 08 March 2011, you wrote:
> Public bug reported:
>
> Openerp will raise an error
> Can't find field 'x_my_field' in the following view parts composing the
> view of object model 'delivery.sale.order': * Delivery Costs
>
> This bug occure only with osv.memory object and it's work perfectly for
> the osv.osv object
>

I seem to have added the missing code and backported from pg84-next to a
branch[1] of 6.0 server.
lp:~openerp-dev/openobject-server/6.0-bug-731487-xrg

Please test it and report back your results. Is that what you needed?

The corresponding test is at:
http://git.hellug.gr/?p=xrg/openobject-addons;a=commit;h=f58ab31a8d2a3740e1ce

[1] and merge proposal, because I forgot to pass the --no-merge option ;)

Changed in openobject-server:
status: New → Fix Committed
Changed in openobject-server:
assignee: nobody → OpenERP's Framework R&D (openerp-dev-framework)
Revision history for this message
Sébastien BEAU - http://www.akretion.com (sebastien.beau) wrote :

Thanks a lot, I will check your branch and give my feed back

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.