summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/stock_picking.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-11-11 16:13:27 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-11-11 16:13:27 +0700
commit4be403f544f63a5161275f0d600c6f6950f3a30c (patch)
tree9b88b2d5c6b9973a5d5476c2cedee51ff97b7fdd /indoteknik_custom/models/stock_picking.py
parent1bb2d9edb764ee3de50b0a005ff40aeef60bf5d6 (diff)
push
Diffstat (limited to 'indoteknik_custom/models/stock_picking.py')
-rw-r--r--indoteknik_custom/models/stock_picking.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index 107a6e72..ad31a2ba 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -445,14 +445,28 @@ class StockPicking(models.Model):
if self.env.user.is_accounting:
pick.approval_return_status = 'approved'
else:
- pick.approval_return_status = 'pengajuan1'
- action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard')
- action['context'] = {
- 'picking_ids': [x.id for x in self]
- }
- return action
+ if self.picking_type_code == 'outgoing':
+ if self.env.user.id in [3988, 3401, 20]:
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard')
+ action['context'] = {
+ 'picking_ids': [x.id for x in self]
+ }
+ return action
+ 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'):
+ action = self.env['ir.actions.act_window']._for_xml_id('indoteknik_custom.action_stock_return_note_wizard')
+ action['context'] = {
+ 'picking_ids': [x.id for x in self]
+ }
+ return action
+ else:
+ raise UserError('Harus Purchasing yang Ask Return')
+
def calculate_line_no(self):
+
for picking in self:
name = picking.group_id.name
for move in picking.move_ids_without_package: