From 26b8c9c3f8f0a74055ad6114f634ce2f63ad6829 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 27 Jun 2018 16:44:36 +0200 Subject: [PATCH] wizard_reset_order --- .../dp_custom/wizards/wizard_reset_order.py | 26 ++++++++++++++----- .../dp_custom/wizards/wizard_reset_order.xml | 6 +++++ 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py index 0eaecf27..d0a51ccd 100644 --- a/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py @@ -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 diff --git a/ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml index d1b4537e..cbe639d3 100644 --- a/ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml @@ -12,6 +12,12 @@

Wollen Sie die imos-Bestellung für die markierten Aufträge zurücksetzen?

+ +