From ed5b7ed656e9b4d790317612459a6b12197d136b Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Mon, 12 Sep 2022 16:05:12 +0700 Subject: delivery_order in sale_order and stock_picking --- indoteknik_custom/models/sale_order.py | 1 + indoteknik_custom/models/stock_picking.py | 11 +++++++++++ indoteknik_custom/views/ir_sequence.xml | 10 ++++++++++ indoteknik_custom/views/sale_order.xml | 9 +++------ indoteknik_custom/views/stock_picking.xml | 11 +++++++++++ 5 files changed, 36 insertions(+), 6 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 6f901809..3db6e432 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -17,6 +17,7 @@ class SaleOrder(models.Model): ('pengajuan2', 'Approval Tyas'), ('approved', 'Approved'), ], string='Approval Status', readonly=True, copy=False, index=True, tracking=3) + carrier_id = fields.Many2one('delivery.carrier', string='Shipping Method') # def sale_order_approve(self): # for order in self: diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 5142bc5f..179faadd 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1,4 +1,5 @@ from odoo import fields, models, api +from datetime import datetime class StockPicking(models.Model): @@ -9,6 +10,13 @@ class StockPicking(models.Model): is_efaktur_exported = fields.Boolean(string='Is eFaktur Exported') date_efaktur_exported = fields.Datetime(string='eFaktur Exported Date') + # Delivery Order + driver_departure_date = fields.Datetime(string='Driver Departure Date', readonly=True) + driver_arrival_date = fields.Datetime(string='Driver Arrival Date', readonly=True) + delivery_tracking_no = fields.Char(string='Delivery Tracking Number', readonly=True) + driver_id = fields.Many2one('res.users', string='Driver', readonly=True) + picking_code = fields.Char(string="Picking Code", readonly=True, copy=False) + @api.onchange('picking_type_id') def _onchange_operation_type(self): self.is_internal_use = self.picking_type_id.is_internal_use @@ -16,6 +24,9 @@ class StockPicking(models.Model): @api.model def create(self, vals): + if not self.picking_code: + vals['picking_code'] = self.env['ir.sequence'].next_by_code('stock.picking.code') or '0' + self._use_faktur(vals) return super(StockPicking, self).create(vals) diff --git a/indoteknik_custom/views/ir_sequence.xml b/indoteknik_custom/views/ir_sequence.xml index 9e057c0d..064aaac3 100644 --- a/indoteknik_custom/views/ir_sequence.xml +++ b/indoteknik_custom/views/ir_sequence.xml @@ -9,4 +9,14 @@ 1 1 + + + Stock Picking Code + stock.picking.code + TRUE + 1%(y)s%(month)s + 5 + 1 + 1 + \ No newline at end of file diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index 82058837..19182a6b 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -6,12 +6,6 @@ sale.order - @@ -23,6 +17,9 @@ + + + diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 0a8dba0b..4ac8f2ed 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -33,6 +33,17 @@ + + + + + + + + + + + -- cgit v1.2.3