← Back to team overview

openerp-india team mailing list archive

Re: [Bug 1098557] Re: Can't set a default origin for stock pickings at duplication time

 

Dear Amit Bhavsar,
I don't understand your remark: a default value can be set by calling 
copy() with a dictionnary in the parameter "default", as stated in 
http://doc.openerp.com/v6.0/developer/2_5_Objects_Fields_Methods/methods.html#id1
Example :
             defaults={'origin': 'test', 'type': 'internal'}
             id = self.pool.get('stock.picking').copy(cr, uid, 1, 
defaults, context={})

I've pushed a trivial fix which lets custom addons use it instead of 
overriding the value of related key in content of the dictionnary.
Please re-open this bug and/or mark it "Fix committed".
Lionel


** Description changed:

- In v6.0 and up to the current trunk, the method copy() of stock.picking resets the field "origin" as soon as no default name is set.
- It would be useful for custom addons to be able to copy a picking while setting the origin field.
+ In the Python code of custom addons, it would sometimes be useful to be able to copy a picking while setting the origin field.
+ For example: 
+             defaults={'origin': 'test', 'type': 'internal'}
+             id = self.pool.get('stock.picking').copy(cr, uid, 1, defaults, context={})
+ However, in v6.0 and up to the current trunk, the method copy() of stock.picking resets the field "origin" as soon as no default name is set.
  I suggest the origin be reset only if it's not passed in the dict of default values.
  Lionel Sausin

** Changed in: openobject-addons
       Status: Invalid => New

-- 
You received this bug notification because you are a member of OpenERP
Indian Team, which is subscribed to OpenERP Addons.
https://bugs.launchpad.net/bugs/1098557

Title:
  Can't set a default origin for stock pickings at duplication time

Status in OpenERP Addons (modules):
  New

Bug description:
  In the Python code of custom addons, it would sometimes be useful to be able to copy a picking while setting the origin field.
  For example: 
              defaults={'origin': 'test', 'type': 'internal'}
              id = self.pool.get('stock.picking').copy(cr, uid, 1, defaults, context={})
  However, in v6.0 and up to the current trunk, the method copy() of stock.picking resets the field "origin" as soon as no default name is set.
  I suggest the origin be reset only if it's not passed in the dict of default values.
  Lionel Sausin

To manage notifications about this bug go to:
https://bugs.launchpad.net/openobject-addons/+bug/1098557/+subscriptions


References