← Back to team overview

c2c-oerpscenario team mailing list archive

[Bug 596202] Re: hasattr() doesn't work with browse_record (5.0)

 

Regardless of the behavior of browse_record (which at first look in the code should not have hasattr() always returning True), this code is not correct as it break modularity. Installing stock without purchase is a valid case, and 'stock' should simply not have any reference to 'purchase' stuff *at all*.
This has been fixed in 6.0, and we should look into backporting it to stable (code related to purchase_line_id should move to purchase module)

Jay, do you think this qualifies for stable?

** Changed in: openobject-server
   Importance: Undecided => Low

** Changed in: openobject-server
       Status: New => Confirmed

** Changed in: openobject-server
    Milestone: None => 5.0.16

** Changed in: openobject-server
     Assignee: (unassigned) => Jay (OpenERP) (jvo-openerp)

** Summary changed:

- hasattr() doesn't work with browse_record (5.0)
+ [5.0] stock module contains references to purchase (but does not depend on it)

** Also affects: openobject-addons
   Importance: Undecided
       Status: New

-- 
[5.0] stock module contains references to purchase (but does not depend on it)
https://bugs.launchpad.net/bugs/596202
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to the OpenERP Project Group.

Status in OpenObject Addons Modules: Confirmed
Status in OpenObject Server: Won't Fix

Bug description:
Hi!
5.0 latest bzr.
Checking for a field with hasattr() doesn't work because browse_record intercepts that call and always returns True. If the field doesn't exist, it prints a 'Programming Error' message in the log but still returns True.

The stock module is affected by this problem. How to check: install only the stock module and use the partial picking wizard with average price products.
This code in stock/wizard/wizard_partial_picking.py gives a 'Programming Error':
            if hasattr(m, 'purchase_line_id') and m.purchase_line_id: