diff --git a/total_payable_receivable/README.rst b/total_payable_receivable/README.rst index 871ca44bc..e660638f3 100644 --- a/total_payable_receivable/README.rst +++ b/total_payable_receivable/README.rst @@ -1,8 +1,11 @@ -Total Payable & Receivable +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 + +Total Payable & Receivable ========================== This module will make total payable and receivable field in customer and vendor form - Configuration ============= * No additional configurations needed @@ -11,6 +14,11 @@ Company ------- * `Cybrosys Techno Solutions `__ +License +------- +General Public License, Version 3 (AGPL v3). +(http://www.gnu.org/licenses/agpl-3.0-standalone.html) + Credits ------- * Developer: Niyas Raphy @ cybrosys @@ -39,5 +47,3 @@ For support and more information, please visit `Our Website `__ - - diff --git a/total_payable_receivable/__manifest__.py b/total_payable_receivable/__manifest__.py index 2c912771c..ed3d89a6f 100644 --- a/total_payable_receivable/__manifest__.py +++ b/total_payable_receivable/__manifest__.py @@ -20,19 +20,21 @@ ############################################################################# { 'name': 'Payable And Receivable Amount', + 'version': '16.0.1.0.1', + 'category': 'Accounting', 'summary': """Amount Payable & Receivable In Partner Form""", - 'version': '16.0.1.0.0', 'description': """Amount Payable & Receivable In Partner Form""", 'author': 'Cybrosys Techno Solutions', 'company': 'Cybrosys Techno Solutions', + 'maintainer': 'Cybrosys Techno Solutions', 'website': 'https://www.cybrosys.com', - 'category': 'Accounting', 'depends': ['base', 'sale', 'purchase'], - 'license': 'AGPL-3', 'data': [ - 'views/total_payable_receivable_view.xml', + 'views/res_partner_views.xml', ], 'images': ['static/description/banner.png'], + 'license': 'AGPL-3', 'installable': True, 'auto_install': False, + 'application': False, } diff --git a/total_payable_receivable/doc/RELEASE_NOTES.md b/total_payable_receivable/doc/RELEASE_NOTES.md index 77d16c75f..d613de1ff 100644 --- a/total_payable_receivable/doc/RELEASE_NOTES.md +++ b/total_payable_receivable/doc/RELEASE_NOTES.md @@ -4,3 +4,8 @@ #### Version 16.0.1.0.0 #### ADD Initial commit for Payable And Receivable Amount + +#### 11.09.2023 +#### Version 16.0.1.0.1 +##### FIX +- Bug Fix: Updated the code according to the latest addons \ No newline at end of file diff --git a/total_payable_receivable/models/__init__.py b/total_payable_receivable/models/__init__.py index cf1aef625..029ec9712 100644 --- a/total_payable_receivable/models/__init__.py +++ b/total_payable_receivable/models/__init__.py @@ -18,4 +18,4 @@ # If not, see . # ############################################################################# -from . import total_payable_receivable +from . import res_partner diff --git a/total_payable_receivable/models/total_payable_receivable.py b/total_payable_receivable/models/res_partner.py similarity index 61% rename from total_payable_receivable/models/total_payable_receivable.py rename to total_payable_receivable/models/res_partner.py index d212e4792..127473697 100644 --- a/total_payable_receivable/models/total_payable_receivable.py +++ b/total_payable_receivable/models/res_partner.py @@ -18,45 +18,55 @@ # If not, see . # ############################################################################# - from odoo import api, models, fields class ResPartner(models.Model): _name = 'res.partner' _inherit = 'res.partner' + partner_credit = fields.Monetary(compute='credit_debit_get', + string='Total Receivable', + help="Total amount this customer owes you.") + partner_debit = fields.Monetary(compute='credit_debit_get', + string='Total Payable', + help= + "Total amount you have to pay to this vendor.") - partner_credit = fields.Monetary(compute='credit_debit_get',string='Total Receivable', help="Total amount this customer owes you.") - partner_debit = fields.Monetary(compute='credit_debit_get',string='Total Payable',help="Total amount you have to pay to this vendor.") - - - @api.depends_context('force_company') + @api.depends_context('company') def credit_debit_get(self): - # partner_debit = 0.0 - tables, where_clause, where_params = self.env['account.move.line'].with_context(state='posted', company_id=self.env.company.id)._query_get() + """ + Retrieve the total receivable and payable amounts from customers + for the current company. + """ + tables, where_clause, where_params = self.env['account.move.line']._where_calc( + [('parent_state', '=', 'posted'), + ('company_id', '=', self.env.company.id)]).get_sql() where_params = [tuple(self.ids)] + where_params if where_clause: where_clause = 'AND ' + where_clause - self._cr.execute("""SELECT account_move_line.partner_id, a.account_type, SUM(account_move_line.amount_residual) + self._cr.execute("""SELECT account_move_line.partner_id, a.account_type, + SUM(account_move_line.amount_residual) FROM """ + tables + """ - LEFT JOIN account_account a ON (account_move_line.account_id=a.id) - WHERE a.account_type IN ('asset_receivable','liability_payable') + LEFT JOIN account_account a ON + (account_move_line.account_id=a.id) + WHERE a.account_type IN + ('asset_receivable','liability_payable') AND account_move_line.partner_id IN %s AND account_move_line.reconciled IS FALSE """ + where_clause + """ GROUP BY account_move_line.partner_id, a.account_type """, where_params) treated = self.browse() - queryy = self.env.cr.dictfetchall() - for i in queryy: - partner = self.browse(i['partner_id']) - if i['account_type'] == 'asset_receivable': - self.partner_credit = i['sum'] + query = self.env.cr.dictfetchall() + for rec in query: + partner = self.browse(rec['partner_id']) + if rec['account_type'] == 'asset_receivable': + self.partner_credit = rec['sum'] if not self.partner_debit: self.partner_debit = False treated |= partner - elif i['account_type'] == 'liability_payable': - self.partner_debit = -i['sum'] + elif rec['account_type'] == 'liability_payable': + self.partner_debit = -rec['sum'] if not self.partner_credit: self.partner_credit = False treated |= partner diff --git a/total_payable_receivable/static/description/assets/modules/1.png b/total_payable_receivable/static/description/assets/modules/1.png index 5238bdeab..489f44e86 100644 Binary files a/total_payable_receivable/static/description/assets/modules/1.png and b/total_payable_receivable/static/description/assets/modules/1.png differ diff --git a/total_payable_receivable/static/description/assets/modules/2.png b/total_payable_receivable/static/description/assets/modules/2.png index 1ae7cfe3b..6d637752d 100644 Binary files a/total_payable_receivable/static/description/assets/modules/2.png and b/total_payable_receivable/static/description/assets/modules/2.png differ diff --git a/total_payable_receivable/static/description/assets/modules/3.png b/total_payable_receivable/static/description/assets/modules/3.png index 3c3ff1afb..dd2b151c6 100644 Binary files a/total_payable_receivable/static/description/assets/modules/3.png and b/total_payable_receivable/static/description/assets/modules/3.png differ diff --git a/total_payable_receivable/static/description/assets/modules/4.png b/total_payable_receivable/static/description/assets/modules/4.png index 3fae4631e..7b0ac4b33 100644 Binary files a/total_payable_receivable/static/description/assets/modules/4.png and b/total_payable_receivable/static/description/assets/modules/4.png differ diff --git a/total_payable_receivable/static/description/assets/modules/5.gif b/total_payable_receivable/static/description/assets/modules/5.gif deleted file mode 100644 index 2a5f8e659..000000000 Binary files a/total_payable_receivable/static/description/assets/modules/5.gif and /dev/null differ diff --git a/total_payable_receivable/static/description/assets/modules/5.jpg b/total_payable_receivable/static/description/assets/modules/5.jpg new file mode 100644 index 000000000..089a516a6 Binary files /dev/null and b/total_payable_receivable/static/description/assets/modules/5.jpg differ diff --git a/total_payable_receivable/static/description/assets/modules/6.png b/total_payable_receivable/static/description/assets/modules/6.png index 7f2815273..0c72000f2 100644 Binary files a/total_payable_receivable/static/description/assets/modules/6.png and b/total_payable_receivable/static/description/assets/modules/6.png differ diff --git a/total_payable_receivable/static/description/index.html b/total_payable_receivable/static/description/index.html index 8a72074b9..74a8ae91b 100644 --- a/total_payable_receivable/static/description/index.html +++ b/total_payable_receivable/static/description/index.html @@ -1,84 +1,95 @@ -
+
-
- +
+
+ class="mr-2"> Community
+ class="mr-2"> Enterprise
+ class="mr-2"> Odoo.sh
+
+
+
+ +

+ Payable And Receivable Amounts

+

+ It shows total payable & receivable amount in partner form

+ + +
+
+
- -

Payable And Receivable Amounts

-

It shows total payable & receivable amount in partner form

- -
-
+
- + style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> +
-

Explore This +

+ Explore This Module

@@ -86,15 +97,19 @@ -
+
- + style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> +
-

Overview +

+ Overview

-
+
Amount payable and receivable is shown in the partner form of each Customers and Vendors.
@@ -102,18 +117,23 @@ -
+
- + style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> +
-

Features +

+ Features

-
+
-
- +
+ Amount payable and receivable is shown in the partner form
@@ -121,24 +141,31 @@ -
+
- + style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> +
-

Screenshots +

+ Screenshots

-

Partner Form

-

Screenshot of the partner form is shown below. - The fields 'Total Payable' and 'Total Receivable' is inside the Sales & Purchase tab under the section Sales

+

+ Partner Form +

+

+ Screenshot of the partner form is shown below. + The fields 'Total Payable' and 'Total Receivable' is inside the Sales & Purchase tab under the section Sales +

-
@@ -160,7 +187,7 @@