Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
3736 Lượt xem

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


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ
Tác giả

thanks Axel, i see

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
7340
1
thg 3 15
3886
1
thg 4 17
3158
1
thg 1 16
3728
2
thg 9 15
7436