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
- Contabilità
- Magazzino
- PoS
- Project
- MRP
La domanda è stata contrassegnata
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,
}
Ti stai godendo la conversazione? Non leggere soltanto, partecipa anche tu!
Crea un account oggi per scoprire funzionalità esclusive ed entrare a far parte della nostra fantastica community!
RegistratiPost correlati | Risposte | Visualizzazioni | Attività | |
---|---|---|---|---|
|
0
apr 24
|
1929 | ||
|
0
dic 19
|
4615 | ||
|
5
dic 19
|
3726 | ||
|
0
ago 19
|
4 | ||
|
5
ago 19
|
2797 |