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
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
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,
}
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
0
apr. 24
|
1908 | ||
|
0
dec. 19
|
4611 | ||
|
5
dec. 19
|
3702 | ||
|
0
aug. 19
|
4 | ||
|
5
aug. 19
|
2771 |