diff --git a/return_invoice_bill/README.rst b/return_invoice_bill/README.rst index def96c15a..c78d2583c 100644 --- a/return_invoice_bill/README.rst +++ b/return_invoice_bill/README.rst @@ -2,9 +2,13 @@ :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 -Return Invoices And Bills -========================= -This module allow to return the invoice or bill while picking the product in Odoo15. +Automated Credit/Debit Note Generation from Return Picking +========================================================== +This module allow to return the invoice or bill while picking the product in Odoo16. + +Company +------- +* `Cybrosys Techno Solutions `__ Configuration ============= @@ -15,10 +19,6 @@ Installation - www.odoo.com/documentation/15.0/setup/install.html - Install our custom addon -Company -------- -* `Cybrosys Techno Solutions `__ - License ------- GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) @@ -26,7 +26,7 @@ GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) Credits ------- -Developer: (v15) Dhanya Babu, Contact: odoo@cybrosys.com +Developer: (v15) Dhanya Babu Contact: odoo@cybrosys.com Contacts -------- @@ -41,7 +41,6 @@ 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 `__ diff --git a/return_invoice_bill/__manifest__.py b/return_invoice_bill/__manifest__.py index 3536e376c..66b22483a 100644 --- a/return_invoice_bill/__manifest__.py +++ b/return_invoice_bill/__manifest__.py @@ -20,26 +20,27 @@ # ############################################################################## { - 'name': 'Return Invoices And Bills', - 'version': '15.0.1.0.0', - 'category': 'Sales', - 'summary': 'For creating credit note and debit note while picking.', - 'description': 'We can create credit note or debit note while return the' - ' picking by using this module in Odoo 15. ', - 'author': 'Cybrosys Techno Solutions', - 'company': 'Cybrosys Techno Solutions', - 'maintainer': 'Cybrosys Techno Solutions', - 'website': 'https://www.cybrosys.com', - 'depends': ['sale_management', 'stock', 'purchase'], - 'data': [ - 'security/ir.model.access.csv', - 'views/stock_picking_views.xml', - 'views/stock_return_picking_views.xml', - 'wizard/return_move_views.xml' + "name": "Automated Credit/Debit Note Generation from Return Picking", + "version": "15.0.1.1.1", + "category": "Sales", + "summary": "For creating credit note and debit note while picking.", + "description": "We can create credit note or debit note while return the" + " picking by using this module in Odoo 15. ", + "author": "Cybrosys Techno Solutions", + "company": "Cybrosys Techno Solutions", + "maintainer": "Cybrosys Techno Solutions", + "website": "https://www.cybrosys.com", + "depends": ["sale_management", "stock", "purchase"], + "data": [ + "security/ir.model.access.csv", + "views/account_move_views.xml", + "views/stock_picking_views.xml", + "views/stock_return_picking_views.xml", + "wizard/return_move_views.xml", ], - 'images': ['static/description/banner.png'], - 'license': 'AGPL-3', - 'installable': True, - 'auto_install': False, - 'application': False, + "images": ["static/description/banner.png"], + "license": "AGPL-3", + "installable": True, + "auto_install": False, + "application": False, } diff --git a/return_invoice_bill/doc/RELEASE_NOTES.md b/return_invoice_bill/doc/RELEASE_NOTES.md index 498db9f4a..8ec860ca2 100644 --- a/return_invoice_bill/doc/RELEASE_NOTES.md +++ b/return_invoice_bill/doc/RELEASE_NOTES.md @@ -1,7 +1,12 @@ ## Module -#### 27.01.2024 +#### 27.02.2024 #### Version 15.0.1.0.0 #### ADD +- Initial commit for Automated Credit/Debit Note Generation from Return Picking -- Initial commit for Return Invoices And Bills \ No newline at end of file +#### 21.08.2024 +#### Version 15.0.1.1.1 +#### UPDT +- Updated the return invoice line based on the return quantity. +- Fixed the issues while changing the language. \ No newline at end of file diff --git a/return_invoice_bill/models/__init__.py b/return_invoice_bill/models/__init__.py index b7f225ac2..1a82218ff 100644 --- a/return_invoice_bill/models/__init__.py +++ b/return_invoice_bill/models/__init__.py @@ -19,5 +19,6 @@ # If not, see . # ############################################################################## +from . import account_move from . import stock_picking from . import stock_return_picking diff --git a/return_invoice_bill/models/account_move.py b/return_invoice_bill/models/account_move.py new file mode 100644 index 000000000..0ff881034 --- /dev/null +++ b/return_invoice_bill/models/account_move.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Cybrosys Technologies Pvt. Ltd. +# +# Copyright (C) 2023-TODAY Cybrosys Technologies() +# Author: Dhanya Babu (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 . +# +############################################################################## +from odoo import fields, models + + +class AccountMove(models.Model): + _inherit = 'account.move' + + picking_id = fields.Many2one('stock.picking', "Picking Id", + help='Related Picking Id') diff --git a/return_invoice_bill/models/stock_picking.py b/return_invoice_bill/models/stock_picking.py index 0eee10ce7..c1e5ebe24 100644 --- a/return_invoice_bill/models/stock_picking.py +++ b/return_invoice_bill/models/stock_picking.py @@ -30,12 +30,16 @@ class StockPicking(models.Model): picking_type_name = fields.Char(string='Picking Type Name', help='Name of picking type') + is_paid = fields.Boolean(string='Is Paid', + help='Value will be True when order has paid ' + 'otherwise False.') @api.model def create(self, vals): """This method overrides the default create method to set the 'picking_type_name' field based on the 'picking_type_id' field before creating the record.""" + self.picking_type_name = self.picking_type_id.name return super(StockPicking, self).create(vals) @@ -43,24 +47,26 @@ class StockPicking(models.Model): """Generates an action to view reversal credit notes based on the context.""" self.ensure_one() - credit_notes = self.sale_id.invoice_ids.filtered( - lambda x: x.move_type == 'out_refund') + credit_notes = self.env['account.move'].search([ + ('picking_id', '=', self.id) + ]) return { 'type': 'ir.actions.act_window', 'name': _( 'Reversal of Credit Note: %s') % self.sale_id.invoice_ids.filtered( - lambda x: x.move_type == 'in_invoice').name, + lambda x: x.move_type == 'out_invoice').name, 'res_model': 'account.move', 'view_mode': 'tree,form', - 'domain': [('id', 'in', credit_notes.ids)] + 'domain': [('id', 'in', credit_notes.ids)], } def action_get_debit_note(self): """Generates an action to view reversal debit notes based on the context.""" - debit_notes = self.purchase_id.invoice_ids.filtered( - lambda x: x.move_type == 'in_refund') self.ensure_one() + debit_notes = self.env['account.move'].search([ + ('picking_id', '=', self.id) + ]) return { 'type': 'ir.actions.act_window', 'name': _( diff --git a/return_invoice_bill/models/stock_return_picking.py b/return_invoice_bill/models/stock_return_picking.py index 4ca57ec3b..6a70d103b 100644 --- a/return_invoice_bill/models/stock_return_picking.py +++ b/return_invoice_bill/models/stock_return_picking.py @@ -38,17 +38,54 @@ class StockReturnPicking(models.TransientModel): active_id = self.env.context['active_id'] if active_model == 'stock.picking' and active_id: stock_picking = self.env[active_model].browse(active_id) - result['picking_type_name'] = stock_picking.picking_type_id.name + picking_type = stock_picking.picking_type_id + result['picking_type_name'] = self.env['ir.model.data'].search([ + ('model', '=', 'stock.picking.type'), + ('res_id', '=', picking_type.id) + ]).complete_name return result + def _update_stock_picking(self): + """Update the 'is_paid' field of the active stock picking to indicate + payment. This function is typically called when processing returns with + credit or debit notes.""" + active_model = self.env.context.get('active_model') + active_id = self.env.context.get('active_id') + if active_model == 'stock.picking' and active_id: + stock_picking = self.env[active_model].browse(active_id) + stock_picking.is_paid = True + + def _get_return_action(self): + """ + Retrieve the action for returning a move, specifically for credit notes. + Returns: + ir.actions.actions: Action object for returning moves with credit + notes. + """ + return self.env["ir.actions.actions"]._for_xml_id( + "return_invoice_bill.return_move_action") + def action_returns_with_credit_note(self): - """Return wizard view ,To enter the cancel reason. """ - action = self.env["ir.actions.actions"]._for_xml_id( - "return_invoice_bill.action_return_move") - return action + move = self.read() + """ + Perform the action of returning moves with credit notes and update the + stock picking accordingly. + + Returns: + ir.actions.actions: Action object for returning moves with credit + notes. + """ + self._update_stock_picking() + return self._get_return_action() def action_returns_with_debit_note(self): - """Return wizard view ,To enter the cancel reason. """ - action = self.env["ir.actions.actions"]._for_xml_id( - "return_invoice_bill.action_return_move") - return action + """ + Perform the action of returning moves with debit notes and update the + stock picking accordingly. + + Returns: + ir.actions.actions: Action object for returning moves with debit + notes. + """ + self._update_stock_picking() + return self._get_return_action() diff --git a/return_invoice_bill/static/description/assets/modules/1.png b/return_invoice_bill/static/description/assets/modules/1.png index a5acbabc2..3add135c3 100644 Binary files a/return_invoice_bill/static/description/assets/modules/1.png and b/return_invoice_bill/static/description/assets/modules/1.png differ diff --git a/return_invoice_bill/static/description/assets/modules/2.png b/return_invoice_bill/static/description/assets/modules/2.png index 004c61a9e..4a9e2bd5d 100644 Binary files a/return_invoice_bill/static/description/assets/modules/2.png and b/return_invoice_bill/static/description/assets/modules/2.png differ diff --git a/return_invoice_bill/static/description/assets/modules/3.png b/return_invoice_bill/static/description/assets/modules/3.png index 6547c3081..25ed3e0b6 100644 Binary files a/return_invoice_bill/static/description/assets/modules/3.png and b/return_invoice_bill/static/description/assets/modules/3.png differ diff --git a/return_invoice_bill/static/description/assets/modules/4.png b/return_invoice_bill/static/description/assets/modules/4.png index 04d502e26..f14dc60c5 100644 Binary files a/return_invoice_bill/static/description/assets/modules/4.png and b/return_invoice_bill/static/description/assets/modules/4.png differ diff --git a/return_invoice_bill/static/description/assets/modules/5.png b/return_invoice_bill/static/description/assets/modules/5.png index 737c0a22f..690d071f9 100644 Binary files a/return_invoice_bill/static/description/assets/modules/5.png and b/return_invoice_bill/static/description/assets/modules/5.png differ diff --git a/return_invoice_bill/static/description/assets/modules/6.png b/return_invoice_bill/static/description/assets/modules/6.png index 09e2d45b2..8658f1826 100644 Binary files a/return_invoice_bill/static/description/assets/modules/6.png and b/return_invoice_bill/static/description/assets/modules/6.png differ diff --git a/return_invoice_bill/static/description/assets/screenshots/Screenshot(19).png b/return_invoice_bill/static/description/assets/screenshots/Screenshot(19).png new file mode 100644 index 000000000..39bb05fd2 Binary files /dev/null and b/return_invoice_bill/static/description/assets/screenshots/Screenshot(19).png differ diff --git a/return_invoice_bill/static/description/assets/screenshots/Screenshot(20).png b/return_invoice_bill/static/description/assets/screenshots/Screenshot(20).png new file mode 100644 index 000000000..46eda1515 Binary files /dev/null and b/return_invoice_bill/static/description/assets/screenshots/Screenshot(20).png differ diff --git a/return_invoice_bill/static/description/assets/screenshots/return7.png b/return_invoice_bill/static/description/assets/screenshots/return7.png deleted file mode 100644 index bc495a475..000000000 Binary files a/return_invoice_bill/static/description/assets/screenshots/return7.png and /dev/null differ diff --git a/return_invoice_bill/static/description/banner.png b/return_invoice_bill/static/description/banner.png index 469540f33..0df3d7507 100644 Binary files a/return_invoice_bill/static/description/banner.png and b/return_invoice_bill/static/description/banner.png differ diff --git a/return_invoice_bill/static/description/icon.png b/return_invoice_bill/static/description/icon.png index 29a841bff..9fadf403e 100644 Binary files a/return_invoice_bill/static/description/icon.png and b/return_invoice_bill/static/description/icon.png differ diff --git a/return_invoice_bill/static/description/index.html b/return_invoice_bill/static/description/index.html index 05079e500..cc2124250 100644 --- a/return_invoice_bill/static/description/index.html +++ b/return_invoice_bill/static/description/index.html @@ -28,7 +28,7 @@

- Return Invoices And Bills

+ Automated Credit/Debit Note Generation from Return Picking

Allows Us To Return The Credit Note And Debit Note From The Corresponding Return Form .

@@ -134,21 +134,18 @@
- Community & - Enterprise Support. + Community & Enterprise Support.
Create the credit note while returning the product .
-
Create the debit note while receiving the product .
-
@@ -179,7 +176,6 @@
-

Create a Sale Order.

@@ -208,7 +204,7 @@ Confirm the Invoice.

- Form view of Invoice.

+ Form view of Invoice. Invoice should be posted.

@@ -218,16 +214,14 @@ By clicking the RETURN Button we will get a wizard.

-

We can return the product and invoice by clicking the RETURN WITH CREDIT NOTE Button.

-
-

Specify the Return Reason. @@ -275,7 +269,14 @@ Validate the Receipt.

-
+
+

+ We can return the product and bill clicking the RETURN WITH + DEBIT NOTE Button. +

+ +

Specify the Reason.

@@ -297,9 +298,114 @@
- - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-
@@ -498,7 +603,6 @@ Odoo Consultancy
-
diff --git a/return_invoice_bill/views/account_move_views.xml b/return_invoice_bill/views/account_move_views.xml new file mode 100644 index 000000000..0d79619e8 --- /dev/null +++ b/return_invoice_bill/views/account_move_views.xml @@ -0,0 +1,14 @@ + + + + + account.move.view.form.inherit.return.invoice.bill + account.move + + + + + + + + diff --git a/return_invoice_bill/views/stock_picking_views.xml b/return_invoice_bill/views/stock_picking_views.xml index 812173877..7adbfff71 100644 --- a/return_invoice_bill/views/stock_picking_views.xml +++ b/return_invoice_bill/views/stock_picking_views.xml @@ -7,16 +7,16 @@ stock.picking - + +