diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-09-12 16:05:12 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-09-12 16:05:12 +0700 |
| commit | ed5b7ed656e9b4d790317612459a6b12197d136b (patch) | |
| tree | 53f856fc6e286db0bbbfa85daa413dc719da20bc | |
| parent | b4cb2913b26644f11abc6f9ea73912a6d3072918 (diff) | |
delivery_order in sale_order and stock_picking
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 1 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 11 | ||||
| -rw-r--r-- | indoteknik_custom/views/ir_sequence.xml | 10 | ||||
| -rwxr-xr-x | indoteknik_custom/views/sale_order.xml | 9 | ||||
| -rw-r--r-- | 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 @@ <field name="number_next">1</field> <field name="number_increment">1</field> </record> + + <record id="sequence_stock_picking_code" model="ir.sequence"> + <field name="name">Stock Picking Code</field> + <field name="code">stock.picking.code</field> + <field name="active">TRUE</field> + <field name="prefix">1%(y)s%(month)s</field> + <field name="padding">5</field> + <field name="number_next">1</field> + <field name="number_increment">1</field> + </record> </odoo>
\ 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 @@ <field name="model">sale.order</field> <field name="inherit_id" ref="sale.view_order_form"/> <field name="arch" type="xml"> - <button id="action_confirm" position="after"> -<!-- <button name="sale_order_approve"--> -<!-- string="Ask Approval"--> -<!-- type="object"--> -<!-- />--> - </button> <field name="payment_term_id" position="after"> <field name="approval_status" /> </field> @@ -23,6 +17,9 @@ <field name="total_margin" groups="sales_team.group_sale_manager"/> <field name="total_percent_margin" groups="sales_team.group_sale_manager"/> </field> + <field name="effective_date" position="after"> + <field name="carrier_id"/> + </field> </field> </record> </data> 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 @@ </group> </group> </page> + <page string="Delivery" name="delivery_order"> + <group> + <group> + <field name="driver_departure_date"/> + <field name="driver_arrival_date"/> + <field name="delivery_tracking_no"/> + <field name="driver_id"/> + <field name="picking_code"/> + </group> + </group> + </page> </page> </field> </record> |
