diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-10-11 11:21:52 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-10-11 11:21:52 +0700 |
| commit | 49b8f17c48a04b28a54608cf45367266f35cf420 (patch) | |
| tree | a0854c79c1b513f511be6501c30c6d6ca10457f5 | |
| parent | b8edd5b930595fdc415d94c0f0d09fa5ecbe43ba (diff) | |
<iman> add dokumentasi driver
| -rw-r--r-- | indoteknik_api/controllers/api_v1/stock_picking.py | 23 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 2 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 2 |
3 files changed, 26 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/api_v1/stock_picking.py b/indoteknik_api/controllers/api_v1/stock_picking.py index 8b941c16..c8bc9a7e 100644 --- a/indoteknik_api/controllers/api_v1/stock_picking.py +++ b/indoteknik_api/controllers/api_v1/stock_picking.py @@ -110,4 +110,25 @@ 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 + } + + 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 14190474..066ce238 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -53,6 +53,8 @@ class StockPicking(models.Model): readonly=True, copy=False ) + sj_documentation = fields.Binary(string="Dokumentasi Surat Jalan", ) + paket_documentation = fields.Binary(string="Dokumentasi Paket", ) approval_status = fields.Selection([ ('pengajuan1', 'Approval Accounting'), diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 899d29eb..d47c1051 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -129,6 +129,8 @@ <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_documentation" widget="image" /> + <field name="paket_documentation" widget="image" /> </group> </group> </page> |
