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
: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 <https://cybrosys.com/>`__
Configuration
=============
@ -15,10 +19,6 @@ Installation
- www.odoo.com/documentation/15.0/setup/install.html
- Install our custom addon
Company
-------
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__
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 <https://cybrosys.com/>`__

43
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,
}

9
return_invoice_bill/doc/RELEASE_NOTES.md

@ -1,7 +1,12 @@
## Module <return_invoice_bill>
#### 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
#### 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/>.
#
##############################################################################
from . import account_move
from . import stock_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',
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': _(

55
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()

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">
<!-- APP HERO -->
<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;">
Allows Us To Return The Credit Note And Debit Note From The
Corresponding Return Form .</p>
@ -134,21 +134,18 @@
<div class="d-flex align-items-center"
style="margin-top: 40px; margin-bottom: 40px">
<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;
Enterprise Support.</span>
<span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Community &amp; Enterprise Support.</span>
</div>
<div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px">
<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>
</div>
<div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px">
<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>
</div>
<div class="d-flex align-items-center"
style="margin-top: 30px; margin-bottom: 30px">
<img src="assets/misc/check-box.png" class="mr-2"/>
@ -179,7 +176,6 @@
</div>
<div class="row">
<div class="col-sm-12">
<div style="display: block; margin: 30px auto;">
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Create a Sale Order. </h3>
@ -208,7 +204,7 @@
Confirm the Invoice.
</h3>
<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">
</div>
<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>
<img src="assets/screenshots/return6.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;">
We can return the product and invoice by clicking the RETURN WITH
CREDIT NOTE Button.
</h3>
<img src="assets/screenshots/return7.png"
<img src="assets/screenshots/Screenshot(19).png"
class="img-thumbnail"/>
</div>
<div>
<h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">
Specify the Return Reason.
@ -275,7 +269,14 @@
Validate the Receipt.</p>
<img src="assets/screenshots/return14.png" class="img-thumbnail">
</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;">
Specify the Reason.
</h3>
@ -297,9 +298,114 @@
</h3>
<img src="assets/screenshots/return177.png" class="img-thumbnail">
</div>
<!-- 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"
style="border-bottom: 2px solid #714B67; padding: 15px 0px;">
<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="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/"
<a href="https://apps.odoo.com/apps/modules/16.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">
src="./assets/modules/1.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/"
<a href="https://apps.odoo.com/apps/modules/16.0/subscription_package/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius:0px"
src="assets/modules/3.png">
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/subscription_package/"
<a href="https://apps.odoo.com/apps/modules/16.0/crm_dashboard/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius:0px"
src="assets/modules/1.png">
src="./assets/modules/3.png">
</div>
</a>
</div>
@ -356,34 +462,34 @@
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/"
<a href="https://apps.odoo.com/apps/modules/16.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">
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/#"
<a href="https://apps.odoo.com/apps/modules/16.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">
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/"
<a href="https://apps.odoo.com/apps/modules/16.0/sale_report_advanced/"
target="_blank">
<div style="border-radius:10px">
<img class="img img-responsive center-block"
style="border-radius:0px"
src="assets/modules/6.png">
src="./assets/modules/6.png">
</div>
</a>
</div>
@ -464,7 +570,6 @@
Odoo
Developer</h6>
</div>
<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"
style="background-color: #54a0ff !important; border-radius: 15px !important; height: 80px; width: 80px;">
@ -498,7 +603,6 @@
Odoo
Consultancy</h6>
</div>
<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"
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="inherit_id" ref="stock.view_picking_form"/>
<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="is_paid" invisible="1"/>
<button name="action_get_credit_note" string="Credit Notes"
type="object" class="oe_stat_button"
icon="fa-credit-card"
attrs="{'invisible': [('picking_type_name', '!=', 'Delivery Orders')]}"/>
type="object"
attrs="{'invisible': ['|',('picking_type_name', '!=', 'Delivery Orders'), ('is_paid', '=', False)]}"/>
<button name="action_get_debit_note" string="Debit Notes"
type="object" class="oe_stat_button"
icon="fa-credit-card"
attrs="{'invisible': [('picking_type_name', '!=', 'Receipts')]}"/>
type="object"
attrs="{'invisible': ['|',('picking_type_name', '!=', 'Receipts'), ('is_paid', '=', False)]}"/>
</xpath>
</field>
</record>

6
return_invoice_bill/views/stock_return_picking_views.xml

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

52
return_invoice_bill/wizard/return_move.py

@ -19,35 +19,59 @@
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo.exceptions import ValidationError
from odoo import models, fields
from odoo.exceptions import ValidationError, UserError
from odoo import fields, models, _
class ReturnMove(models.TransientModel):
"""Transient model for ,enter the cancel reason credit and debit note."""
_name = 'return.move'
_description = 'Return Move'
_rec_name = 'reason'
reason = fields.Char(string='Reason',
help='Specify the reason for credit note',
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']
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.picking_type_code == 'outgoing':
reverse_move = return_id.picking_id.sale_id.invoice_ids._reverse_moves()
reverse_move._post(soft=False)
return
reverse_move = return_id.picking_id.purchase_id.invoice_ids._reverse_moves()
reverse_move.write({
'invoice_date': fields.date.today()
for invoice in (
return_id.picking_id.sale_id.invoice_ids + return_id.picking_id.purchase_id.invoice_ids):
if invoice.reversed_entry_id:
raise ValidationError(
"The selected invoice has already been reversed.")
move_type = 'out_refund' if return_id.picking_id.picking_type_code == 'outgoing' else 'in_refund'
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:
raise ValidationError(
"The selected picking should have at least one invoice.")

4
return_invoice_bill/wizard/return_move_views.xml

@ -12,7 +12,7 @@
<footer>
<button string="Apply Reverse Entry" class="btn-primary"
type="object"
name="apply_reverse_entry"/>
name="action_apply_reverse_entry"/>
<button string="Cancel" class="btn-secondary"
special="cancel"/>
</footer>
@ -21,7 +21,7 @@
</record>
<!-- 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.-->
<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="res_model">return.move</field>
<field name="view_mode">form</field>

Loading…
Cancel
Save