summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiqdad <ahmadmiqdad27@gmail.com>2025-11-07 13:16:34 +0700
committerMiqdad <ahmadmiqdad27@gmail.com>2025-11-07 13:16:34 +0700
commit459e34a6f96ed12522036bb12da2e0488581c016 (patch)
tree38b92fa4783abfbbdfc34575949859826f69d12b
parent3f905516b4b0b6573ebdf67f18582f20b023f7f6 (diff)
<Miqdad> CR nathan stock picking
-rwxr-xr-xindoteknik_custom/models/sale_order.py1
-rw-r--r--indoteknik_custom/models/stock_picking.py22
-rwxr-xr-xindoteknik_custom/views/sale_order.xml1
-rw-r--r--indoteknik_custom/views/stock_picking.xml5
4 files changed, 25 insertions, 4 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 31662fb4..ef6318da 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -398,6 +398,7 @@ class SaleOrder(models.Model):
compute="_compute_partner_is_cbd_locked"
)
internal_notes_contact = fields.Text(related='partner_id.comment', string="Internal Notes", readonly=True, help="Internal Notes dari contact utama customer.")
+ is_so_fiktif = fields.Boolean('SO Fiktif?')
def action_open_partial_delivery_wizard(self):
# raise UserError("Fitur ini sedang dalam pengembangan")
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index c17fdbd5..8fefcf81 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -199,14 +199,19 @@ class StockPicking(models.Model):
('full', 'Full'),
], string='Delivery Status', compute='_compute_delivery_status_detail', store=False)
so_num = fields.Char('SO Number', compute='_get_so_num')
+ is_so_fiktif = fields.Boolean('SO Fiktif?', compute='_compute_is_so_fiktif')
+
+ @api.depends('sale_id.is_so_fiktif')
+ def _compute_is_so_fiktif(self):
+ for picking in self:
+ picking.is_so_fiktif = picking.sale_id.is_so_fiktif if picking.sale_id else False
+
@api.depends('group_id')
def _get_so_num(self):
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:
@@ -1383,6 +1388,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.is_so_fiktif == True:
+ raise UserError("SO Fiktif tidak bisa di validate")
if self.location_id.id == 47 and self.env.user.id not in users_in_group.mapped(
'id') and self.state_approve_md != 'done':
self.state_approve_md = 'waiting' if self.state_approve_md != 'pending' else 'pending'
@@ -1562,6 +1569,10 @@ class StockPicking(models.Model):
elif self.tukar_guling_po_id:
self.tukar_guling_po_id.update_doc_state()
+ user = self.env.user
+ if not user.has_group('indoteknik_custom.group_role_logistic'):
+ raise UserWarning('Validate hnaya bisa di lakukan oleh logistik')
+
return res
def automatic_reserve_product(self):
@@ -1732,6 +1743,13 @@ class StockPicking(models.Model):
'indoteknik_custom.group_role_logistic') and self.picking_type_code == 'outgoing':
raise UserError("Button ini hanya untuk Logistik")
+ if len(self.check_product_lines) >= 1:
+ raise UserError("Tidak Bisa cancel karena sudah di check product")
+
+ if not self.env.user.is_logistic_approver and not self.env.user.has_group('indoteknik_custom.group_role_logistic'):
+ if self.name and ('BU/PICK' in self.name or 'BU/OUT' in self.name or 'BU/ORT' in self.name or 'BU/SRT' in self.name):
+ raise UserError("Button ini hanya untuk Logistik")
+
res = super(StockPicking, self).action_cancel()
return res
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index a540caa7..b2ecc21c 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -130,6 +130,7 @@
</field>
<field name="approval_status" position="after">
<field name="notes"/>
+ <field name="is_so_fiktif"/>
</field>
<field name="source_id" position="attributes">
<attribute name="invisible">1</attribute>
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index cc9469cb..8e1e9d3e 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -147,7 +147,7 @@
<attribute name="attrs">{'readonly': [('parent.picking_type_code', '=', 'incoming')]}</attribute>
</field> -->
<field name="date_done" position="after">
- <field name="arrival_time"/>
+ <field name="arrival_time" attrs="{'invisible': [('picking_type_id', 'in', [29,30])]}"/>
</field>
<field name="scheduled_date" position="attributes">
<attribute name="readonly">1</attribute>
@@ -162,11 +162,12 @@
<field name="origin" position="after">
<!-- <field name="show_state_approve_md" invisible="1" optional="hide"/>-->
- <field name="state_approve_md" widget="badge"/>
+ <field name="state_approve_md" widget="badge" attrs="{'invisible': [('picking_type_id', 'in', [29,30])]}"/>
<field name="purchase_id"/>
<field name="sale_order"/>
<field name="invoice_status"/>
<field name="is_bu_iu" />
+ <field name="is_so_fiktif" readonly="1"/>
<field name="approval_status" attrs="{'invisible': [('is_bu_iu', '=', False)]}"/>
<field name="date_doc_kirim" attrs="{'readonly':[('invoice_status', '=', 'invoiced')]}"/>
<field name="summary_qty_operation"/>