@ -0,0 +1,52 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Automated Credit/Debit Note Generation from Return Picking |
|||
========================================================== |
|||
This module allow to return the invoice or bill while picking the product in Odoo17. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Configuration |
|||
============= |
|||
- Additional configuration not required |
|||
|
|||
Installation |
|||
============ |
|||
- www.odoo.com/documentation/18.0/setup/install.html |
|||
- Install our custom addon |
|||
|
|||
License |
|||
------- |
|||
GNU AFFERO GENERAL PUBLIC LICENSE v3.0 (AGPL-3) |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
* Developer: (V17) Kailas Krishna, |
|||
(V16) Dhanya Babu, |
|||
(V18) Busthana |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
This module is maintained by Cybrosys Technologies. |
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import models |
|||
from . import wizard |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
{ |
|||
"name": "Automated Credit/Debit Note Generation from Return Picking", |
|||
"version": "18.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 17. ", |
|||
"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", |
|||
], |
|||
"images": ["static/description/banner.png"], |
|||
"license": "AGPL-3", |
|||
"installable": True, |
|||
"auto_install": False, |
|||
"application": False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <return_invoice_bill> |
|||
|
|||
#### 29.01.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Automated Credit/Debit Note Generation from Return Picking |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from . import stock_picking |
|||
from . import stock_return_picking |
@ -0,0 +1,84 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class StockPicking(models.Model): |
|||
"""This class extends the 'stock.picking' model to add a method for |
|||
retrieving credit notes and debit notes related |
|||
to the picking, and generating actions for viewing them.""" |
|||
_inherit = 'stock.picking' |
|||
|
|||
picking_type_name = fields.Char(string='Picking Type Name', |
|||
help='Name of picking type') |
|||
return_invoice_count = fields.Char(string="Counts", |
|||
compute='_compute_return_invoice_count', |
|||
help="counts of return invoices") |
|||
is_paid = fields.Boolean(string='Is Paid', |
|||
help='Value will be True when order has paid ' |
|||
'otherwise False.') |
|||
|
|||
@api.model_create_multi |
|||
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) |
|||
|
|||
def action_get_credit_note(self): |
|||
"""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') |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'name': _( |
|||
'Reversal of Credit Note: %s') % self.sale_id.invoice_ids.filtered( |
|||
lambda x: x.move_type == 'out_invoice').name, |
|||
'res_model': 'account.move', |
|||
'view_mode': 'list,form', |
|||
'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() |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'name': _( |
|||
'Reversal of Debit Note: %s') % self.purchase_id.invoice_ids.filtered( |
|||
lambda x: x.move_type == 'in_invoice').name, |
|||
'res_model': 'account.move', |
|||
'view_mode': 'list,form', |
|||
'domain': [('id', 'in', debit_notes.ids)] |
|||
} |
|||
|
|||
@api.depends('return_invoice_count') |
|||
def _compute_return_invoice_count(self): |
|||
for record in self: |
|||
record.return_invoice_count = record.return_count |
@ -0,0 +1,88 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL v3), Version 3. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
from odoo import api, fields, models |
|||
|
|||
|
|||
class StockReturnPicking(models.TransientModel): |
|||
"""Inherited this class to display the view, to add the cancel reason.""" |
|||
_inherit = 'stock.return.picking' |
|||
|
|||
picking_type_name = fields.Char(string='Picking Type Name', |
|||
help='Name of the picking type') |
|||
|
|||
@api.model |
|||
def default_get(self, fields): |
|||
"""Override of default_get method to set default values for fields |
|||
in the wizard.""" |
|||
result = super(StockReturnPicking, self).default_get(fields) |
|||
active_model = self.env.context['active_model'] |
|||
active_id = self.env.context['active_id'] |
|||
if active_model == 'stock.picking' and active_id: |
|||
stock_picking = self.env[active_model].browse(active_id) |
|||
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): |
|||
""" |
|||
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): |
|||
""" |
|||
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() |
|
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 912 KiB |
After Width: | Height: | Size: 1.3 MiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 44 KiB |
After Width: | Height: | Size: 46 KiB |
After Width: | Height: | Size: 85 KiB |
After Width: | Height: | Size: 412 KiB |
After Width: | Height: | Size: 96 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 133 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 99 KiB |
After Width: | Height: | Size: 130 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 118 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 108 KiB |
After Width: | Height: | Size: 137 KiB |
After Width: | Height: | Size: 110 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Button to initiate return with credit note and debit note --> |
|||
<record id="view_picking_form" model="ir.ui.view"> |
|||
<field name="name">stock.picking.view.form.inherit.return.invoice.bill</field> |
|||
<field name="model">stock.picking</field> |
|||
<field name="inherit_id" ref="stock.view_picking_form"/> |
|||
<field name="arch" type="xml"> |
|||
<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" |
|||
icon="fa-outdent" type="object" |
|||
invisible="picking_type_name != 'Delivery Orders' or is_paid == False"> |
|||
<field string="Credit Notes" name="return_invoice_count" widget="statinfo"/> |
|||
</button> |
|||
<button name="action_get_debit_note" |
|||
icon="fa-outdent" type="object" |
|||
invisible="picking_type_name != 'Receipts' or is_paid == False"> |
|||
<field string="Debit Notes" name="return_invoice_count" widget="statinfo"/> |
|||
</button> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,21 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Button to view the cancel reason --> |
|||
<record id="view_stock_return_picking_form" model="ir.ui.view"> |
|||
<field name="name">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"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//button[@name='action_create_returns']" position="after"> |
|||
<field name="picking_type_name" invisible="1"/> |
|||
<button name="action_returns_with_credit_note" |
|||
string="Return With Credit Note" type="object" |
|||
invisible="picking_type_name != 'stock.picking_type_out'"/> |
|||
<button name="action_returns_with_debit_note" |
|||
string="Return With Debit Note" |
|||
type="object" |
|||
invisible="picking_type_name != 'stock.picking_type_in'"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |