From 8f52f2a4a19383aa56f5031525a07bb73fb11719 Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Fri, 27 Apr 2018 12:10:35 +0200 Subject: [PATCH] Call to local PG9 --- ext/custom-addons/dp_custom/models/sale.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/custom-addons/dp_custom/models/sale.py b/ext/custom-addons/dp_custom/models/sale.py index 503a45fb..0c36f871 100644 --- a/ext/custom-addons/dp_custom/models/sale.py +++ b/ext/custom-addons/dp_custom/models/sale.py @@ -26,7 +26,9 @@ from odoo.tools import float_is_zero from odoo.exceptions import ValidationError, UserError from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT from odoo.tools import float_compare +from odoo.http import request +import requests class SaleOrder(models.Model): _name = 'sale.order' @@ -60,6 +62,14 @@ class SaleOrder(models.Model): confirmation_nr = fields.Char('Freigabenummer') order_type = fields.Selection(ORDER_TYPES, string='Auftragsart', default='M') + @api.multi + def action_pg9_call(self): + addr = request.httprequest.environ ["REMOTE_ADDR"] + self.ensure_one() + for record in self : + xref = 'http://%s:9531/pg9/order/xref:%s' % (addr, record.origin) + r = requests.get(xref) + @api.multi @api.onchange('partner_invoice_id') def _onchange_partner_invoice_id(self):