summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-06-21 10:25:26 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-06-21 10:25:26 +0700
commitc1a0d0e48ef64241c92947a8800f93af4ff109d0 (patch)
treef2b0e94f7447b4082ba66592373907da38797efc
parent45fcd7ed448a8fc4c731433823375aea013abbd5 (diff)
fix approval receipt and hide uneccesary column
-rw-r--r--indoteknik_custom/models/stock_picking.py36
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml1
-rwxr-xr-xindoteknik_custom/views/sale_order.xml1
-rw-r--r--indoteknik_custom/views/stock_picking.xml4
4 files changed, 26 insertions, 16 deletions
diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py
index d8c24e10..a14e71a3 100644
--- a/indoteknik_custom/models/stock_picking.py
+++ b/indoteknik_custom/models/stock_picking.py
@@ -284,25 +284,33 @@ class StockPicking(models.Model):
if self.group_id.sale_id.payment_status != 'settlement':
raise UserError('Uang belum masuk (settlement), mohon konfirmasi ke sales atau finance')
- if self.is_internal_use:
- stock_move_lines = self.env['stock.move.line'].search([
- ('picking_id', '!=', False),
- ('product_id', '=', 236805),
- ('picking_id.partner_id', '=', self.partner_id.id),
- ('qty_done', '>', 0),
- ])
- list_state = ['confirmed', 'done']
- for stock_move_line in stock_move_lines:
- if stock_move_line.picking_id.state not in list_state:
- continue
+ # for distribute calendar only
+ # if self.is_internal_use:
+ # stock_move_lines = self.env['stock.move.line'].search([
+ # ('picking_id', '!=', False),
+ # ('product_id', '=', 236805),
+ # ('picking_id.partner_id', '=', self.partner_id.id),
+ # ('qty_done', '>', 0),
+ # ])
+ # list_state = ['confirmed', 'done']
+ # for stock_move_line in stock_move_lines:
+ # if stock_move_line.picking_id.state not in list_state:
+ # continue
# raise UserError('Sudah pernah dikirim kalender')
- for line in self.move_line_ids_without_package:
- if line.move_id.sale_line_id and self.picking_type_id.code == 'outgoing':
+ if self.picking_type_id.code == 'outgoing':
+ for line in self.move_line_ids_without_package:
if line.move_id.sale_line_id.qty_delivered + line.qty_done > line.move_id.sale_line_id.product_uom_qty:
raise UserError("Qty Delivered akan lebih dari Qty SO")
+ elif self.picking_type_id.code == 'incoming':
+ for line in self.move_ids_without_package:
+ if line.purchase_line_id.qty_received + line.quantity_done > line.purchase_line_id.product_qty:
+ raise UserError('Qty Received akan lebih dari Qty PO')
- self.approval_status = 'approved'
+ if self.is_internal_use:
+ self.approval_status = 'approved'
+ elif self.picking_type_id.code == 'incoming':
+ self.approval_receipt_status = 'approved'
res = super(StockPicking, self).button_validate()
self.calculate_line_no()
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 7a397ff6..5b0c99ef 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -24,6 +24,7 @@
<button name="po_approve"
string="Ask Approval"
type="object"
+ attrs="{'invisible': [('approval_status', '=', 'approved')]}"
/>
<button name="indoteknik_custom.action_view_uangmuka_pembelian" string="UangMuka"
type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index ea84eb00..85f687c1 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -14,6 +14,7 @@
<button name="sale_order_approve"
string="Ask Approval"
type="object"
+ attrs="{'invisible': [('approval_status', 'in', ['pengajuan1', 'pengajuan2', 'approved'])]}"
/>
<button name="indoteknik_custom.action_view_uangmuka_penjualan" string="UangMuka"
type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml
index f95db854..99f0d7c0 100644
--- a/indoteknik_custom/views/stock_picking.xml
+++ b/indoteknik_custom/views/stock_picking.xml
@@ -28,7 +28,7 @@
attrs="{'invisible': [('is_internal_use', '=', False)]}"
/>
<button name="ask_receipt_approval"
- string="Ask Receipt"
+ string="Received"
type="object"
attrs="{'invisible': ['|', ('state', 'in', ['done']), ('approval_receipt_status', '=', 'pengajuan1')]}"
/>
@@ -74,7 +74,7 @@
<field name="approval_return_status"/>
</field>
<field name="product_id" position="before">
- <field name="line_no" attrs="{'readonly': 1}"/>
+ <field name="line_no" attrs="{'readonly': 1}" optional="hide"/>
</field>
<page name="note" position="after">
<page string="E-Faktur" name="efaktur" attrs="{'invisible': [['is_internal_use', '=', False]]}">