mirror of
https://gitlab.com/hibou-io/hibou-odoo/suite.git
synced 2025-01-20 12:37:31 +02:00
Initial commit of stock_delivery_route fro 11.0
This commit is contained in:
committed by
Connor Christian
parent
1054f20119
commit
6110452ef8
43
stock_delivery_route/models/stock.py
Normal file
43
stock_delivery_route/models/stock.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class Warehouse(models.Model):
|
||||
_inherit = 'stock.warehouse'
|
||||
|
||||
delivery_route_ids = fields.One2many('stock.warehouse.delivery.route', 'warehouse_id', string='Delivery Routes')
|
||||
|
||||
|
||||
class Picking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
_order = 'sequence asc, priority desc, date asc, id desc'
|
||||
|
||||
sequence = fields.Integer(string='Sequence')
|
||||
warehouse_id = fields.Many2one('stock.warehouse', related='picking_type_id.warehouse_id')
|
||||
delivery_route_id = fields.Many2one('stock.warehouse.delivery.route', string='Delivery Route')
|
||||
partner_address = fields.Char(string='Address', compute='_compute_partner_address')
|
||||
|
||||
@api.multi
|
||||
def _compute_partner_address(self):
|
||||
for pick in self:
|
||||
if pick.partner_id:
|
||||
pick.partner_address = '%s: %s, %s' % (pick.partner_id.name or '', pick.partner_id.street or '', pick.partner_id.city or '')
|
||||
else:
|
||||
pick.partner_address = ''
|
||||
|
||||
|
||||
class WarehouseDeliveryRoute(models.Model):
|
||||
_name = 'stock.warehouse.delivery.route'
|
||||
|
||||
name = fields.Char(string='Name')
|
||||
warehouse_id = fields.Many2one('stock.warehouse', string='Warehouse')
|
||||
note = fields.Text(string='Note')
|
||||
|
||||
@api.multi
|
||||
def name_get(self):
|
||||
res = []
|
||||
for route in self:
|
||||
res.append((route.id, '[%s] %s' % (route.warehouse_id.code, route.name)))
|
||||
return res
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user