diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2025-12-15 13:31:39 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2025-12-15 13:31:39 +0700 |
| commit | 18d1a2c15b6cf198b275d80596f52cc44da00e3e (patch) | |
| tree | af8efe03013711afb0bda2d34275aa4dea44a641 /indoteknik_custom/models | |
| parent | 097f53b8cb0b2c39fb14f5f3a665410df2c7ebf3 (diff) | |
| parent | 52066bed7e68757247e17ec89d31959247991595 (diff) | |
Merge branch 'odoo-backup' of https://bitbucket.org/altafixco/indoteknik-addons into cr_renca_find
merge
Diffstat (limited to 'indoteknik_custom/models')
| -rw-r--r-- | indoteknik_custom/models/stock_inventory.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 21 | ||||
| -rw-r--r-- | indoteknik_custom/models/tukar_guling.py | 23 | ||||
| -rw-r--r-- | indoteknik_custom/models/user_pengajuan_tempo_request.py | 6 |
4 files changed, 45 insertions, 9 deletions
diff --git a/indoteknik_custom/models/stock_inventory.py b/indoteknik_custom/models/stock_inventory.py index 432d9225..84eb5a17 100644 --- a/indoteknik_custom/models/stock_inventory.py +++ b/indoteknik_custom/models/stock_inventory.py @@ -53,8 +53,8 @@ class StockInventory(models.Model): return "00001" # Jika belum ada data, mulai dari 00001 def action_start(self): - if self.env.user.id not in [21, 17, 6277]: - raise UserError("Hanya Rafly, denise, dan faisal yang bisa start inventory") + if self.env.user.id not in [21, 17, 571, 28]: + raise UserError("Hanya Rafly, Denise, Iqmal, dan Stephan yang bisa start inventory") return super(StockInventory, self).action_start() @api.model diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 2f99a85a..2465fa96 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -202,6 +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('Administrasi') @api.depends('sale_id.payment_term_id') def _get_partner_payment_term(self): @@ -1453,6 +1454,24 @@ class StockPicking(models.Model): raise UserError( f"Tidak bisa validasi {picking.name} sebelum {prev_picking.name} divalidasi." ) + + def internal_transfer_val(self): + for rec in self: + # Gudang service + if rec.location_dest_id.id == 98 and self.env.user.id not in [21, 17]: + raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise") + # Gudang selisih + if rec.location_dest_id.id == 47 and self.env.user.id not in [21, 17]: + raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise") + + # Gudang Rusak + if rec.location_dest_id.id == 62 and self.env.user.id not in [21, 17]: + raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise") + + # Gudang Peminjaman + if rec.location_dest_id.id == 48 and self.env.user.id not in [21, 17]: + raise UserError(f"Transfer ke gudang {rec.location_dest_id.name} harus di approve Rafly H. atau Denise") + def button_validate(self): self.check_invoice_date() _logger.info("Kode Picking: %s", self.picking_type_id.code) @@ -1463,6 +1482,8 @@ class StockPicking(models.Model): group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])]) active_model = self.env.context.get('active_model') + if self.picking_type_id.id in [26, 10, 20, 32, 53, 52]: + self.internal_transfer_val() if self.tukar_guling_po_id and self.tukar_guling_po_id.return_type == 'tukar_guling': self.validate_seq_vcm() if self.is_so_fiktif == True: diff --git a/indoteknik_custom/models/tukar_guling.py b/indoteknik_custom/models/tukar_guling.py index f31c68d0..682c478a 100644 --- a/indoteknik_custom/models/tukar_guling.py +++ b/indoteknik_custom/models/tukar_guling.py @@ -87,6 +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('Administrasi?', tracking=3) @api.depends('origin', 'operations') def _compute_origin_so(self): @@ -808,7 +809,9 @@ class TukarGuling(models.Model): srt_picking.write({ 'group_id': bu_out.group_id.id, 'tukar_guling_id': record.id, - 'sale_order': record.origin + '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}") @@ -868,7 +871,12 @@ class TukarGuling(models.Model): ort_picking.write({ 'group_id': bu_out.group_id.id, 'tukar_guling_id': record.id, - 'sale_order': record.origin + 'sale_order': record.origin, + 'sj_return_date': bu_out.sj_return_date, + '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) @@ -913,7 +921,9 @@ class TukarGuling(models.Model): new_pick.write({ 'group_id': bu_out.group_id.id, 'tukar_guling_id': record.id, - 'sale_order': record.origin + 'sale_order': record.origin, + 'note': record.notes, + 'is_rev_tg': bool(record.rev_tukar_guling), }) new_pick.action_assign() new_pick.action_confirm() @@ -952,7 +962,12 @@ class TukarGuling(models.Model): new_out.write({ 'group_id': bu_out.group_id.id, 'tukar_guling_id': record.id, - 'sale_order': record.origin + 'sale_order': record.origin, + 'note': record.notes, + '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(',', '.') |
