diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-25 13:31:59 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-25 13:31:59 +0700 |
| commit | 039bbc5e941b06199b6c44bb8898a4121e312355 (patch) | |
| tree | ef6573fd7080bd54f5e4a32d36f0f6967c4c0aca | |
| parent | af190fa1e5e9301d84307b39b1927f77d3f0ee21 (diff) | |
| parent | e8be87ce9143c92e2b1011649fa6b8280338fa69 (diff) | |
Merge branch 'iman/dokumentai-driver' of bitbucket.org:altafixco/indoteknik-addons into production
| -rw-r--r-- | indoteknik_api/controllers/api_v1/stock_picking.py | 26 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 10 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 10 |
3 files changed, 39 insertions, 7 deletions
diff --git a/indoteknik_api/controllers/api_v1/stock_picking.py b/indoteknik_api/controllers/api_v1/stock_picking.py index 8b941c16..f0c7456d 100644 --- a/indoteknik_api/controllers/api_v1/stock_picking.py +++ b/indoteknik_api/controllers/api_v1/stock_picking.py @@ -1,6 +1,8 @@ from .. import controller from odoo import http from odoo.http import request +from pytz import timezone +from datetime import datetime class StockPicking(controller.Controller): @@ -110,4 +112,26 @@ class StockPicking(controller.Controller): if not picking: return self.response(None) - return self.response(picking.get_tracking_detail())
\ No newline at end of file + return self.response(picking.get_tracking_detail()) + + @http.route(prefix + 'stock-picking/<picking_code>/documentation', auth='public', methods=['PUT', 'OPTIONS'], csrf=False) + @controller.Controller.must_authorized() + def write_partner_stock_picking_documentation(self, **kw): + picking_code = int(kw.get('picking_code', 0)) + sj_document = kw.get('sj_document', False) + paket_document = kw.get('paket_document', False) + + params = {'sj_documentation': sj_document, + 'paket_documentation': paket_document, + 'driver_arrival_date': self.time_to_str(datetime.utcnow(), '%Y-%m-%d %H:%M:%S'), + } + + picking_data = request.env['stock.picking'].search([('picking_code', '=', picking_code)], limit=1) + + if not picking_data: + return self.response(code=404, description='picking not found') + picking_data.write(params) + + return self.response({ + 'name': picking_data.name + })
\ No newline at end of file diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index df72dadf..4c9d7658 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -25,7 +25,7 @@ class StockPicking(models.Model): # Delivery Order driver_departure_date = fields.Datetime( - string='Driver Departure Date', + string='Delivery Departure Date', copy=False ) arrival_time = fields.Datetime( @@ -33,7 +33,7 @@ class StockPicking(models.Model): copy=False ) driver_arrival_date = fields.Datetime( - string='Driver Arrival Date', + string='Delivery Arrival Date', readonly=True, copy=False ) @@ -53,6 +53,10 @@ class StockPicking(models.Model): readonly=True, copy=False ) + sj_documentation = fields.Binary(string="Dokumentasi Surat Jalan", ) + paket_documentation = fields.Binary(string="Dokumentasi Paket", ) + sj_return_date = fields.Datetime(string="SJ Return Date", ) + responsible = fields.Many2one('res.users', string='Responsible', tracking=True) approval_status = fields.Selection([ ('pengajuan1', 'Approval Accounting'), @@ -543,7 +547,7 @@ class StockPicking(models.Model): self.date_reserved = current_time self.validation_minus_onhand_quantity() - + self.responsible = self.env.user.id res = super(StockPicking, self).button_validate() self.calculate_line_no() self.date_done = datetime.datetime.utcnow() diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index b5087e35..c230bc7b 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -130,13 +130,17 @@ <group> <group> <field name="note_logistic"/> + <field name="responsible" /> + <field name="carrier_id"/> + <field name="picking_code" attrs="{'invisible': [['picking_code', '=', False]]}"/> + <field name="picking_code" string="Picking code (akan digenerate ketika sudah di-validate)" attrs="{'invisible': [['picking_code', '!=', False]]}"/> <field name="driver_departure_date" attrs="{'readonly':[('invoice_status', '=', 'invoiced')]}"/> <field name="driver_arrival_date"/> <field name="delivery_tracking_no"/> <field name="driver_id"/> - <field name="carrier_id"/> - <field name="picking_code" attrs="{'invisible': [['picking_code', '=', False]]}"/> - <field name="picking_code" string="Picking code (akan digenerate ketika sudah di-validate)" attrs="{'invisible': [['picking_code', '!=', False]]}"/> + <field name='sj_return_date'/> + <field name="sj_documentation" widget="image" /> + <field name="paket_documentation" widget="image" /> </group> </group> </page> |
