From b2937588276e2ec21097a7f129635dbe58822354 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 20 Jun 2018 15:44:16 +0200 Subject: [PATCH 01/12] change sum of 'Gesamt Menge' to actual delivered (qty_done) instead of (ordered_qty) --- .../dp_reports_stock/reports/stock.xml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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: - + + +
From a0bb41dff9f574669e378ac1bce2aa51a9002668 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Thu, 21 Jun 2018 16:38:56 +0200 Subject: [PATCH 02/12] "Dies ist eine steuerfreie innergemeinschaftliche Lieferung" auf IG-Ausland-Rechnung --- ext/custom-addons/dp_reports_account/reports/invoice.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ext/custom-addons/dp_reports_account/reports/invoice.xml b/ext/custom-addons/dp_reports_account/reports/invoice.xml index 0fed4b76..47727205 100644 --- a/ext/custom-addons/dp_reports_account/reports/invoice.xml +++ b/ext/custom-addons/dp_reports_account/reports/invoice.xml @@ -273,6 +273,9 @@

+

+ Dies ist eine steuerfreie innergemeinschaftliche Lieferung +

From 1348885db293a5c950aaa4e9742d9f5ac3547098 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Tue, 26 Jun 2018 13:51:48 +0200 Subject: [PATCH 03/12] Add wizard for 'reset imos order' --- ext/custom-addons/dp_custom/__manifest__.py | 1 + .../dp_custom/wizards/__init__.py | 2 + .../dp_custom/wizards/wizard_reset_order.py | 77 +++++++++++++++++++ .../dp_custom/wizards/wizard_reset_order.xml | 36 +++++++++ 4 files changed, 116 insertions(+) create mode 100644 ext/custom-addons/dp_custom/wizards/wizard_reset_order.py create mode 100644 ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml 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/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/wizard_reset_order.py b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py new file mode 100644 index 00000000..724f4f47 --- /dev/null +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py @@ -0,0 +1,77 @@ +# 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 api, fields, models, _ +from odoo.exceptions import ValidationError, UserError + +import json +import requests + +class WizardResetOrder(models.TransientModel): + _name = 'wizard.reset_order' + _description = 'Reset imos-Order' + + name = fields.Char() + + @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 eines der Angebote 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 + else: + info += "\n%s --> OK" % so.name + + if error_at_quotation: + raise UserError(_(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() +# portal_url = tools.config.get('portal_url') + info = '' + imos_url = r'https://2138.testshop.imos3d.com?id=142&tx_imosnetpublic_api[controller]=Basket&tx_imosnetpublic_api[action]=update' + idata = {"uid" : int(order_id[-6:]), "status" : 0} + data = { + 'pass' : '8io4u39ruhiz378uih', + 'user' : 'publicapiuser', + 'pid' : 5, + 'logintype' : 'login', + 'tx_imosnetpublic_api[data]' : json.dumps(idata) + } + response = requests.post(imos_url, data=data) + + 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 = "Angebot: %s, Fehler='%s'" % (order_id,lRes) + else: + if lRes.get('status') != 0: + info = "Angebot: %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..d1b4537e --- /dev/null +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.xml @@ -0,0 +1,36 @@ + + + + + + + view_wizard_reset_order_form + wizard.reset_order + +
+ +

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

+
+
+
+ +
+
+ + +
From 34d5a25b4a57fb817a53790ae37e1de95ea86007 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 27 Jun 2018 10:01:39 +0200 Subject: [PATCH 04/12] add 2 setup-entries to ...-oa.conf --- dev/odoo-server-dev-oa.conf | 3 +++ 1 file changed, 3 insertions(+) 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 From 58a89396ad2c942a4253563dfdd8e1a8e5fecc02 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 27 Jun 2018 10:02:49 +0200 Subject: [PATCH 05/12] read url & pass for imos-portal from .conf file --- .../dp_custom/wizards/wizard_reset_order.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 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 724f4f47..0eaecf27 100644 --- a/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py +++ b/ext/custom-addons/dp_custom/wizards/wizard_reset_order.py @@ -1,7 +1,7 @@ # 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 api, fields, models, _ +from odoo import tools, api, fields, models, _ from odoo.exceptions import ValidationError, UserError import json @@ -48,12 +48,12 @@ class WizardResetOrder(models.TransientModel): def reset_order_status(self, order_id): self.ensure_one() -# portal_url = tools.config.get('portal_url') - info = '' - imos_url = r'https://2138.testshop.imos3d.com?id=142&tx_imosnetpublic_api[controller]=Basket&tx_imosnetpublic_api[action]=update' + imos_base_url = tools.config.get('imos_base_url') + imos_pass = tools.config.get('imos_pass') + imos_url = imos_base_url + r'?id=142&tx_imosnetpublic_api[controller]=Basket&tx_imosnetpublic_api[action]=update' idata = {"uid" : int(order_id[-6:]), "status" : 0} data = { - 'pass' : '8io4u39ruhiz378uih', + 'pass' : imos_pass, 'user' : 'publicapiuser', 'pid' : 5, 'logintype' : 'login', @@ -61,6 +61,7 @@ class WizardResetOrder(models.TransientModel): } response = requests.post(imos_url, data=data) + info = '' try: lRes = json.loads(response.content.decode()) except Exception as e: From 2d597c454aceabba98ea282da867b3f3ebf8f4ed Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 27 Jun 2018 15:16:27 +0200 Subject: [PATCH 06/12] correct spelling errors (user-interface) --- .../dp_custom/wizards/portal_assign_company.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 From 70d7238d5753337cd5569f92581df18c628c6b6f Mon Sep 17 00:00:00 2001 From: Ahmed Aly Date: Wed, 27 Jun 2018 16:13:31 +0200 Subject: [PATCH 07/12] Fall 5559: Textbausteine - AN / AB / RE --- .../dp_line_comment_template/__init__.py | 1 + .../dp_line_comment_template/__manifest__.py | 1 + .../models/account_invoice.py | 11 +++++++ .../models/sale_order.py | 11 +++++++ .../views/account_invoice_view.xml | 4 +++ .../views/sale_order_view.xml | 4 +++ .../wizards/__init__.py | 1 + .../wizards/wizard_add_line_comment.py | 28 ++++++++++++++++ .../wizards/wizard_add_line_comment.xml | 33 +++++++++++++++++++ 9 files changed, 94 insertions(+) create mode 100644 ext/custom-addons/dp_line_comment_template/wizards/__init__.py create mode 100644 ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.py create mode 100644 ext/custom-addons/dp_line_comment_template/wizards/wizard_add_line_comment.xml 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..3d4277df 100644 --- a/ext/custom-addons/dp_line_comment_template/__manifest__.py +++ b/ext/custom-addons/dp_line_comment_template/__manifest__.py @@ -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 @@ + + +
+ + : + + + + +