summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-11-06 10:16:52 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-11-06 10:16:52 +0700
commitddc06e464075c316de8f236e0e037dd964a972e3 (patch)
tree42c858bdb1a99ed11bca92504df00ae1cb048d29 /indoteknik_custom/models/stock_picking.py
parentcabe184a38a6a96b9557ff7debb2e9165894a7b6 (diff)
<Miqdad> add new field
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py44
1 files changed, 25 insertions, 19 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index c17fdbd5..04847be8 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -89,6 +89,7 @@ class StockPicking(models.Model):
readonly=True,
related="id",
)
+ sj_documentations = fields.One2many('stock.picking.sj.document','picking_id', string='Dokumentasi SJ (Multi)')
sj_documentation = fields.Binary(string="Dokumentasi Surat Jalan")
paket_documentation = fields.Binary(string="Dokumentasi Paket")
dispatch_documentation = fields.Binary(string="Dokumentasi Dispatch")
@@ -205,8 +206,6 @@ class StockPicking(models.Model):
for record in self:
record.so_num = record.group_id.name
-
-
@api.depends('move_line_ids_without_package.qty_done', 'move_line_ids_without_package.product_uom_qty', 'state')
def _compute_delivery_status_detail(self):
for picking in self:
@@ -468,7 +467,6 @@ class StockPicking(models.Model):
except ValueError:
return False
-
def action_get_kgx_pod(self, shipment=False):
self.ensure_one()
@@ -1189,7 +1187,8 @@ class StockPicking(models.Model):
self.sale_id.date_doc_kirim = self.date_doc_kirim
def action_assign(self):
- if self.env.context.get('default_picking_type_id') and ('BU/INPUT' not in self.name or 'BU/PUT' not in self.name):
+ if self.env.context.get('default_picking_type_id') and (
+ 'BU/INPUT' not in self.name or 'BU/PUT' not in self.name):
pickings_to_assign = self.filtered(
lambda p: not (p.sale_id and p.sale_id.hold_outgoing)
)
@@ -1205,18 +1204,15 @@ class StockPicking(models.Model):
return res
-
def ask_approval(self):
# if self.env.user.is_accounting:
# if self.env.user.is_accounting and self.location_id.id == 57 or self.location_id == 57 and self.approval_status in ['pengajuan1', ''] and 'BU/IU' in self.name and self.approval_status == 'pengajuan1':
# raise UserError("Bisa langsung set ke approval logistik")
if self.env.user.is_accounting and self.approval_status == "pengajuan2" and 'BU/IU' in self.name:
raise UserError("Tidak perlu ask approval sudah approval logistik")
- if self.env.user.is_logistic_approver and self.location_id.id == 57 or self.location_id== 57 and self.approval_status == 'pengajuan2' and 'BU/IU' in self.name:
+ if self.env.user.is_logistic_approver and self.location_id.id == 57 or self.location_id == 57 and self.approval_status == 'pengajuan2' and 'BU/IU' in self.name:
raise UserError("Bisa langsung Validate")
-
-
# for calendar distribute only
# if self.is_internal_use:
# stock_move_lines = self.env['stock.move.line'].search([
@@ -1239,7 +1235,6 @@ class StockPicking(models.Model):
raise UserError("Qty tidak boleh 0")
pick.approval_status = 'pengajuan1'
-
def ask_receipt_approval(self):
if self.env.user.is_logistic_approver:
raise UserError('Bisa langsung validate tanpa Ask Receipt')
@@ -1405,7 +1400,7 @@ class StockPicking(models.Model):
and self.create_date > threshold_datetime
and not self.so_lama):
raise UserError(_("Tidak ada scan koli! Harap periksa kembali."))
-
+
if 'BU/OUT/' in self.name:
self.driver_departure_date = datetime.datetime.utcnow()
@@ -1447,13 +1442,16 @@ class StockPicking(models.Model):
# if self.is_internal_use and not self.env.user.is_logistic_approver and self.location_id.id == 57 and self.approval_status == 'pengajuan2':
# raise UserError("Harus di Approve oleh Logistik")
- if self.is_internal_use and self.approval_status in ['pengajuan1', '', False] and 'BU/IU' in self.name and self.is_bu_iu == True:
+ if self.is_internal_use and self.approval_status in ['pengajuan1', '',
+ False] and 'BU/IU' in self.name and self.is_bu_iu == True:
raise UserError("Tidak Bisa Validate, set approval status ke approval logistik terlebih dahhulu")
- if self.is_internal_use and not self.env.user.is_logistic_approver and self.approval_status in ['pengajuan2'] and self.is_bu_iu == True and 'BU/IU' in self.name:
+ if self.is_internal_use and not self.env.user.is_logistic_approver and self.approval_status in [
+ 'pengajuan2'] and self.is_bu_iu == True and 'BU/IU' in self.name:
raise UserError("Harus di Approve oleh Logistik")
- if self.is_internal_use and not self.env.user.is_accounting and self.approval_status in ['pengajuan1', '', False] and self.is_bu_iu == False:
+ if self.is_internal_use and not self.env.user.is_accounting and self.approval_status in ['pengajuan1', '',
+ False] and self.is_bu_iu == False:
raise UserError("Harus di Approve oleh Accounting")
if self.picking_type_id.id == 28 and not self.env.user.is_logistic_approver:
@@ -1479,7 +1477,6 @@ class StockPicking(models.Model):
current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
self.date_reserved = current_time
-
# Validate Qty Demand Can't higher than Qty Product
if self.location_dest_id.id == 58 and 'BU/INPUT/' in self.name:
for move in self.move_ids_without_package:
@@ -1880,7 +1877,8 @@ class StockPicking(models.Model):
'name': move_line.product_id.name,
'code': move_line.product_id.default_code,
'qty': move_line.qty_done,
- 'image': self.env['ir.attachment'].api_image('product.template', 'image_128', move_line.product_id.product_tmpl_id.id),
+ 'image': self.env['ir.attachment'].api_image('product.template', 'image_128',
+ move_line.product_id.product_tmpl_id.id),
})
response = {
@@ -2246,7 +2244,6 @@ class CheckProduct(models.Model):
_order = 'picking_id, id'
_inherit = ['barcodes.barcode_events_mixin']
-
picking_id = fields.Many2one(
'stock.picking',
string='Picking Reference',
@@ -2699,8 +2696,6 @@ class ScanKoli(models.Model):
out_move.qty_done += qty_to_assign
qty_koli -= qty_to_assign
-
-
def _reset_qty_done_if_no_scan(self, picking_id):
product_bu_pick = self.env['stock.move.line'].search([('picking_id', '=', picking_id)])
@@ -2759,4 +2754,15 @@ class WarningModalWizard(models.TransientModel):
def action_continue(self):
if self.picking_id:
return self.picking_id.with_context(skip_koli_check=True).button_validate()
- return {'type': 'ir.actions.act_window_close'} \ No newline at end of file
+ return {'type': 'ir.actions.act_window_close'}
+
+
+class StockPickingSjDocument(models.Model):
+ _name = 'stock.picking.sj.document'
+ _description = 'Dokumentasi Surat Jalan (Multi)'
+ _order = 'sequence, id'
+ _rec_name = 'id'
+
+ picking_id = fields.Many2one('stock.picking', required=True, ondelete='cascade')
+ image = fields.Binary('Gambar', required=True, attachment=True)
+ sequence = fields.Integer('Urutan', default=10) \ No newline at end of file