From 36d0f7ff94f72a0b0796064b6d41e7f32a3f212e Mon Sep 17 00:00:00 2001 From: Andreas Osim Date: Wed, 18 Jul 2018 14:24:33 +0200 Subject: [PATCH] install tracking of deliveries (Weiss) --- .../models/TZCarrier.py | 67 +++++++++++++++++++ .../models/__init__.py | 1 + 2 files changed, 68 insertions(+) create mode 100644 ext/custom-addons/tz_carrier_allow_tracking_modification/models/TZCarrier.py diff --git a/ext/custom-addons/tz_carrier_allow_tracking_modification/models/TZCarrier.py b/ext/custom-addons/tz_carrier_allow_tracking_modification/models/TZCarrier.py new file mode 100644 index 00000000..f9d99747 --- /dev/null +++ b/ext/custom-addons/tz_carrier_allow_tracking_modification/models/TZCarrier.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +import logging + +from odoo import api, fields, models, registry, SUPERUSER_ID, _ +from odoo.exceptions import UserError + +_logger = logging.getLogger(__name__) + +class TZCarrier(models.Model): + _inherit = 'delivery.carrier' + + delivery_type = fields.Selection(selection_add=[('TZCarrier', 'TZCarrier')]) + + # ------------------------------------------------ # + # Fixed price shipping, aka a very simple provider # + # ------------------------------------------------ # + + # fixed_price = fields.Float(compute='_compute_fixed_price', inverse='_set_product_fixed_price', store=True, + # string='Fixed Price') + # + # + # @api.depends('product_id.list_price', 'product_id.product_tmpl_id.list_price') + # def _compute_fixed_price(self): + # for carrier in self: + # carrier.fixed_price = carrier.product_id.list_price + # + # + # def _set_product_fixed_price(self): + # for carrier in self: + # carrier.product_id.list_price = carrier.fixed_price + # + # + def TZCarrier_rate_shipment(self, order): + price = 0 + # price = self.fixed_price + # if self.company_id.currency_id.id != order.currency_id.id: + # price = self.env['res.currency']._compute(self.company_id.currency_id, order.currency_id, price) + # return {'success': True, + # 'price': price, + # 'error_message': False, + # 'warning_message': False} + return False + + def TZCarrier_send_shipping(self, pickings): + res = [] + # for p in pickings: + # res = res + [{'exact_price': p.carrier_id.fixed_price, + # 'tracking_number': False}] + return res + + + def TZCarrier_get_tracking_link(self, picking): + if self.name == 'Weiss': + if picking.carrier_tracking_ref == '?': + lSearch = picking.origin + else: + lSearch = picking.carrier_tracking_ref + TZLink = r'http://isis.gw-world.com/siprod/sixWeb.pStartApp?i_vcAction=SearchConLight&i_vcSearchKey='+lSearch+'&i_vcAdd=Glaser&i_vclangid=DE' + else: + TZLink = False + return TZLink + + def TZCarrier_cancel_shipment(self, pickings): + # return True + raise UserError('Derzeit nicht möglich!') diff --git a/ext/custom-addons/tz_carrier_allow_tracking_modification/models/__init__.py b/ext/custom-addons/tz_carrier_allow_tracking_modification/models/__init__.py index 35292112..ecb1f92c 100644 --- a/ext/custom-addons/tz_carrier_allow_tracking_modification/models/__init__.py +++ b/ext/custom-addons/tz_carrier_allow_tracking_modification/models/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import delivery_carrier_pack +from . import TZCarrier \ No newline at end of file