summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2025-07-25 09:22:20 +0700
committerit-fixcomart <it@fixcomart.co.id>2025-07-25 09:22:20 +0700
commit414b741f6fdd3ba37754db516c695231e3fbca6e (patch)
tree8fb4e9447b079f3b1d65184a0646141ad2469866
parent19ac8961c8163322f759f9eb021df368a8950010 (diff)
<hafid> hold refund
-rwxr-xr-xindoteknik_custom/__manifest__.py1
-rw-r--r--indoteknik_custom/models/refund_sale_order.py8
-rwxr-xr-xindoteknik_custom/models/sale_order.py2
-rw-r--r--indoteknik_custom/views/account_move.xml6
-rwxr-xr-xindoteknik_custom/views/sale_order.xml14
5 files changed, 16 insertions, 15 deletions
diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py
index 21afc26f..93c437af 100755
--- a/indoteknik_custom/__manifest__.py
+++ b/indoteknik_custom/__manifest__.py
@@ -170,6 +170,7 @@
'views/public_holiday.xml',
'views/stock_inventory.xml',
'views/sale_order_delay.xml',
+ 'views/refund_sale_order.xml',
],
'demo': [],
'css': [],
diff --git a/indoteknik_custom/models/refund_sale_order.py b/indoteknik_custom/models/refund_sale_order.py
index 11bfd07f..2a55f16d 100644
--- a/indoteknik_custom/models/refund_sale_order.py
+++ b/indoteknik_custom/models/refund_sale_order.py
@@ -175,7 +175,7 @@ class RefundSaleOrder(models.Model):
if refund_type == 'retur_half' and not invoice_ids:
raise ValidationError(f"SO {', '.join(so.mapped('name'))} belum memiliki invoice untuk Retur Sebagian.")
- total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total')) if invoice_ids else 0.0
+ total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total_signed')) if invoice_ids else 0.0
uang_masuk = vals.get('uang_masuk', 0.0)
ongkir = vals.get('ongkir', 0.0)
pengurangan = total_invoice + ongkir
@@ -266,7 +266,7 @@ class RefundSaleOrder(models.Model):
raise ValidationError(f"SO {', '.join(so.mapped('name'))} belum memiliki invoice untuk retur sebagian.")
if any(field in vals for field in ['uang_masuk', 'invoice_ids', 'ongkir', 'sale_order_ids']):
- total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total'))
+ total_invoice = sum(self.env['account.move'].browse(invoice_ids).mapped('amount_total_signed'))
uang_masuk = vals.get('uang_masuk', rec.uang_masuk)
ongkir = vals.get('ongkir', rec.ongkir)
@@ -325,7 +325,7 @@ class RefundSaleOrder(models.Model):
lambda inv: inv.move_type in ['out_invoice', 'out_refund'] and inv.state != 'cancel'
)
all_invoices |= valid_invoices
- total_invoice += sum(valid_invoices.mapped('amount_total'))
+ total_invoice += sum(valid_invoices.mapped('amount_total_signed'))
self.invoice_ids = all_invoices
@@ -464,7 +464,7 @@ class RefundSaleOrder(models.Model):
if self.refund_type not in ['uang', 'barang_kosong']:
self.refund_type = False
- self.total_invoice = sum(self.invoice_ids.mapped('amount_total'))
+ self.total_invoice = sum(self.invoice_ids.mapped('amount_total_signed'))
def action_ask_approval(self):
for rec in self:
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index febdaabd..c4de0d3a 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -3144,7 +3144,7 @@ class SaleOrder(models.Model):
invoice_ids = self.mapped('invoice_ids').filtered(lambda inv: inv.state != 'cancel')
delivery_total = sum(self.mapped('delivery_amt'))
- total_invoice = sum(invoice_ids.mapped('amount_total'))
+ total_invoice = sum(invoice_ids.mapped('amount_total_signed'))
return {
'type': 'ir.actions.act_window',
diff --git a/indoteknik_custom/views/account_move.xml b/indoteknik_custom/views/account_move.xml
index 9b1c791b..ae944a4a 100644
--- a/indoteknik_custom/views/account_move.xml
+++ b/indoteknik_custom/views/account_move.xml
@@ -36,9 +36,9 @@
<!-- <field name="purchase_order_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'in_invoice')]}"/> -->
</field>
<field name="ref" position="after">
- <field name="sale_id" readonly="1" attrs="{'invisible': [('move_type', '!=', 'entry')]}"/>
- <!-- <field name="refund_so_links" readonly="1" widget="html" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('has_refund_so', '=', False)]}"/>
- <field name="has_refund_so" invisible="1"/> -->
+ <field name="sale_id" readonly="1" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('has_refund_so', '=', True)]}"/>
+ <field name="refund_so_links" readonly="1" widget="html" attrs="{'invisible': ['|', ('move_type', '!=', 'entry'), ('has_refund_so', '=', False)]}"/>
+ <field name="has_refund_so" invisible="1"/>
</field>
<field name="reklas_misc_id" position="after">
<field name="purchase_order_id" context="{'form_view_ref': 'purchase.purchase_order_form'}" options="{'no_create': True}"/>
diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml
index 5bcd7641..1a4726d6 100755
--- a/indoteknik_custom/views/sale_order.xml
+++ b/indoteknik_custom/views/sale_order.xml
@@ -35,13 +35,13 @@
string="UangMuka"
type="action" attrs="{'invisible': [('approval_status', '!=', 'approved')]}"/>
</button>
- <!-- <xpath expr="//header" position="inside">
+ <xpath expr="//header" position="inside">
<button name="button_refund"
type="object"
string="Refund"
class="btn-primary"
attrs="{'invisible': ['|', ('state', 'not in', ['sale', 'done']), ('has_refund', '=', True)]}" />
- </xpath> -->
+ </xpath>
<div class="oe_button_box" name="button_box">
<field name="advance_payment_move_ids" invisible="1"/>
<button name="action_open_advance_payment_moves"
@@ -52,13 +52,13 @@
<field name="advance_payment_move_count" widget="statinfo" string="Journals"/>
</button>
- <!-- <button type="object"
+ <button type="object"
name="action_view_related_refunds"
class="oe_stat_button"
icon="fa-refresh"
attrs="{'invisible': [('refund_count', '=', 0)]}">
<field name="refund_count" widget="statinfo" string="Refund"/>
- </button> -->
+ </button>
</div>
<field name="payment_term_id" position="after">
<field name="create_uid" invisible="1"/>
@@ -176,7 +176,7 @@
<field name="expected_ready_to_ship"/>
<field name="eta_date_start"/>
<field name="eta_date" readonly="1"/>
- <!-- <field name="has_refund" readonly="1"/> -->
+ <field name="has_refund" readonly="1"/>
</group>
</xpath>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']"
@@ -658,7 +658,7 @@
</record>
</data>
- <!-- <data>
+ <data>
<record id="sale_order_multi_create_refund_ir_actions_server" model="ir.actions.server">
<field name="name">Refund</field>
<field name="model_id" ref="sale.model_sale_order"/>
@@ -666,7 +666,7 @@
<field name="state">code</field>
<field name="code">action = records.open_form_multi_create_refund()</field>
</record>
- </data> -->
+ </data>
<data>
<record id="mail_template_sale_order_notification_to_salesperson" model="mail.template">