تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
4490 أدوات العرض

Hi everyone, I'm calling a wizard with a context 

MODULE (Customer)

@api.multi
def action_open_wizard(self):
log.error(self.id) #<---- I see 123456
return {
'type': 'ir.actions.act_window',
'name': 'Change Customer Field',
'res_model': 'customer.change',
'view_type': 'form',
'view_mode': 'form',
'target': 'new',
'context': {
#.....
'default_customer_name': self.name,
'default_age':self.age,
'default_customer_id': self.id, #<---- current id
#......
}
}


in the context step the id of the element I'm modifying but when I press the button to save the id no longer exists​

WIZARD

...
customer_id = fields.Many2one('myaddon.customer')
....
@api.model
def doit(self):
log.error(self.customer_id) #<--- False
if self.customer_id:
target = self.env['myaddon.customer'].browse(self.customer_id)


How can I solve it? Thanks in advance

الصورة الرمزية
إهمال

To learn customization in modules: https://www.scoop.it/t/learn-openerp

الكاتب أفضل إجابة

Solve!! 

@api.model ----> @api.multi on wizard. 

الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
0
أكتوبر 23
1607
4
أكتوبر 18
8377
3
يونيو 18
6937
0
أغسطس 17
3296
0
مارس 15
4336