summaryrefslogtreecommitdiff
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
parent1bb2d9edb764ee3de50b0a005ff40aeef60bf5d6 (diff)
push
-rw-r--r--indoteknik_custom/models/approval_retur_picking.py16
-rw-r--r--indoteknik_custom/models/requisition.py2
-rw-r--r--indoteknik_custom/models/stock_picking.py26
-rw-r--r--indoteknik_custom/views/approval_retur_picking.xml2
4 files changed, 30 insertions, 16 deletions
diff --git a/indoteknik_custom/models/approval_retur_picking.py b/indoteknik_custom/models/approval_retur_picking.py
index 63639782..34c449a8 100644
--- a/indoteknik_custom/models/approval_retur_picking.py
+++ b/indoteknik_custom/models/approval_retur_picking.py
@@ -8,7 +8,7 @@ class ApprovalReturPicking(models.TransientModel):
_name = 'approval.retur.picking'
_description = 'Wizard to add Note Return'
- note_return = fields.Text(string="Note Return", required=True)
+ note_return = fields.Text(string="Note Return")
def action_confirm_note_return(self):
picking_ids = self._context.get('picking_ids')
@@ -16,22 +16,22 @@ class ApprovalReturPicking(models.TransientModel):
# Update the note_return field
picking.update({
- 'note_return': self.note_return
+ 'approval_return_status': 'pengajuan1'
})
# Post a highlighted message to lognote
- picking.message_post(
- body=f"<div style='background-color: #fdf2e9; border: 1px solid #f5c6cb; padding: 10px;'>"
- f"<b>Note Return (Pinned):</b><br>{self.note_return}</div>",
- subtype_id=self.env.ref("mail.mt_note").id
- )
+ # picking.message_post(
+ # body=f"<div style='background-color: #fdf2e9; border: 1px solid #f5c6cb; padding: 10px;'>"
+ # f"<b>Note Return (Pinned):</b><br>{self.note_return}</div>",
+ # subtype_id=self.env.ref("mail.mt_note").id
+ # )
return {
'type': 'ir.actions.client',
'tag': 'display_notification',
'params': {
'title': 'Notification',
- 'message': 'Note berhasil ditambah',
+ 'message': 'Status pengajuan telah berubah',
'next': {'type': 'ir.actions.act_window_close'},
}
}
diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py
index a90a5718..89ed4a27 100644
--- a/indoteknik_custom/models/requisition.py
+++ b/indoteknik_custom/models/requisition.py
@@ -117,7 +117,7 @@ class Requisition(models.Model):
'product_id': product.id,
'product_qty': line.qty_purchase,
'product_uom_qty': line.qty_purchase,
- 'name': product.name,
+ 'name': product.display_name,
'price_unit': line.price_unit,
'taxes_id': tax,
}
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:
diff --git a/indoteknik_custom/views/approval_retur_picking.xml b/indoteknik_custom/views/approval_retur_picking.xml
index ebe038d1..5ce28e20 100644
--- a/indoteknik_custom/views/approval_retur_picking.xml
+++ b/indoteknik_custom/views/approval_retur_picking.xml
@@ -6,7 +6,7 @@
<field name="arch" type="xml">
<form string="Add Return Note">
<group>
- <field name="note_return" placeholder="Enter return note here..." />
+ <span>Ask Approval Retur?</span>
</group>
<footer>
<button name="action_confirm_note_return" string="Confirm" type="object" class="btn-primary"/>