@ -0,0 +1,48 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Sale Order Payment Status |
|||
========================= |
|||
Displays the payment status and details in the Sale Order. |
|||
|
|||
Configuration |
|||
============= |
|||
* No additional configuration is needed. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
======= |
|||
Affero General Public License, v3.0 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developers: (V17) Shyamgeeth PP, |
|||
(V18) Aysha Shalin, |
|||
Contact : odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import models |
@ -0,0 +1,43 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
{ |
|||
'name': 'Sale Order Payment Status', |
|||
'version': '18.0.1.0.0', |
|||
'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 |
|||
corresponding sale order in the form view. It provides details about the |
|||
sale order's payment status, payment information and the amount due.""", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['sale_management', 'account'], |
|||
'data': [ |
|||
'views/sale_order_views.xml' |
|||
], |
|||
'images': ['static/description/banner.png'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <payment_status_in_sale> |
|||
|
|||
#### 01.01.2025 |
|||
#### Version 18.0.1.0.0 |
|||
##### ADD |
|||
- Initial commit for Sale Order Payment Status |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from . import sale_order |
@ -0,0 +1,174 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Aysha Shalin (odoo@cybrosys.com) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################### |
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class SaleOrder(models.Model): |
|||
""" Extend the base Sale Order model to add custom fields and behaviors |
|||
for Sale Order Payment Status. """ |
|||
_inherit = "sale.order" |
|||
_description = 'Sale order' |
|||
|
|||
payment_status = fields.Char(string="Payment Status", |
|||
compute="_compute_payment_status", |
|||
help="Field to check the payment status of the" |
|||
" sale order") |
|||
payment_details = fields.Binary(string="Payment Details", |
|||
compute="_compute_payment_details", |
|||
help="Shows the payment done details " |
|||
"including date and amount") |
|||
amount_due = fields.Float(string="Amount Due", |
|||
compute='_compute_amount_due', |
|||
help="Shows the amount that in due for the " |
|||
"corresponding sale order") |
|||
invoice_state = fields.Char(string="Invoice State", |
|||
compute="_compute_invoice_state", |
|||
help="Field to check the invoice state of " |
|||
"sale order") |
|||
|
|||
@api.depends('invoice_ids') |
|||
def _compute_payment_status(self): |
|||
""" The function will compute the payment status of the sale order, if |
|||
an invoice is created for the corresponding sale order.Payment status |
|||
will be either in paid,not paid,partially paid, reversed etc. """ |
|||
for order in self: |
|||
order.payment_status = 'No invoice' |
|||
payment_states = order.invoice_ids.mapped('payment_state') |
|||
status_length = len(payment_states) |
|||
if 'partial' in payment_states: |
|||
order.payment_status = 'Partially Paid' |
|||
elif 'not_paid' in payment_states and any( |
|||
(True for x in ['paid', 'in_payment', 'partial'] if |
|||
x in payment_states)): |
|||
order.payment_status = 'Partially Paid' |
|||
elif 'not_paid' in payment_states and status_length == \ |
|||
payment_states.count('not_paid'): |
|||
order.payment_status = 'Not Paid' |
|||
elif 'paid' in payment_states and status_length == \ |
|||
payment_states.count('paid') and order.amount_due == 0: |
|||
order.payment_status = 'Paid' |
|||
elif 'paid' in payment_states and status_length == \ |
|||
payment_states.count('paid') and order.amount_due != 0: |
|||
order.payment_status = 'Partially Paid' |
|||
elif 'in_payment' in payment_states and status_length == \ |
|||
payment_states.count('in_payment'): |
|||
order.payment_status = 'In Payment' |
|||
elif 'reversed' in payment_states and status_length == \ |
|||
payment_states.count('reversed'): |
|||
order.payment_status = 'Reversed' |
|||
else: |
|||
order.payment_status = 'No invoice' |
|||
|
|||
@api.depends('invoice_ids') |
|||
def _compute_invoice_state(self): |
|||
""" The function will compute the state of the invoice , Once an invoice |
|||
is existing in a sale order. """ |
|||
for rec in self: |
|||
rec.invoice_state = 'No invoice' |
|||
for order in rec.invoice_ids: |
|||
if order.state == 'posted': |
|||
rec.invoice_state = 'posted' |
|||
elif order.state != 'posted': |
|||
rec.invoice_state = 'draft' |
|||
else: |
|||
rec.invoice_state = 'No invoice' |
|||
|
|||
@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.""" |
|||
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 |
|||
|
|||
def action_open_business_doc(self): |
|||
""" This method is intended to be used in the context of an |
|||
account.move record. |
|||
It retrieves the associated payment record and opens it in a new window. |
|||
|
|||
:return: A dictionary describing the action to be performed. |
|||
:rtype: dict """ |
|||
name = _("Journal Entry") |
|||
move = self.env['account.move'].browse(self.id) |
|||
res_model = 'account.payment' |
|||
res_id = move.payment_id.id |
|||
return { |
|||
'name': name, |
|||
'type': 'ir.actions.act_window', |
|||
'view_mode': 'form', |
|||
'views': [(False, 'form')], |
|||
'res_model': res_model, |
|||
'res_id': res_id, |
|||
'target': 'current', |
|||
} |
|||
|
|||
def js_remove_outstanding_partial(self, partial_id): |
|||
""" Called by the 'payment' widget to remove a reconciled entry to the |
|||
present invoice. |
|||
|
|||
:param partial_id: The id of an existing partial reconciled with the |
|||
current invoice. |
|||
""" |
|||
self.ensure_one() |
|||
partial = self.env['account.partial.reconcile'].browse(partial_id) |
|||
return partial.unlink() |
|||
|
|||
@api.depends('invoice_ids') |
|||
def _compute_payment_details(self): |
|||
""" Compute the payment details from invoices and added into the sale |
|||
order form view. """ |
|||
for rec in self: |
|||
payment = [] |
|||
rec.payment_details = False |
|||
if rec.invoice_ids: |
|||
for line in rec.invoice_ids: |
|||
if line.invoice_payments_widget: |
|||
for pay in line.invoice_payments_widget['content']: |
|||
payment.append(pay) |
|||
for line in rec.invoice_ids: |
|||
if line.invoice_payments_widget: |
|||
payment_line = line.invoice_payments_widget |
|||
payment_line['content'] = payment |
|||
rec.payment_details = payment_line |
|||
break |
|||
rec.payment_details = False |
|||
|
|||
def action_register_payment(self): |
|||
""" Open the account.payment.register wizard to pay the selected journal |
|||
entries. |
|||
:return: An action opening the account.payment.register wizard. |
|||
""" |
|||
self.ensure_one() |
|||
return { |
|||
'name': _('Register Payment'), |
|||
'res_model': 'account.payment.register', |
|||
'view_mode': 'form', |
|||
'context': { |
|||
'active_model': 'account.move', |
|||
'active_ids': self.invoice_ids.ids, |
|||
}, |
|||
'target': 'new', |
|||
'type': 'ir.actions.act_window', |
|||
} |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 179 KiB |
After Width: | Height: | Size: 116 KiB |
After Width: | Height: | Size: 129 KiB |
After Width: | Height: | Size: 128 KiB |
After Width: | Height: | Size: 192 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 9.4 KiB |
@ -0,0 +1,78 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Inherited sale order form view. --> |
|||
<record id="view_order_form" model="ir.ui.view"> |
|||
<field name="name">sales.order.view.form.inherit.payment.status.in |
|||
.sale |
|||
</field> |
|||
<field name="model">sale.order</field> |
|||
<field name="inherit_id" ref="sale.view_order_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='payment_term_id']" position="after"> |
|||
<field name="payment_status" invisible="1"/> |
|||
<field name="invoice_state" invisible="1"/> |
|||
<field name="payment_details" widget="payment" |
|||
style="width: 60%"/> |
|||
<field name="amount_due"/> |
|||
</xpath> |
|||
<xpath expr="//sheet//div[hasclass('oe_button_box')]" |
|||
position="after"> |
|||
<widget name="web_ribbon" title="Not Paid" |
|||
bg_color="bg-danger" invisible = "payment_status != 'Not Paid'"/> |
|||
<widget name="web_ribbon" title="Paid" |
|||
bg_color="bg-success" invisible = "payment_status != 'Paid'"/> |
|||
<widget name="web_ribbon" title="Partially Paid" |
|||
bg_color="bg-warning" invisible = "payment_status != 'Partially Paid'"/> |
|||
<widget name="web_ribbon" title="In Payment" |
|||
bg_color="bg-info" invisible = "payment_status != 'In Payment'"/> |
|||
<widget name="web_ribbon" title="Reversed" |
|||
bg_color="bg-success" invisible = "payment_status != 'Reversed'"/> |
|||
</xpath> |
|||
<xpath expr="//button[@name='action_confirm']" |
|||
position="after"> |
|||
<button name="action_register_payment" |
|||
string="Register Payment" class="btn-secondary" |
|||
type="object" invisible = "state != 'sale' or invoice_state != 'posted' or payment_status not in ('Not Paid', 'Partially Paid')"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
<!-- Inherited sale order tree view. --> |
|||
<record id="view_order_tree" model="ir.ui.view"> |
|||
<field name="name">sale.order.view.tree.inherit.payment.status.in |
|||
.sale |
|||
</field> |
|||
<field name="model">sale.order</field> |
|||
<field name="inherit_id" ref="sale.view_order_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='invoice_status']" position="after"> |
|||
<field name="payment_status" optional="show" |
|||
decoration-success="payment_status in ['Paid', 'Reversed']" |
|||
decoration-danger="payment_status == 'Not Paid'" |
|||
decoration-info="payment_status == 'In Payment'" |
|||
decoration-bf="payment_status == 'No invoice'" |
|||
decoration-warning="payment_status == 'Partially Paid'" |
|||
widget="badge"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
<!-- Inherited sale order quotation tree view. --> |
|||
<record id="view_quotation_tree_with_onboarding" model="ir.ui.view"> |
|||
<field name="name">sale.order.view.tree.inherit.payment.status |
|||
.in.sale |
|||
</field> |
|||
<field name="model">sale.order</field> |
|||
<field name="inherit_id" |
|||
ref="sale.view_quotation_tree_with_onboarding"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='invoice_status']" position="after"> |
|||
<field name="payment_status" optional="show" |
|||
decoration-success="payment_status in ['Paid', 'Reversed']" |
|||
decoration-danger="payment_status == 'Not Paid'" |
|||
decoration-info="payment_status == 'In Payment'" |
|||
decoration-bf="payment_status == 'No invoice'" |
|||
decoration-warning="payment_status == 'Partially Paid'" |
|||
widget="badge"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |