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
- Kirjanpito
- Varastointi
- PoS
- Project
- MRP
Tämä kysymys on merkitty
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,
}
Nautitko keskustelusta? Älä vain lue, vaan osallistu!
Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!
Rekisteröidy| Aiheeseen liittyviä artikkeleita | Vastaukset | Näkymät | Toimenpide | |
|---|---|---|---|---|
|  | 0 huhtik. 24  | 2708 | ||
|  | 0 jouluk. 19  | 5255 | ||
|  | 5 jouluk. 19  | 4337 | ||
|  | 0 elok. 19  | 4 | ||
|  | 5 elok. 19  | 3388 | 
