diff options
| author | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2025-12-15 08:45:56 +0700 |
|---|---|---|
| committer | FIN-IT_AndriFP <andrifebriyadiputra@gmail.com> | 2025-12-15 08:45:56 +0700 |
| commit | 3a131c68a6b72d8477ddff4e42de9fda7ca78b46 (patch) | |
| tree | 8a3d768536852a33b3cf860e921f6892edad83a6 | |
| parent | 21d01b83204677e3cf8d355b6198290b6dbb9d52 (diff) | |
| parent | 28bbc495e76b6492935f7270888872135ae4d944 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into cr_renca_find
| -rw-r--r-- | indoteknik_api/controllers/api_v1/stock_picking.py | 22 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 7 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_pengajuan_tempo_request.py | 6 | ||||
| -rw-r--r-- | indoteknik_custom/report/purchase_report.xml | 4 | ||||
| -rw-r--r-- | indoteknik_custom/views/stock_picking.xml | 12 |
6 files changed, 36 insertions, 21 deletions
diff --git a/indoteknik_api/controllers/api_v1/stock_picking.py b/indoteknik_api/controllers/api_v1/stock_picking.py index c19812f5..def55435 100644 --- a/indoteknik_api/controllers/api_v1/stock_picking.py +++ b/indoteknik_api/controllers/api_v1/stock_picking.py @@ -130,12 +130,23 @@ class StockPicking(controller.Controller): # ===== Cari picking by id / picking_code ===== picking = False - if scanid.isdigit() and int(scanid) < 2147483646: - picking = request.env['stock.picking'].search([('id', '=', int(scanid))], limit=0) - if not picking: - picking = request.env['stock.picking'].search([('picking_code', '=', scanid)], limit=0) + # if scanid.isdigit() and int(scanid) < 2147483646: + # picking = request.env['stock.picking'].search([('id', '=', int(scanid))], limit=1) + # if not picking: + # picking = request.env['stock.picking'].search([('picking_code', '=', scanid)], limit=1) + + if scanid.isdigit(): + picking = request.env['stock.picking'].browse(int(scanid)) + if not picking.exists(): + picking = False + if not picking: - return self.response(code=403, description='picking not found') + picking = request.env['stock.picking'].search( + [('picking_code', '=', scanid)], + limit=1 + ) + if not picking: + return self.response(code=403, description='picking not found') # ===== Ambil MULTIPLE SJ dari form: sj_documentations=...&sj_documentations=... ===== form = request.httprequest.form or {} @@ -306,4 +317,3 @@ class StockPicking(controller.Controller): "waybill_id": data.get("courier_waybill_id") } ) - diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 602b1145..2465fa96 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -202,12 +202,7 @@ class StockPicking(models.Model): so_num = fields.Char('SO Number', compute='_get_so_num') is_so_fiktif = fields.Boolean('SO Fiktif?', compute='_compute_is_so_fiktif', tracking=3) payment_term = fields.Char('Payment Term', compute='_get_partner_payment_term') - is_rev_tg = fields.Boolean('Revisi SO', compute='_compute_is_rev_tg', store=False) - - @api.depends('tukar_guling_id.rev_tukar_guling') - def _compute_is_rev_tg(self): - for record in self: - record.is_rev_tg = record.tukar_guling_id.rev_tukar_guling if record.tukar_guling_id else False + is_rev_tg = fields.Boolean('Administrasi') @api.depends('sale_id.payment_term_id') def _get_partner_payment_term(self): diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index 9bcb0988..682c478a 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -87,7 +87,7 @@ class TukarGuling(models.Model): is_has_invoice = fields.Boolean('Has Invoice?', compute='_compute_is_has_invoice', readonly=True, default=False) invoice_id = fields.Many2many('account.move', string='Invoice Ref', readonly=True) - rev_tukar_guling = fields.Boolean('SO Direvisi?', default=False, tracking=3) + rev_tukar_guling = fields.Boolean('Administrasi?', tracking=3) @api.depends('origin', 'operations') def _compute_origin_so(self): @@ -811,6 +811,7 @@ class TukarGuling(models.Model): 'tukar_guling_id': record.id, 'sale_order': record.origin, 'note': record.notes, + 'is_rev_tg': bool(record.rev_tukar_guling), }) created_returns.append(srt_picking) _logger.info(f"✅ SRT created: {srt_picking.name}") @@ -875,6 +876,7 @@ class TukarGuling(models.Model): 'driver_arrival_date': bu_out.driver_arrival_date, 'delivery_date': bu_out.delivery_date, 'note': record.notes, + 'is_rev_tg': bool(record.rev_tukar_guling), }) created_returns.append(ort_picking) @@ -921,6 +923,7 @@ class TukarGuling(models.Model): 'tukar_guling_id': record.id, 'sale_order': record.origin, 'note': record.notes, + 'is_rev_tg': bool(record.rev_tukar_guling), }) new_pick.action_assign() new_pick.action_confirm() @@ -964,6 +967,7 @@ class TukarGuling(models.Model): 'sj_return_date': bu_out.sj_return_date if record.rev_tukar_guling else False, 'driver_arrival_date': bu_out.driver_arrival_date if record.rev_tukar_guling else False, 'delivery_date': bu_out.delivery_date if record.rev_tukar_guling else False, + 'is_rev_tg': bool(record.rev_tukar_guling), }) created_returns.append(new_out) _logger.info(f"✅ BU/OUT Baru dari SRT created: {new_out.name}") diff --git a/indoteknik_custom/models/user_pengajuan_tempo_request.py b/indoteknik_custom/models/user_pengajuan_tempo_request.py index 6e8498f7..6a553946 100644 --- a/indoteknik_custom/models/user_pengajuan_tempo_request.py +++ b/indoteknik_custom/models/user_pengajuan_tempo_request.py @@ -46,7 +46,7 @@ class UserPengajuanTempoRequest(models.Model): user_id = fields.Many2one('res.partner', string='User') user_company_id = fields.Many2one('res.partner', string='Company') pengajuan_tempo_id = fields.Many2one('user.pengajuan.tempo', string='Form Tempo') - tempo_duration = fields.Many2one('account.payment.term', string='Durasi Tempo', tracking=3, domain=[('id', 'in', [24, 25, 29, 32])]) + tempo_duration = fields.Many2one('account.payment.term', string='Durasi Tempo', tracking=3) tempo_limit = fields.Integer(string='Limit Tempo', tracking=3) state_tempo = fields.Selection([ ('draft', 'Pengajuan Tempo'), @@ -91,7 +91,7 @@ class UserPengajuanTempoRequest(models.Model): website_tempo = fields.Char(string='Website', related='pengajuan_tempo_id.website_tempo', store=True, tracking=True, readonly=False) portal = fields.Boolean(string='Portal Website', related='pengajuan_tempo_id.portal', store=True, tracking=True, readonly=False) estimasi_tempo = fields.Char(string='Estimasi Pembelian Pertahun', related='pengajuan_tempo_id.estimasi_tempo', store=True, tracking=True, readonly=False) - tempo_duration_origin = fields.Many2one('account.payment.term', string='Durasi Tempo', related='tempo_duration', store=True, tracking=True, readonly=False, domain=[('id', 'in', [24, 25, 29, 32])]) + tempo_duration_origin = fields.Many2one('account.payment.term', string='Durasi Tempo', related='tempo_duration', store=True, tracking=True, readonly=False) tempo_limit_origin = fields.Char(string='Limit Tempo', related='pengajuan_tempo_id.tempo_limit' , store=True, tracking=True, readonly=False) category_produk_ids = fields.Many2many('product.public.category', string='Kategori Produk yang Digunakan', related='pengajuan_tempo_id.category_produk_ids', readonly=False) @@ -688,4 +688,4 @@ class UserPengajuanTempoRequest(models.Model): def format_currency(self, number): number = int(number) - return "{:,}".format(number).replace(',', '.')
\ No newline at end of file + return "{:,}".format(number).replace(',', '.') diff --git a/indoteknik_custom/report/purchase_report.xml b/indoteknik_custom/report/purchase_report.xml index 8785a7cf..54ac6193 100644 --- a/indoteknik_custom/report/purchase_report.xml +++ b/indoteknik_custom/report/purchase_report.xml @@ -105,8 +105,8 @@ <!-- TEKS --> <div style="display:flex; flex-direction:column; flex:1;"> <span style="font-weight:bold; margin-bottom:2px;"> - <t t-esc="line_index + 1"/>. - <t t-if="line.product_id.id in [114360, 595346]"> + <t t-esc="line_index + 1"/>. + <t t-if="line.product_id.id in [114360, 595346, 610166]"> <t t-esc="line.name"/> </t> <t t-else=""> diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index eeb78f3b..5671c9f0 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -171,7 +171,8 @@ <field name="invoice_status"/> <field name="is_bu_iu"/> <field name="is_so_fiktif" readonly="1"/> - <field name="is_rev_tg" attrs="{'invisible': [('is_rev_tg', '=', False)]}" readonly="1"/> + <field name="is_rev_tg" invisible="1" /> + <field name="tukar_guling_id" invisible="1" /> <field name="approval_status" attrs="{'invisible': [('is_bu_iu', '=', False)]}"/> <field name="date_doc_kirim" attrs="{'readonly':[('invoice_status', '=', 'invoiced')]}"/> <field name="summary_qty_operation"/> @@ -358,9 +359,14 @@ bg_color="bg-danger" attrs="{'invisible': [('is_so_fiktif', '=', False)]}"/> <widget name="web_ribbon" - title="Revisi SO" + title="Administrasi" bg_color="bg-danger" - attrs="{'invisible': [('is_rev_tg', '=', False)]}"/> + attrs="{'invisible': ['|', ('tukar_guling_id','=',False), ('is_rev_tg','=', False)]}"/> + + <widget name="web_ribbon" + title="Perlu Dikirim" + bg_color="bg-success" + attrs="{'invisible': ['|', ('tukar_guling_id','=',False), ('is_rev_tg','=', True)]}"/> </xpath> </field> </record> |
