install tracking of deliveries (Weiss)
							parent
							
								
									773c0470f8
								
							
						
					
					
						commit
						36d0f7ff94
					
				|  | @ -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!') | ||||||
|  | @ -1,3 +1,4 @@ | ||||||
| # -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||||
| 
 | 
 | ||||||
| from . import delivery_carrier_pack | from . import delivery_carrier_pack | ||||||
|  | from . import TZCarrier | ||||||
		Loading…
	
		Reference in New Issue