diff --git a/dev/odoo-server-dev-oa.conf b/dev/odoo-server-dev-oa.conf index 5fc5ba45..8101dcd1 100644 --- a/dev/odoo-server-dev-oa.conf +++ b/dev/odoo-server-dev-oa.conf @@ -22,5 +22,8 @@ server_wide_modules = web,base_sparse_field,queue_job portal_url = https://erp.tzaustria.info portal_secret = secret +imos_base_url = https://2138.testshop.imos3d.com +imos_pass = 8io4u39ruhiz378uih + [queue_job] channels = root:4 diff --git a/ext/custom-addons/dp_custom/__manifest__.py b/ext/custom-addons/dp_custom/__manifest__.py index f906da6d..00ce1b1c 100644 --- a/ext/custom-addons/dp_custom/__manifest__.py +++ b/ext/custom-addons/dp_custom/__manifest__.py @@ -44,6 +44,7 @@ 'views/commission_account.xml', 'wizards/wizard_confirm_production.xml', 'wizards/wizard_import_tzbox.xml', + 'wizards/wizard_reset_order.xml', 'wizards/portal_assign_company.xml', 'wizards/wizard_confirm_print_invoice.xml', 'security/security.xml', diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 185f490a..47d8f19b 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -514,7 +514,7 @@ class SaleOrderLine(models.Model): self.ensure_one() allowed_write = True precision_digits = self.env['decimal.precision'].precision_get('Product Price') - if self.from_designbox and set(vals.keys()).intersection(not_allowed_designbox_keys): + if (self.from_designbox and self.product_id.default_code!='TZ_PLATTE') and set(vals.keys()).intersection(not_allowed_designbox_keys): for val_key in not_allowed_designbox_keys: if val_key in list(vals.keys()) and type(self.__getattribute__(val_key)) is float: if float_compare(self.__getattribute__(val_key), vals[val_key], diff --git a/ext/custom-addons/dp_custom/views/res_partner_views.xml b/ext/custom-addons/dp_custom/views/res_partner_views.xml index 56eaf40f..da040b72 100644 --- a/ext/custom-addons/dp_custom/views/res_partner_views.xml +++ b/ext/custom-addons/dp_custom/views/res_partner_views.xml @@ -54,7 +54,7 @@ - +
KD-Nr: / P-ID: @@ -180,7 +180,7 @@ res.partner - +
KD-Nr: / P-ID: diff --git a/ext/custom-addons/dp_custom/wizards/__init__.py b/ext/custom-addons/dp_custom/wizards/__init__.py index ddbef7c2..158afb89 100644 --- a/ext/custom-addons/dp_custom/wizards/__init__.py +++ b/ext/custom-addons/dp_custom/wizards/__init__.py @@ -2,3 +2,5 @@ from . import wizard_confirm_production from . import wizard_import_tzbox from . import wizard_confirm_print_invoice from . import portal_assign_company +from . import wizard_reset_order + diff --git a/ext/custom-addons/dp_custom/wizards/portal_assign_company.py b/ext/custom-addons/dp_custom/wizards/portal_assign_company.py index a87ed3ab..eebf2bb0 100644 --- a/ext/custom-addons/dp_custom/wizards/portal_assign_company.py +++ b/ext/custom-addons/dp_custom/wizards/portal_assign_company.py @@ -53,14 +53,14 @@ class PortalAssignCompany(models.TransientModel): if error_content and error_msg.get('errors'): raise UserError(_('%s') % (error_msg.get('errors')[0])) else: - raise UserError(_('Die Odoo id konnte für den partner nicht gesetzt werden. ' + raise UserError(_('Die Odoo id konnte für den Partner nicht gesetzt werden. ' 'Status Code: %s, Reason: %s') % (response.status_code, response.reason)) def button_activate(self): self.ensure_one() partner = self.env['res.partner'].browse(self.env.context.get('active_ids', [])) if not partner: - raise ValidationError(_('Der Partner konnte nicht gefuden werden.')) + raise ValidationError(_('Der Partner konnte nicht gefunden werden.')) # Wichtig hier ist, dass dieser Call vor dem ersten Write stattfindet, da das Portal # parallel einen Call absetzt, dann dann blockieren würde. @@ -74,7 +74,7 @@ class PortalAssignCompany(models.TransientModel): if self.main_partner_id: partner = self.env['res.partner'].browse(self.env.context.get('active_ids', [])) if not partner: - raise ValidationError(_('Der Partner konnte nicht gefuden werden.')) + raise ValidationError(_('Der Partner konnte nicht gefunden werden.')) portal_id = partner.portal_id # Wichtig hier ist, dass dieser Call vor dem ersten Write stattfindet, da das Portal diff --git a/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py new file mode 100644 index 00000000..740d7d7e --- /dev/null +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py @@ -0,0 +1,90 @@ +# Copyright 2018-Today datenpol gmbh () +# 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, Warning + +import json +import requests + +class WizardResetOrder(models.TransientModel): + _name = 'wizard.reset_order' + _description = 'Reset imos-Order' + + # 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): + for wizard in self: + error_at_quotation = False + info = 'Bitte prüfen Sie den Angebotsstatus & Auftragsart folgender Angebote:' + active_ids = self.env.context.get('active_ids', []) + sale_orders = self.env['sale.order'].browse(active_ids) + if sale_orders.exists(): + for so in sale_orders: + if so.state == 'cancel' and so.order_type == 'D': + info += "\n %s -- OK" % so.name + else: + info += "\n %s state='%s',order_type='%s'" % (so.name,so.state,so.order_type) + error_at_quotation = True + if error_at_quotation: + raise ValidationError(_(info)) + + 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%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.origin) + + if error_at_quotation: + raise Warning(_(info)) +# self.name = _(info) + + action = self.env.ref('sale.action_orders').read()[0] + action['domain'] = [('id', 'in', active_ids)] + return action + + def reset_order_status(self, order_id): + self.ensure_one() + imos_base_url = tools.config.get('imos_base_url') + imos_pass = tools.config.get('imos_pass') + imos_url = imos_base_url + r'&tx_imosnetpublic_api[controller]=Basket&tx_imosnetpublic_api[action]=update' + idata = {"uid" : int(order_id[-6:]), "status" : 0} + data = { + 'pass' : imos_pass, + 'user' : 'publicapiuser', + 'pid' : 5, + 'logintype' : 'login', + 'tx_imosnetpublic_api[data]' : json.dumps(idata) + } + response = requests.post(imos_url, data=data) + + info = '' + try: + lRes = json.loads(response.content.decode()) + except Exception as e: + info = 'unexpected error %s' % e + raise ValidationError(_(info)) + + if response.status_code == 200: + if lRes.get('status') != 0: + info = "Warenkorb: %s, Fehler='%s'" % (order_id,lRes) + else: + if lRes.get('status') != 0: + 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 new file mode 100644 index 00000000..cbe639d3 --- /dev/null +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml @@ -0,0 +1,42 @@ + + + + + + + view_wizard_reset_order_form + wizard.reset_order + +
+ +

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

+
+ + +
+
+
+
+
+ + +
diff --git a/ext/custom-addons/dp_line_comment_template/__init__.py b/ext/custom-addons/dp_line_comment_template/__init__.py index 0650744f..aee8895e 100644 --- a/ext/custom-addons/dp_line_comment_template/__init__.py +++ b/ext/custom-addons/dp_line_comment_template/__init__.py @@ -1 +1,2 @@ from . import models +from . import wizards diff --git a/ext/custom-addons/dp_line_comment_template/__manifest__.py b/ext/custom-addons/dp_line_comment_template/__manifest__.py index 96787ce6..5821177e 100644 --- a/ext/custom-addons/dp_line_comment_template/__manifest__.py +++ b/ext/custom-addons/dp_line_comment_template/__manifest__.py @@ -3,7 +3,7 @@ # noinspection PyStatementEffect { - 'name': 'dp Order line comments', + 'name': 'dp line comments', 'summary': 'Comments templates on invoice and sale lines', 'version': '11.0.1.0.0', 'license': 'OPL-1', @@ -17,6 +17,7 @@ 'data': [ 'views/account_invoice_view.xml', 'views/sale_order_view.xml', + 'wizards/wizard_add_line_comment.xml', ], 'installable': True, 'auto_install': False, diff --git a/ext/custom-addons/dp_line_comment_template/models/account_invoice.py b/ext/custom-addons/dp_line_comment_template/models/account_invoice.py index 29b238a8..7afbc14d 100644 --- a/ext/custom-addons/dp_line_comment_template/models/account_invoice.py +++ b/ext/custom-addons/dp_line_comment_template/models/account_invoice.py @@ -15,3 +15,14 @@ class AccountInvoice(models.Model): comment = self.comment_line_template_id if comment: self.note_line = comment.get_value(self.partner_id.id) + + +class AccountInvoiceLine(models.Model): + _inherit = "account.invoice.line" + + @api.multi + def add_line_comment(self): + self.ensure_one() + action = self.env.ref('dp_line_comment_template.action_wizard_line_comment').read()[0] + action['context'] = str({"model_name": 'account.invoice.line', "model_id": self.id}) + return action diff --git a/ext/custom-addons/dp_line_comment_template/models/sale_order.py b/ext/custom-addons/dp_line_comment_template/models/sale_order.py index 2b901659..5e0d22a1 100644 --- a/ext/custom-addons/dp_line_comment_template/models/sale_order.py +++ b/ext/custom-addons/dp_line_comment_template/models/sale_order.py @@ -24,3 +24,14 @@ class SaleOrder(models.Model): 'note_line': self.note_line, }) return values + + +class SaleOrderLine(models.Model): + _inherit = "sale.order.line" + + @api.multi + def add_line_comment(self): + self.ensure_one() + action = self.env.ref('dp_line_comment_template.action_wizard_line_comment').read()[0] + action['context'] = str({"model_name": 'sale.order.line', "model_id": self.id}) + return action diff --git a/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml b/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml index b15e3467..dc0c8449 100644 --- a/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml +++ b/ext/custom-addons/dp_line_comment_template/views/account_invoice_view.xml @@ -16,6 +16,10 @@ + + +
diff --git a/ext/custom-addons/dp_reports_stock/reports/stock.xml b/ext/custom-addons/dp_reports_stock/reports/stock.xml index 924983ca..7895352e 100644 --- a/ext/custom-addons/dp_reports_stock/reports/stock.xml +++ b/ext/custom-addons/dp_reports_stock/reports/stock.xml @@ -121,6 +121,7 @@ + @@ -140,6 +141,8 @@ @@ -204,8 +207,14 @@ @@ -230,7 +239,12 @@
Total Amount: - + + +
+ + : + + + + +