summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py78
1 files changed, 45 insertions, 33 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 0efffd2f..3e152f10 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -28,6 +28,10 @@ biteship_api_key = "biteship_live.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lI
class StockPicking(models.Model):
_inherit = 'stock.picking'
_order = 'final_seq ASC'
+ tukar_guling_id = fields.Many2one(
+ 'tukar.guling',
+ string='Tukar Guling Reference'
+ )
konfirm_koli_lines = fields.One2many('konfirm.koli', 'picking_id', string='Konfirm Koli', auto_join=True,
copy=False)
scan_koli_lines = fields.One2many('scan.koli', 'picking_id', string='Scan Koli', auto_join=True, copy=False)
@@ -1094,38 +1098,40 @@ class StockPicking(models.Model):
self.approval_receipt_status = 'pengajuan1'
def ask_return_approval(self):
- for pick in self:
- if self.env.user.is_accounting:
- pick.approval_return_status = 'approved'
- continue
- else:
- pick.approval_return_status = 'pengajuan1'
-
- action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard')
-
- if self.picking_type_code == 'outgoing':
- if self.env.user.id in [3988, 3401, 20] or (
- self.env.user.has_group(
- 'indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin
- ):
- action['context'] = {'picking_ids': [x.id for x in self]}
- return action
- elif not self.env.user.has_group(
- 'indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin:
- raise UserError('Harus Purchasing yang Ask Return')
- else:
- raise UserError('Harus Sales Admin yang Ask Return')
-
- elif self.picking_type_code == 'incoming':
- if self.env.user.has_group('indoteknik_custom.group_role_purchasing') or (
- self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin
- ):
- action['context'] = {'picking_ids': [x.id for x in self]}
- return action
- elif not self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin:
- raise UserError('Harus Sales Admin yang Ask Return')
- else:
- raise UserError('Harus Purchasing yang Ask Return')
+ pass
+ raise UserError("Bisa langsung Validate")
+ # for pick in self:
+ # if self.env.user.is_accounting:
+ # pick.approval_return_status = 'approved'
+ # continue
+ # else:
+ # pick.approval_return_status = 'pengajuan1'
+ #
+ # action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard')
+ #
+ # if self.picking_type_code == 'outgoing':
+ # if self.env.user.id in [3988, 3401, 20] or (
+ # self.env.user.has_group(
+ # 'indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin
+ # ):
+ # action['context'] = {'picking_ids': [x.id for x in self]}
+ # return action
+ # elif not self.env.user.has_group(
+ # 'indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin:
+ # raise UserError('Harus Purchasing yang Ask Return')
+ # else:
+ # raise UserError('Harus Sales Admin yang Ask Return')
+ #
+ # elif self.picking_type_code == 'incoming':
+ # if self.env.user.has_group('indoteknik_custom.group_role_purchasing') or (
+ # self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin
+ # ):
+ # action['context'] = {'picking_ids': [x.id for x in self]}
+ # return action
+ # elif not self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin:
+ # raise UserError('Harus Sales Admin yang Ask Return')
+ # else:
+ # raise UserError('Harus Purchasing yang Ask Return')
def calculate_line_no(self):
@@ -1220,6 +1226,10 @@ class StockPicking(models.Model):
def button_validate(self):
self.check_invoice_date()
+ _logger.info("Kode Picking: %s", self.picking_type_id.code)
+ _logger.info("Group ID: %s", self.group_id)
+ _logger.info("Group ID ID: %s", self.group_id.id if self.group_id else None)
+ _logger.info("Is Internal Use: %s", self.is_internal_use)
threshold_datetime = waktu(2025, 4, 11, 6, 26)
group_id = self.env.ref('indoteknik_custom.group_role_merchandiser').id
users_in_group = self.env['res.users'].search([('groups_id', 'in', [group_id])])
@@ -2513,6 +2523,8 @@ class KonfirmKoli(models.Model):
copy=False,
)
pick_id = fields.Many2one('stock.picking', string='Pick')
+ product_id = fields.Many2one('product.product', string='Product')
+ qty_done = fields.Float(string='Qty Done')
@api.constrains('pick_id')
def _check_duplicate_pick_id(self):
@@ -2538,4 +2550,4 @@ 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'}
+ return {'type': 'ir.actions.act_window_close'} \ No newline at end of file