Odoo v12
On "create" method i just save records in self.order_line_copy, then in the method "_onchange_order_line"
i want to call wizard if self.order_line_copy not set, but i can't.
Can you explain what the problem might be?
@api.model
def create(self, vals):
ids = None
res = super(VerificationPurchaseOrder, self).create(vals)
if 'order_line' in vals.keys():
for value in vals['order_line']:
ids = value[2]
if ids:
records = self.env['purchase.order.line'].browse(ids)
if records:
self.order_line_copy = records
for record in records:
try:
if 'check_status' in vals.keys():
if int(record.check_status) < int(vals['check_status']):
record.check_status = vals['check_status']
except ValueError:
_logger.info('Create method error: Cannot implicitly convert type \'string\' to \'int\'')
return res
@api.onchange('order_line')
def _onchange_order_line(self):
if not self.order_line_copy:
form_view = self.env.ref('verification_purchase_order.user_error_wizard_form_view')
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'user.error.wizard',
'views': [
(form_view.id, 'form'),
],
'type': 'ir.actions.act_window',
'target': 'new',
'context': {
'default_error_message': "Message.",
},
}
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
Hi, Try with this.. I hope it might help you.
view = self.env.ref('verification_purchase_order.user_error_wizard_form_view')
wiz = self.env['user.error.wizard'].create({'purchase_order_id':order.id})
return {
'name': _('Error Wizard'),
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'user.error.wizard',
'views': [(view.id, 'form')],
'view_id': view.id,
'target': 'new',
'res_id': wiz.id,
'context': self.env.context,
}
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
0
thg 4 24
|
1977 | ||
|
0
thg 12 19
|
4673 | ||
|
5
thg 12 19
|
3766 | ||
|
0
thg 8 19
|
4 | ||
|
5
thg 8 19
|
2827 |