Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

what is the argument/value of "default" paremeter exactly?

By
henro
on 9/29/15, 10:56 PM 422 views

hi all, i see "default parameter " on def copy.

def copy(self, cr, uid, id, default=None, context=None):

if default is None:

default = {}

default = default.copy()


picking_obj = self.browse(cr, uid, id, context=context)

move_obj=self.pool.get('stock.move')

if ('name' not in default) or (picking_obj.name=='/'):

seq_obj_name = 'stock.picking.' + picking_obj.type

default['name'] = self.pool.get('ir.sequence').get(cr, uid, seq_obj_name)

default['origin'] = ''

default['backorder_id'] = False

if picking_obj.invoice_state == 'invoiced':

default['invoice_state'] = '2binvoiced'

res=super(stock_picking, self).copy(cr, uid, id, default, context)

if res:

picking_obj = self.browse(cr, uid, res, context=context)

for move in picking_obj.move_lines:

move_obj.write(cr, uid, [move.id], {'tracking_id': False,'prodlot_id':False, 'move_history_ids2': [(6, 0, [])], 'move_history_ids': [(6, 0, [])]})

return res

what is the argument of default parameter will be copy.

thanks for help


2

Axel Mendoza

--Axel Mendoza--
10238
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 9/30/15, 12:27 AM

The default parameter it must be a dict used by Odoo to override the record values for create the new record without the need of a write to change those values

thanks Axel, i see

henro
on 9/30/15, 2:26 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 9/29/15, 10:56 PM
Seen: 422 times
Last updated: 10/1/15, 2:36 PM