Impossibile duplicare stock.picking

Bug #1271907 reported by Davide Corio
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenERP Italia
Fix Released
Undecided
Unassigned

Bug Description

Provando a duplicare un DDT (stock.picking) dopo aver installato l10n_it_sale, si ottiene questo errore:

File "/Users/enlightx/Development/OpenERP/7.0/dev/parts/openobject-italia/l10n_it_sale/stock/picking.py", line 89, in copy
    default.update({'ddt_number': ''})
TypeError: super(type, obj): obj must be an instance or subtype of type

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Davide,

while fixing that, I suggest also using using

def copy(... default=None ... )
    if default is None:
        default = {}

the same way we do for the context (and for the same reasons).

Thanks!

Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :

sure! thanks for the suggestion

Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :

well, actually the signature of that method is:

(self, cr, uid, id, default={}, context=None)

then default couldn't be None

am i wrong?

Revision history for this message
Leonardo Pistone (lepistone) wrote :

Except very special cases, it's better to avoid all mutable default values. In our base, both context and default. See for example:

http://bazaar.launchpad.net/~openerp/openobject-addons/7.0/view/head:/mrp/product.py#L31

and

http://bazaar.launchpad.net/~openerp/openobject-server/7.0/view/head:/openerp/osv/orm.py#L5051

Revision history for this message
Davide Corio (enlightx-deactivatedaccount) wrote :

ok! gonna change that. thanks again

Changed in openobject-italia:
status: New → Fix Released
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.