@ -0,0 +1,49 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg |
||||
|
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
||||
|
:alt: License: AGPL-3 |
||||
|
|
||||
|
Merge Invoices |
||||
|
============== |
||||
|
This module helps to merge invoices, credit note, debit note and vendor bills by merging them. |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configuration is needed. |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
Affero General Public License v3.0 (AGPL v3) |
||||
|
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
* Developers: (V16) Vishnuraj P, |
||||
|
(V17) Akhil Ashok, |
||||
|
(V18) Aysha Shalin |
||||
|
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) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 . import models |
||||
|
from . import wizard |
@ -0,0 +1,45 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
{ |
||||
|
'name': 'Merge Invoices', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Accounting', |
||||
|
'summary': """Merge different Account moves.""", |
||||
|
'description': """This module allows users to merge customer invoices, |
||||
|
credit notes, debit notes, and vendor bills into a single document. All |
||||
|
details from the merged documents are kept in the final one.""", |
||||
|
'author': 'Cybrosys Techno Solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['account'], |
||||
|
'data': [ |
||||
|
'security/ir.model.access.csv', |
||||
|
'data/ir_actions_server_data.xml', |
||||
|
'wizard/merge_invoice_views.xml', |
||||
|
], |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'AGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False |
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<!-- Record for Adding menu merge in action menu in list view --> |
||||
|
<record id="action_merge_invoice" model="ir.actions.server"> |
||||
|
<field name="name">Merge Invoices/Bills</field> |
||||
|
<field name="model_id" ref="account.model_account_move"/> |
||||
|
<field name="binding_model_id" ref="account.model_account_move"/> |
||||
|
<field name="binding_view_types">list</field> |
||||
|
<field name="state">code</field> |
||||
|
<field name="code"> |
||||
|
action = records.action_merge_invoice() |
||||
|
</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -0,0 +1,6 @@ |
|||||
|
## Module <invoice_merging> |
||||
|
|
||||
|
#### 22.05.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
##### ADD |
||||
|
- Initial Commit for Merge Invoices |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 . import account_move |
@ -0,0 +1,63 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 api, fields, models, _ |
||||
|
|
||||
|
|
||||
|
class AccountMove(models.Model): |
||||
|
""" |
||||
|
Inherit AccountMove class for add merge invoice action function, |
||||
|
Method: action_merge_invoice(self): |
||||
|
Create new wizard with selected records |
||||
|
""" |
||||
|
_inherit = "account.move" |
||||
|
|
||||
|
@api.model |
||||
|
def name_search(self, name='', args=None, operator='ilike', limit=100): |
||||
|
"""Displays partner name along with invoice name for merging purpose""" |
||||
|
args = args or [] |
||||
|
res = super().name_search(name, args, operator, limit) |
||||
|
|
||||
|
if self.env.context.get('display_invoice_with_partner'): |
||||
|
records = self.browse([r[0] for r in res]) |
||||
|
return [ |
||||
|
( |
||||
|
rec.id, |
||||
|
f"{rec.name or ('Draft' if rec.state == 'draft' else '')} - " |
||||
|
f"{rec.partner_id.display_name or ''}" |
||||
|
) |
||||
|
for rec in records |
||||
|
] |
||||
|
return res |
||||
|
|
||||
|
def action_merge_invoice(self): |
||||
|
""" Method to create invoice merge wizard """ |
||||
|
merge_invoice = self.env['merge.invoice'].create({ |
||||
|
'invoice_ids': [fields.Command.set(self.ids)], |
||||
|
}) |
||||
|
return { |
||||
|
'name': _('Merge Invoices'), |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'res_model': 'merge.invoice', |
||||
|
'view_mode': 'form', |
||||
|
'res_id': merge_invoice.id, |
||||
|
'target': 'new' |
||||
|
} |
|
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: 738 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: 142 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 142 KiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 161 KiB |
After Width: | Height: | Size: 158 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 174 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 150 KiB |
After Width: | Height: | Size: 166 KiB |
After Width: | Height: | Size: 106 KiB |
After Width: | Height: | Size: 538 KiB |
After Width: | Height: | Size: 749 KiB |
After Width: | Height: | Size: 43 KiB |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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 . import merge_invoice |
@ -0,0 +1,96 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (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, _ |
||||
|
from odoo.exceptions import AccessError |
||||
|
|
||||
|
|
||||
|
class MergeInvoice(models.TransientModel): |
||||
|
""" |
||||
|
Main method to merge selected invoices |
||||
|
- If user select merge to existing then the selected invoices will be |
||||
|
merged to the selected record |
||||
|
- If no invoice is selected, then a new record will be created with the |
||||
|
existing picking lines |
||||
|
""" |
||||
|
_name = "merge.invoice" |
||||
|
_description = "Invoice Merge" |
||||
|
|
||||
|
invoice_ids = fields.Many2many('account.move', |
||||
|
string="Selected Invoices", |
||||
|
help="Selected invoices to merge") |
||||
|
partner_id = fields.Many2one('res.partner', string="Customer", |
||||
|
help="The new invoice will be created" |
||||
|
" for selected partner") |
||||
|
|
||||
|
target_invoice_id = fields.Many2one( |
||||
|
'account.move', |
||||
|
string="Merge to existing", |
||||
|
context={'display_invoice_with_partner': True}, |
||||
|
help="Select an invoice if you want to merge other invoices to selected " |
||||
|
"one, otherwise leave it empty" |
||||
|
) |
||||
|
|
||||
|
merge_type = fields.Selection( |
||||
|
[('cancel', 'Cancel Others'), ('keep', 'Keep Others')], |
||||
|
string="Merge type", default="cancel", |
||||
|
help="Select the merge type to decide what to do with other invoices") |
||||
|
|
||||
|
def action_merge_invoice(self): |
||||
|
"""Method for merge invoices""" |
||||
|
# Checking for is there any exceptions |
||||
|
if len(list(set(self.invoice_ids))) == 1: |
||||
|
raise AccessError( |
||||
|
_("Merging is not possible on single Invoice or Bill")) |
||||
|
if any(state in ['posted', 'cancel'] for state in |
||||
|
self.invoice_ids.mapped('state')): |
||||
|
raise AccessError(_("Merging is only possible on draft state " |
||||
|
"Invoices or Bills")) |
||||
|
if len(list(set(self.invoice_ids.mapped('move_type')))) > 1: |
||||
|
raise AccessError(_("Merging is only possible for different type " |
||||
|
"moves, so please select the same type.")) |
||||
|
# If there is no exceptions continue with the merging |
||||
|
invoices = self.invoice_ids |
||||
|
invoice_lines = [] |
||||
|
pay_reference = [] |
||||
|
if self.target_invoice_id: |
||||
|
target_invoice = self.target_invoice_id |
||||
|
invoices -= self.target_invoice_id |
||||
|
pay_reference.append(target_invoice.name if |
||||
|
target_invoice.name != False else |
||||
|
f"Draft {str(target_invoice.id)}") |
||||
|
else: |
||||
|
target_invoice = self.env['account.move'].with_context( |
||||
|
check_move_validity=False).create( |
||||
|
{'partner_id': self.partner_id.id}) |
||||
|
for record in invoices: |
||||
|
for line in record.line_ids: |
||||
|
if line.display_type not in ["payment_term", "tax"]: |
||||
|
invoice_lines += line.with_context( |
||||
|
check_move_validity=False).copy( |
||||
|
{'move_id': target_invoice.id}) |
||||
|
pay_reference.append(record.name if |
||||
|
record.name != False else |
||||
|
f"Draft {str(record.id)}") |
||||
|
if self.merge_type == "cancel": |
||||
|
record.button_cancel() |
||||
|
target_invoice.write( |
||||
|
{'payment_reference': f"Merged ({(', '.join(pay_reference))})"}) |
@ -0,0 +1,41 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Form view for merge invoice wizard --> |
||||
|
<record id="merge_invoice_view_form" model="ir.ui.view"> |
||||
|
<field name="name">merge.invoice.view.form</field> |
||||
|
<field name="model">merge.invoice</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Merge Invoice"> |
||||
|
<sheet> |
||||
|
<field name="invoice_ids"> |
||||
|
<list> |
||||
|
<field name="name"/> |
||||
|
<field name="invoice_partner_display_name"/> |
||||
|
<field name="invoice_date"/> |
||||
|
<field name="invoice_date_due"/> |
||||
|
<field name="invoice_origin"/> |
||||
|
<field name="invoice_user_id"/> |
||||
|
<field name="amount_untaxed_signed"/> |
||||
|
<field name="amount_total_signed"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
<group string="MERGE TO"> |
||||
|
<field name="target_invoice_id" |
||||
|
domain="[('id', 'in', invoice_ids)]" |
||||
|
context="{'display_invoice_with_partner': 1}" |
||||
|
invisible="partner_id != False"/> |
||||
|
<field name="partner_id" invisible="target_invoice_id != False"/> |
||||
|
<field name="merge_type" widget="radio"/> |
||||
|
</group> |
||||
|
<footer> |
||||
|
<button name="action_merge_invoice" string="Merge" |
||||
|
type="object" |
||||
|
class="btn-primary"/> |
||||
|
<button string="Cancel" class="btn-secondary" |
||||
|
special="cancel"/> |
||||
|
</footer> |
||||
|
</sheet> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |