Browse Source

Aug 30 [UPDT] Updated 'return_invoice_bill'

pull/254/merge
AjmalCybro 8 months ago
parent
commit
2747a21ea6
  1. 17
      return_invoice_bill/README.rst
  2. 43
      return_invoice_bill/__manifest__.py
  3. 9
      return_invoice_bill/doc/RELEASE_NOTES.md
  4. 1
      return_invoice_bill/models/__init__.py
  5. 29
      return_invoice_bill/models/account_move.py
  6. 18
      return_invoice_bill/models/stock_picking.py
  7. 55
      return_invoice_bill/models/stock_return_picking.py
  8. BIN
      return_invoice_bill/static/description/assets/modules/1.png
  9. BIN
      return_invoice_bill/static/description/assets/modules/2.png
  10. BIN
      return_invoice_bill/static/description/assets/modules/3.png
  11. BIN
      return_invoice_bill/static/description/assets/modules/4.png
  12. BIN
      return_invoice_bill/static/description/assets/modules/5.png
  13. BIN
      return_invoice_bill/static/description/assets/modules/6.png
  14. BIN
      return_invoice_bill/static/description/assets/screenshots/Screenshot(19).png
  15. BIN
      return_invoice_bill/static/description/assets/screenshots/Screenshot(20).png
  16. BIN
      return_invoice_bill/static/description/assets/screenshots/return7.png
  17. BIN
      return_invoice_bill/static/description/banner.png
  18. BIN
      return_invoice_bill/static/description/icon.png
  19. 158
      return_invoice_bill/static/description/index.html
  20. 14
      return_invoice_bill/views/account_move_views.xml
  21. 14
      return_invoice_bill/views/stock_picking_views.xml
  22. 6
      return_invoice_bill/views/stock_return_picking_views.xml
  23. 52
      return_invoice_bill/wizard/return_move.py
  24. 4
      return_invoice_bill/wizard/return_move_views.xml

17
return_invoice_bill/README.rst

@ -2,9 +2,13 @@
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3 :alt: License: AGPL-3
Return Invoices And Bills Automated Credit/Debit Note Generation from Return Picking
========================= ==========================================================
This module allow to return the invoice or bill while picking the product in Odoo15. This module allow to return the invoice or bill while picking the product in Odoo16.
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
Configuration Configuration
============= =============
@ -15,10 +19,6 @@ Installation
- www.odoo.com/documentation/15.0/setup/install.html - www.odoo.com/documentation/15.0/setup/install.html
- Install our custom addon - Install our custom addon
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
License License
------- -------
GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3)
@ -26,7 +26,7 @@ GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3)
Credits Credits
------- -------
Developer: (v15) Dhanya Babu, Contact: odoo@cybrosys.com Developer: (v15) Dhanya Babu Contact: odoo@cybrosys.com
Contacts Contacts
-------- --------
@ -41,7 +41,6 @@ Maintainer
========== ==========
.. image:: https://cybrosys.com/images/logo.png .. image:: https://cybrosys.com/images/logo.png
:target: https://cybrosys.com :target: https://cybrosys.com
This module is maintained by Cybrosys Technologies. This module is maintained by Cybrosys Technologies.
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ For support and more information, please visit `Our Website <https://cybrosys.com/>`__

43
return_invoice_bill/__manifest__.py

@ -20,26 +20,27 @@
# #
############################################################################## ##############################################################################
{ {
'name': 'Return Invoices And Bills', "name": "Automated Credit/Debit Note Generation from Return Picking",
'version': '15.0.1.0.0', "version": "15.0.1.1.1",
'category': 'Sales', "category": "Sales",
'summary': 'For creating credit note and debit note while picking.', "summary": "For creating credit note and debit note while picking.",
'description': 'We can create credit note or debit note while return the' "description": "We can create credit note or debit note while return the"
' picking by using this module in Odoo 15. ', " picking by using this module in Odoo 15. ",
'author': 'Cybrosys Techno Solutions', "author": "Cybrosys Techno Solutions",
'company': 'Cybrosys Techno Solutions', "company": "Cybrosys Techno Solutions",
'maintainer': 'Cybrosys Techno Solutions', "maintainer": "Cybrosys Techno Solutions",
'website': 'https://www.cybrosys.com', "website": "https://www.cybrosys.com",
'depends': ['sale_management', 'stock', 'purchase'], "depends": ["sale_management", "stock", "purchase"],
'data': [ "data": [
'security/ir.model.access.csv', "security/ir.model.access.csv",
'views/stock_picking_views.xml', "views/account_move_views.xml",
'views/stock_return_picking_views.xml', "views/stock_picking_views.xml",
'wizard/return_move_views.xml' "views/stock_return_picking_views.xml",
"wizard/return_move_views.xml",
], ],
'images': ['static/description/banner.png'], "images": ["static/description/banner.png"],
'license': 'AGPL-3', "license": "AGPL-3",
'installable': True, "installable": True,
'auto_install': False, "auto_install": False,
'application': False, "application": False,
} }

9
return_invoice_bill/doc/RELEASE_NOTES.md

@ -1,7 +1,12 @@
## Module <return_invoice_bill> ## Module <return_invoice_bill>
#### 27.01.2024 #### 27.02.2024
#### Version 15.0.1.0.0 #### Version 15.0.1.0.0
#### ADD #### ADD
- Initial commit for Automated Credit/Debit Note Generation from Return Picking
- Initial commit for Return Invoices And Bills #### 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.

1
return_invoice_bill/models/__init__.py

@ -19,5 +19,6 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from . import account_move
from . import stock_picking from . import stock_picking
from . import stock_return_picking from . import stock_return_picking

29
return_invoice_bill/models/account_move.py

@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
#
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>)
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import fields, models
class AccountMove(models.Model):
_inherit = 'account.move'
picking_id = fields.Many2one('stock.picking', "Picking Id",
help='Related Picking Id')

18
return_invoice_bill/models/stock_picking.py

@ -30,12 +30,16 @@ class StockPicking(models.Model):
picking_type_name = fields.Char(string='Picking Type Name', picking_type_name = fields.Char(string='Picking Type Name',
help='Name of picking type') 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 @api.model
def create(self, vals): def create(self, vals):
"""This method overrides the default create method to set the """This method overrides the default create method to set the
'picking_type_name' field based on the 'picking_type_id' field 'picking_type_name' field based on the 'picking_type_id' field
before creating the record.""" before creating the record."""
self.picking_type_name = self.picking_type_id.name self.picking_type_name = self.picking_type_id.name
return super(StockPicking, self).create(vals) return super(StockPicking, self).create(vals)
@ -43,24 +47,26 @@ class StockPicking(models.Model):
"""Generates an action to view reversal credit notes """Generates an action to view reversal credit notes
based on the context.""" based on the context."""
self.ensure_one() self.ensure_one()
credit_notes = self.sale_id.invoice_ids.filtered( credit_notes = self.env['account.move'].search([
lambda x: x.move_type == 'out_refund') ('picking_id', '=', self.id)
])
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'name': _( 'name': _(
'Reversal of Credit Note: %s') % self.sale_id.invoice_ids.filtered( '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', 'res_model': 'account.move',
'view_mode': 'tree,form', 'view_mode': 'tree,form',
'domain': [('id', 'in', credit_notes.ids)] 'domain': [('id', 'in', credit_notes.ids)],
} }
def action_get_debit_note(self): def action_get_debit_note(self):
"""Generates an action to view reversal debit notes """Generates an action to view reversal debit notes
based on the context.""" based on the context."""
debit_notes = self.purchase_id.invoice_ids.filtered(
lambda x: x.move_type == 'in_refund')
self.ensure_one() self.ensure_one()
debit_notes = self.env['account.move'].search([
('picking_id', '=', self.id)
])
return { return {
'type': 'ir.actions.act_window', 'type': 'ir.actions.act_window',
'name': _( 'name': _(

55
return_invoice_bill/models/stock_return_picking.py

@ -38,17 +38,54 @@ class StockReturnPicking(models.TransientModel):
active_id = self.env.context['active_id'] active_id = self.env.context['active_id']
if active_model == 'stock.picking' and active_id: if active_model == 'stock.picking' and active_id:
stock_picking = self.env[active_model].browse(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 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): def action_returns_with_credit_note(self):
"""Return wizard view ,To enter the cancel reason. """ move = self.read()
action = self.env["ir.actions.actions"]._for_xml_id( """
"return_invoice_bill.action_return_move") Perform the action of returning moves with credit notes and update the
return action 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): def action_returns_with_debit_note(self):
"""Return wizard view ,To enter the cancel reason. """ """
action = self.env["ir.actions.actions"]._for_xml_id( Perform the action of returning moves with debit notes and update the
"return_invoice_bill.action_return_move") stock picking accordingly.
return action
Returns:
ir.actions.actions: Action object for returning moves with debit
notes.
"""
self._update_stock_picking()
return self._get_return_action()

BIN
return_invoice_bill/static/description/assets/modules/1.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 82 KiB

BIN
return_invoice_bill/static/description/assets/modules/2.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 18 KiB

BIN
return_invoice_bill/static/description/assets/modules/3.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 79 KiB

BIN
return_invoice_bill/static/description/assets/modules/4.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 88 KiB

BIN
return_invoice_bill/static/description/assets/modules/5.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 96 KiB

BIN
return_invoice_bill/static/description/assets/modules/6.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 15 KiB

BIN
return_invoice_bill/static/description/assets/screenshots/Screenshot(19).png

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
return_invoice_bill/static/description/assets/screenshots/Screenshot(20).png

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
return_invoice_bill/static/description/assets/screenshots/return7.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

BIN
return_invoice_bill/static/description/banner.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 84 KiB

BIN
return_invoice_bill/static/description/icon.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 17 KiB

158
return_invoice_bill/static/description/index.html

@ -28,7 +28,7 @@
<div class="col-sm-12 col-md-12 col-lg-12"> <div class="col-sm-12 col-md-12 col-lg-12">
<!-- APP HERO --> <!-- APP HERO -->
<h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;"> <h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;">
Return Invoices And Bills</h1> Automated Credit/Debit Note Generation from Return Picking</h1>
<p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;"> <p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;">
Allows Us To Return The Credit Note And Debit Note From The Allows Us To Return The Credit Note And Debit Note From The
Corresponding Return Form .</p> Corresponding Return Form .</p>
@ -134,21 +134,18 @@
<div class="d-flex align-items-center" <div class="d-flex align-items-center"
style="margin-top: 40px; margin-bottom: 40px"> style="margin-top: 40px; margin-bottom: 40px">
<img src="assets/misc/check-box.png" class="mr-2"/> <img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Community &amp; <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Community &amp; Enterprise Support.</span>
Enterprise Support.</span>
</div> </div>
<div class="d-flex align-items-center" <div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px"> style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/> <img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Create the credit note while returning the product .</span> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Create the credit note while returning the product .</span>
</div> </div>
<div class="d-flex align-items-center" <div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px"> style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/> <img src="assets/misc/check-box.png" class="mr-2"/>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Create the debit note while receiving the product .</span> <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Create the debit note while receiving the product .</span>
</div> </div>
<div class="d-flex align-items-center" <div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px"> style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/> <img src="assets/misc/check-box.png" class="mr-2"/>
@ -179,7 +176,6 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col-sm-12"> <div class="col-sm-12">
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Create a Sale Order. </h3> Create a Sale Order. </h3>
@ -208,7 +204,7 @@
Confirm the Invoice. Confirm the Invoice.
</h3> </h3>
<p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;"> <p style="font-weight: 400; font-family: 'Montserrat', sans-serif; font-size: 14px;">
Form view of Invoice.</p> Form view of Invoice. Invoice should be posted.</p>
<img src="assets/screenshots/return5.png" class="img-thumbnail"> <img src="assets/screenshots/return5.png" class="img-thumbnail">
</div> </div>
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
@ -218,16 +214,14 @@
By clicking the RETURN Button we will get a wizard.</p> By clicking the RETURN Button we will get a wizard.</p>
<img src="assets/screenshots/return6.png" class="img-thumbnail"> <img src="assets/screenshots/return6.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
We can return the product and invoice by clicking the RETURN WITH We can return the product and invoice by clicking the RETURN WITH
CREDIT NOTE Button. CREDIT NOTE Button.
</h3> </h3>
<img src="assets/screenshots/return7.png" <img src="assets/screenshots/Screenshot(19).png"
class="img-thumbnail"/> class="img-thumbnail"/>
</div> </div>
<div> <div>
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Specify the Return Reason. Specify the Return Reason.
@ -275,7 +269,14 @@
Validate the Receipt.</p> Validate the Receipt.</p>
<img src="assets/screenshots/return14.png" class="img-thumbnail"> <img src="assets/screenshots/return14.png" class="img-thumbnail">
</div> </div>
<div style="display: block; margin: 30px auto;"> <div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
We can return the product and bill clicking the RETURN WITH
DEBIT NOTE Button.
</h3>
<img src="assets/screenshots/Screenshot(20).png"
class="img-thumbnail"/>
</div> <div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Specify the Reason. Specify the Reason.
</h3> </h3>
@ -297,9 +298,114 @@
</h3> </h3>
<img src="assets/screenshots/return177.png" class="img-thumbnail"> <img src="assets/screenshots/return177.png" class="img-thumbnail">
</div> </div>
<!-- END OF SCREENSHOTS SECTION --> <!-- END OF SCREENSHOTS SECTION -->
<!-- RELATED PRODUCTS --> <!-- &lt;!&ndash; RELATED PRODUCTS &ndash;&gt;-->
<!-- <div class="d-flex align-items-center"-->
<!-- style="border-bottom: 2px solid #714B67; padding: 15px 0px;">-->
<!-- <div class="d-flex justify-content-center align-items-center mr-2"-->
<!-- style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;">-->
<!-- <img src="assets/misc/categories.png"/>-->
<!-- </div>-->
<!-- <h2 class="mt-2"-->
<!-- style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;">-->
<!-- Related-->
<!-- Products-->
<!-- </h2>-->
<!-- </div>-->
<!-- <div class="row">-->
<!-- <div class="col-sm-12">-->
<!-- <div id="demo1" class="row carousel slide" data-ride="carousel">-->
<!-- &lt;!&ndash; The slideshow &ndash;&gt;-->
<!-- <div class="carousel-inner" style="padding:30px">-->
<!-- <div class="carousel-item" style="min-height:198.656px">-->
<!-- <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"-->
<!-- style="float:left">-->
<!-- <a href="https://apps.odoo.com/apps/modules/15.0/sale_discount_total/"-->
<!-- target="_blank">-->
<!-- <div style="border-radius:10px">-->
<!-- <img class="img img-responsive center-block"-->
<!-- style="border-radius:0px"-->
<!-- src="assets/modules/2.png">-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"-->
<!-- style="float:left">-->
<!-- <a href="https://apps.odoo.com/apps/modules/15.0/crm_dashboard/"-->
<!-- target="_blank">-->
<!-- <div style="border-radius:10px">-->
<!-- <img class="img img-responsive center-block"-->
<!-- style="border-radius:0px"-->
<!-- src="assets/modules/3.png">-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"-->
<!-- style="float:left">-->
<!-- <a href="https://apps.odoo.com/apps/modules/15.0/subscription_package/"-->
<!-- target="_blank">-->
<!-- <div style="border-radius:10px">-->
<!-- <img class="img img-responsive center-block"-->
<!-- style="border-radius:0px"-->
<!-- src="assets/modules/1.png">-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="carousel-item active"-->
<!-- style="min-height:198.656px">-->
<!-- <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"-->
<!-- style="float:left">-->
<!-- <a href="https://apps.odoo.com/apps/modules/15.0/barcode_scanning_sale_purchase/"-->
<!-- target="_blank">-->
<!-- <div style="border-radius:10px">-->
<!-- <img class="img img-responsive center-block"-->
<!-- style="border-radius:0px"-->
<!-- src="assets/modules/4.png">-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"-->
<!-- style="float:left">-->
<!-- <a href="https://apps.odoo.com/apps/modules/15.0/amount_in_words_invoice/#"-->
<!-- target="_blank">-->
<!-- <div style="border-radius:10px">-->
<!-- <img class="img img-responsive center-block"-->
<!-- style="border-radius:0px"-->
<!-- src="assets/modules/5.png">-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"-->
<!-- style="float:left">-->
<!-- <a href="https://apps.odoo.com/apps/modules/15.0/sale_product_image/"-->
<!-- target="_blank">-->
<!-- <div style="border-radius:10px">-->
<!-- <img class="img img-responsive center-block"-->
<!-- style="border-radius:0px"-->
<!-- src="assets/modules/6.png">-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- &lt;!&ndash; Left and right controls &ndash;&gt;-->
<!-- <a class="carousel-control-prev" href="#demo1"-->
<!-- data-slide="prev" style="width:35px; color:#000"> <span-->
<!-- class="carousel-control-prev-icon"><i-->
<!-- class="fa fa-chevron-left"-->
<!-- style="font-size:24px"></i></span>-->
<!-- </a> <a class="carousel-control-next" href="#demo1"-->
<!-- data-slide="next" style="width:35px; color:#000">-->
<!-- <span class="carousel-control-next-icon"><i-->
<!-- class="fa fa-chevron-right"-->
<!-- style="font-size:24px"></i></span>-->
<!-- </a>-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
<!-- &lt;!&ndash; END OF RELATED PRODUCTS &ndash;&gt;-->
<!-- RELATED PRODUCTS -->
<div class="d-flex align-items-center" <div class="d-flex align-items-center"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<div class="d-flex justify-content-center align-items-center mr-2" <div class="d-flex justify-content-center align-items-center mr-2"
@ -320,34 +426,34 @@
<div class="carousel-item" style="min-height:198.656px"> <div class="carousel-item" style="min-height:198.656px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left"> style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/sale_discount_total/" <a href="https://apps.odoo.com/apps/modules/16.0/sale_discount_total/"
target="_blank"> target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" <img class="img img-responsive center-block"
style="border-radius:0px" style="border-radius:0px"
src="assets/modules/2.png"> src="./assets/modules/1.png">
</div> </div>
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left"> style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/crm_dashboard/" <a href="https://apps.odoo.com/apps/modules/16.0/subscription_package/"
target="_blank"> target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" <img class="img img-responsive center-block"
style="border-radius:0px" style="border-radius:0px"
src="assets/modules/3.png"> src="./assets/modules/2.png">
</div> </div>
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left"> style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/subscription_package/" <a href="https://apps.odoo.com/apps/modules/16.0/crm_dashboard/"
target="_blank"> target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" <img class="img img-responsive center-block"
style="border-radius:0px" style="border-radius:0px"
src="assets/modules/1.png"> src="./assets/modules/3.png">
</div> </div>
</a> </a>
</div> </div>
@ -356,34 +462,34 @@
style="min-height:198.656px"> style="min-height:198.656px">
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left"> style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/barcode_scanning_sale_purchase/" <a href="https://apps.odoo.com/apps/modules/16.0/barcode_scanning_sale_purchase/"
target="_blank"> target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" <img class="img img-responsive center-block"
style="border-radius:0px" style="border-radius:0px"
src="assets/modules/4.png"> src="./assets/modules/4.png">
</div> </div>
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left"> style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/amount_in_words_invoice/#" <a href="https://apps.odoo.com/apps/modules/16.0/amount_in_words_invoice/#"
target="_blank"> target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" <img class="img img-responsive center-block"
style="border-radius:0px" style="border-radius:0px"
src="assets/modules/5.png"> src="./assets/modules/5.png">
</div> </div>
</a> </a>
</div> </div>
<div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16"
style="float:left"> style="float:left">
<a href="https://apps.odoo.com/apps/modules/15.0/sale_product_image/" <a href="https://apps.odoo.com/apps/modules/16.0/sale_report_advanced/"
target="_blank"> target="_blank">
<div style="border-radius:10px"> <div style="border-radius:10px">
<img class="img img-responsive center-block" <img class="img img-responsive center-block"
style="border-radius:0px" style="border-radius:0px"
src="assets/modules/6.png"> src="./assets/modules/6.png">
</div> </div>
</a> </a>
</div> </div>
@ -464,7 +570,6 @@
Odoo Odoo
Developer</h6> Developer</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -498,7 +603,6 @@
Odoo Odoo
Consultancy</h6> Consultancy</h6>
</div> </div>
<div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4">
<div class="d-flex justify-content-center align-items-center mx-3 my-3" <div class="d-flex justify-content-center align-items-center mx-3 my-3"
style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;"> style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;">

14
return_invoice_bill/views/account_move_views.xml

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<!-- Adding picking field in account.move model.-->
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.view.form.inherit.return.invoice.bill</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='invoice_date']" position="after">
<field name="picking_id"/>
</xpath>
</field>
</record>
</odoo>

14
return_invoice_bill/views/stock_picking_views.xml

@ -7,16 +7,16 @@
<field name="model">stock.picking</field> <field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/> <field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//div[hasclass('oe_button_box')]" position="inside"> <xpath expr="//button[@name='action_picking_move_tree']"
position="after">
<field name="picking_type_name" invisible="1"/> <field name="picking_type_name" invisible="1"/>
<field name="is_paid" invisible="1"/>
<button name="action_get_credit_note" string="Credit Notes" <button name="action_get_credit_note" string="Credit Notes"
type="object" class="oe_stat_button" type="object"
icon="fa-credit-card" attrs="{'invisible': ['|',('picking_type_name', '!=', 'Delivery Orders'), ('is_paid', '=', False)]}"/>
attrs="{'invisible': [('picking_type_name', '!=', 'Delivery Orders')]}"/>
<button name="action_get_debit_note" string="Debit Notes" <button name="action_get_debit_note" string="Debit Notes"
type="object" class="oe_stat_button" type="object"
icon="fa-credit-card" attrs="{'invisible': ['|',('picking_type_name', '!=', 'Receipts'), ('is_paid', '=', False)]}"/>
attrs="{'invisible': [('picking_type_name', '!=', 'Receipts')]}"/>
</xpath> </xpath>
</field> </field>
</record> </record>

6
return_invoice_bill/views/stock_return_picking_views.xml

@ -3,7 +3,7 @@
<!-- Button to view the cancel reason --> <!-- Button to view the cancel reason -->
<record id="view_stock_return_picking_form" model="ir.ui.view"> <record id="view_stock_return_picking_form" model="ir.ui.view">
<field name="name"> <field name="name">
return.stock.return.picking.view.form.inherit.return.invoice.bill stock.return.picking.view.form.inherit.return.invoice.bill
</field> </field>
<field name="model">stock.return.picking</field> <field name="model">stock.return.picking</field>
<field name="inherit_id" ref="stock.view_stock_return_picking_form"/> <field name="inherit_id" ref="stock.view_stock_return_picking_form"/>
@ -12,11 +12,11 @@
<field name="picking_type_name" invisible="1"/> <field name="picking_type_name" invisible="1"/>
<button name="action_returns_with_credit_note" <button name="action_returns_with_credit_note"
string="Return With Credit Note" type="object" string="Return With Credit Note" type="object"
attrs="{'invisible': [('picking_type_name', '!=', 'Delivery Orders')]}"/> attrs="{'invisible': [('picking_type_name', '!=', 'stock.picking_type_out')]}"/>
<button name="action_returns_with_debit_note" <button name="action_returns_with_debit_note"
string="Return With Debit Note" string="Return With Debit Note"
type="object" type="object"
attrs="{'invisible': [('picking_type_name', '!=', 'Receipts')]}"/> attrs="{'invisible': [('picking_type_name', '!=', 'stock.picking_type_in')]}"/>
</xpath> </xpath>
</field> </field>
</record> </record>

52
return_invoice_bill/wizard/return_move.py

@ -19,35 +19,59 @@
# If not, see <http://www.gnu.org/licenses/>. # If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError, UserError
from odoo import models, fields from odoo import fields, models, _
class ReturnMove(models.TransientModel): class ReturnMove(models.TransientModel):
"""Transient model for ,enter the cancel reason credit and debit note.""" """Transient model for ,enter the cancel reason credit and debit note."""
_name = 'return.move' _name = 'return.move'
_description = 'Return Move' _description = 'Return Move'
_rec_name = 'reason'
reason = fields.Char(string='Reason', reason = fields.Char(string='Reason',
help='Specify the reason for credit note', help='Specify the reason for credit note',
required=True) required=True)
def apply_reverse_entry(self):
"""Returning the invoice or bill and create credit and debit note. """ def action_apply_reverse_entry(self):
"""Returning the invoice or bill and create credit and debit note."""
active_id = self.env.context['active_id'] active_id = self.env.context['active_id']
return_id = self.env['stock.return.picking'].browse(active_id) return_id = self.env['stock.return.picking'].browse(active_id)
return_id.create_returns() return_data = return_id.create_returns()
return_picking = self.env['stock.picking'].browse(return_data.get('res_id'))
return_picking.action_set_quantities_to_reservation()
return_picking.button_validate()
if return_id.picking_id.sale_id.invoice_ids or return_id.picking_id.purchase_id.invoice_ids: if return_id.picking_id.sale_id.invoice_ids or return_id.picking_id.purchase_id.invoice_ids:
if return_id.picking_id.picking_type_code == 'outgoing': for invoice in (
reverse_move = return_id.picking_id.sale_id.invoice_ids._reverse_moves() return_id.picking_id.sale_id.invoice_ids + return_id.picking_id.purchase_id.invoice_ids):
reverse_move._post(soft=False) if invoice.reversed_entry_id:
return raise ValidationError(
reverse_move = return_id.picking_id.purchase_id.invoice_ids._reverse_moves() "The selected invoice has already been reversed.")
reverse_move.write({ move_type = 'out_refund' if return_id.picking_id.picking_type_code == 'outgoing' else 'in_refund'
'invoice_date': fields.date.today()
reverse_move = self.env['account.move'].create({
'partner_id': return_picking.partner_id.id,
'move_type': move_type,
'picking_id':return_id.picking_id.id,
'invoice_date': return_picking.date_done,
'ref': _('Reversal of Credit Notes: %s, %s') % (invoice.name,self.reason),
'invoice_line_ids': [
(0, 0, {
'product_id': rec.product_id.id,
'name': rec.product_id.name,
'quantity': rec.quantity_done,
'price_unit': rec.product_id.list_price,
'price_subtotal': rec.quantity_done * rec.product_id.list_price,
}) for rec in return_picking.move_ids_without_package]
}) })
reverse_move._post(soft=False) reverse_move.action_post()
return {
'type': 'ir.actions.act_window',
'view_mode': 'form',
'res_model': 'account.move',
'target': 'current',
'res_id': reverse_move.id,
}
else: else:
raise ValidationError( raise ValidationError(
"The selected picking should have at least one invoice.") "The selected picking should have at least one invoice.")

4
return_invoice_bill/wizard/return_move_views.xml

@ -12,7 +12,7 @@
<footer> <footer>
<button string="Apply Reverse Entry" class="btn-primary" <button string="Apply Reverse Entry" class="btn-primary"
type="object" type="object"
name="apply_reverse_entry"/> name="action_apply_reverse_entry"/>
<button string="Cancel" class="btn-secondary" <button string="Cancel" class="btn-secondary"
special="cancel"/> special="cancel"/>
</footer> </footer>
@ -21,7 +21,7 @@
</record> </record>
<!-- This XML code defines an action for opening a window to interact with "return.move" records. <!-- This XML code defines an action for opening a window to interact with "return.move" records.
The action is intended to display the return move records in a new form view window.--> The action is intended to display the return move records in a new form view window.-->
<record id="action_return_move" model="ir.actions.act_window"> <record id="return_move_action" model="ir.actions.act_window">
<field name="name">Return Moves</field> <field name="name">Return Moves</field>
<field name="res_model">return.move</field> <field name="res_model">return.move</field>
<field name="view_mode">form</field> <field name="view_mode">form</field>

Loading…
Cancel
Save