wizard_reset_order
parent
2d597c454a
commit
26b8c9c3f8
|
|
@ -2,7 +2,7 @@
|
|||
# License OPL-1 or later (https://www.odoo.com/documentation/user/11.0/legal/licenses/licenses.html#licenses).
|
||||
|
||||
from odoo import tools, api, fields, models, _
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
from odoo.exceptions import ValidationError, UserError, Warning
|
||||
|
||||
import json
|
||||
import requests
|
||||
|
|
@ -11,7 +11,16 @@ class WizardResetOrder(models.TransientModel):
|
|||
_name = 'wizard.reset_order'
|
||||
_description = 'Reset imos-Order'
|
||||
|
||||
name = fields.Char()
|
||||
# name = fields.Char()
|
||||
#
|
||||
# @api.onchange('name')
|
||||
# def _onchange_name(self):
|
||||
# return {
|
||||
# 'warning': {
|
||||
# 'title': _('Warning!'),
|
||||
# 'message': _("Achtung, es gab Fehler"),
|
||||
# }
|
||||
# }
|
||||
|
||||
@api.multi
|
||||
def button_reset_order(self):
|
||||
|
|
@ -30,17 +39,20 @@ class WizardResetOrder(models.TransientModel):
|
|||
if error_at_quotation:
|
||||
raise ValidationError(_(info))
|
||||
|
||||
info = 'Mindestens eines der Angebote konnte nicht zurückgesetzt werden:'
|
||||
info = 'Mindestens ein Warenkorb konnte nicht zurückgesetzt werden:'
|
||||
for so in sale_orders:
|
||||
order_info = self.reset_order_status(so.origin)
|
||||
if order_info != '':
|
||||
error_at_quotation = True
|
||||
info += "\n"+order_info
|
||||
info += "\n%s" % order_info
|
||||
so.message_post(body='Warenkorb konnte im DesignBox-Portal nicht zurückgesetzt werden!\n %s' % order_info)
|
||||
else:
|
||||
info += "\n%s --> OK" % so.name
|
||||
so.message_post(body='Warenkorb im DesignBox-Portal zurückgesetzt!\n%s --> OK' % so.name)
|
||||
|
||||
if error_at_quotation:
|
||||
raise UserError(_(info))
|
||||
raise Warning(_(info))
|
||||
# self.name = _(info)
|
||||
|
||||
action = self.env.ref('sale.action_orders').read()[0]
|
||||
action['domain'] = [('id', 'in', active_ids)]
|
||||
|
|
@ -70,9 +82,9 @@ class WizardResetOrder(models.TransientModel):
|
|||
|
||||
if response.status_code == 200:
|
||||
if lRes.get('status') != 0:
|
||||
info = "Angebot: %s, Fehler='%s'" % (order_id,lRes)
|
||||
info = "Warenkorb: %s, Fehler='%s'" % (order_id,lRes)
|
||||
else:
|
||||
if lRes.get('status') != 0:
|
||||
info = "Angebot: %s, Fehler='%s'" % (order_id,lRes.get('data'))
|
||||
info = "Warenkorb: %s, Fehler='%s'" % (order_id,lRes.get('data'))
|
||||
|
||||
return info
|
||||
|
|
|
|||
|
|
@ -12,6 +12,12 @@
|
|||
<group>
|
||||
<p>Wollen Sie die imos-Bestellung für die markierten Aufträge zurücksetzen?</p>
|
||||
</group>
|
||||
|
||||
<!--
|
||||
<group>
|
||||
<field name="name"/>
|
||||
</group>
|
||||
-->
|
||||
<footer>
|
||||
<button name="button_reset_order"
|
||||
string="imos-Bestellung zurücksetzen"
|
||||
|
|
|
|||
Loading…
Reference in New Issue