Browse Source

Jun 27: [FIX] Bug Fixed 'payment_status_in_sale'

pull/395/head
Cybrosys Technologies 1 month ago
parent
commit
394a6b5061
  1. 2
      payment_status_in_sale/__manifest__.py
  2. 5
      payment_status_in_sale/doc/RELEASE_NOTES.md
  3. 18
      payment_status_in_sale/models/sale_order.py

2
payment_status_in_sale/__manifest__.py

@ -21,7 +21,7 @@
###############################################################################
{
'name': 'Sale Order Payment Status',
'version': '18.0.1.0.0',
'version': '18.0.1.0.1',
'category': 'Sales',
'summary': 'Displays the payment status and details in the Sale Order.',
'description': """This module is used to display the invoice status of the

5
payment_status_in_sale/doc/RELEASE_NOTES.md

@ -4,3 +4,8 @@
#### Version 18.0.1.0.0
##### ADD
- Initial commit for Sale Order Payment Status
#### 25.06.2025
#### Version 18.0.1.0.0
##### ADD
- Bug fixed to ensure the correct payment status is reflected when credit notes are created.

18
payment_status_in_sale/models/sale_order.py

@ -95,13 +95,19 @@ class SaleOrder(models.Model):
@api.depends('invoice_ids')
def _compute_amount_due(self):
"""The function is used to compute the amount due from the invoice and
if payment is registered."""
if payment is registered, accounting for exchange rate differences and credit notes."""
for rec in self:
amount_due = 0
for order in rec.invoice_ids:
amount_due = amount_due + (order.amount_total -
order.amount_residual)
rec.amount_due = rec.amount_total - amount_due
total_invoiced = 0
total_paid = 0
for invoice in rec.invoice_ids:
if invoice.move_type == 'out_invoice': # Regular invoices
total_invoiced += invoice.amount_total
total_paid += invoice.amount_total - invoice.amount_residual
elif invoice.move_type == 'out_refund': # Credit notes
total_invoiced -= invoice.amount_total
total_paid -= (
invoice.amount_total - invoice.amount_residual)
rec.amount_due = total_invoiced - total_paid
def action_open_business_doc(self):
""" This method is intended to be used in the context of an

Loading…
Cancel
Save