@ -0,0 +1,50 @@ |
|||
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
|||
:alt: License: LGPL-3 |
|||
|
|||
Invoice Tags |
|||
============= |
|||
This module help you to add custom tags related to the invoice and also |
|||
we have options for filter and group by. |
|||
|
|||
Configuration |
|||
============= |
|||
- No additional configurations needed. |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (LGPL v3). |
|||
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
|||
|
|||
Credits |
|||
------- |
|||
Developers: (V18) - Ranjith R |
|||
(V17) - Mufeeda Shirin |
|||
(V16) - Saneen K |
|||
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,29 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
|||
# |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
from . import models |
|||
|
|||
|
|||
def uninstall_hook(env): |
|||
""" Delete `ir.ui.view` records related with invoice tags. """ |
|||
for record in env['invoice.tag'].search([]): |
|||
env['ir.ui.view'].search([('name', '=', f'filter.{record.name}')]).unlink() |
|||
@ -0,0 +1,47 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
|||
# |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
{ |
|||
'name': "Invoice Tags", |
|||
'version': '18.0.1.0.0', |
|||
'category': 'Accounting', |
|||
'summary': 'Add tags in invoicing', |
|||
'description': 'This module allows you to add tags to invoices, as well as ' |
|||
'filter and group records based on the tags of the ' |
|||
'invoices.', |
|||
'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', |
|||
'views/invoice_tags_views.xml', |
|||
'views/account_move_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'LGPL-3', |
|||
'installable': True, |
|||
'application': False, |
|||
'auto_install': False, |
|||
'uninstall_hook': 'uninstall_hook', |
|||
} |
|||
@ -0,0 +1,7 @@ |
|||
## Module <invoice_tags> |
|||
|
|||
#### 08.09.2025 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial commit for Invoice Tags |
|||
@ -0,0 +1,24 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
|||
# |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
from . import account_move |
|||
from . import invoice_tags |
|||
@ -0,0 +1,68 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
|||
# |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
from odoo import api, fields, models, _ |
|||
|
|||
|
|||
class AccountMove(models.Model): |
|||
"""Add field for tags in account.move""" |
|||
_inherit = 'account.move' |
|||
|
|||
invoice_tag_ids = fields.Many2many('invoice.tag', string="Tags", |
|||
help="Field for adding tags in invoice") |
|||
|
|||
@api.onchange('invoice_tag_ids') |
|||
def _onchange_tag_filter(self): |
|||
"""Create filtering option dynamically in accordance with tags that |
|||
are added to invoices""" |
|||
linked_tags = [tag for tag in self.search( |
|||
[('id', '!=', self._origin.id)]).invoice_tag_ids] |
|||
for result in self.invoice_tag_ids._origin: |
|||
if result not in linked_tags: |
|||
linked_tags.append(result) |
|||
if not self.env['ir.ui.view'].sudo().search( |
|||
[('name', '=', f'filter.{result.name}')]): |
|||
inherit_id = self.env.ref('account.view_account_invoice_filter') |
|||
arch_base = _("""<?xml version="1.0"?> |
|||
<xpath expr="//filter[@name='myinvoices']" |
|||
position="after"> |
|||
<separator/> |
|||
<filter string="%s" name="%s" |
|||
domain="[('invoice_tag_ids','=','%s')]"/> |
|||
<separator/> |
|||
</xpath> |
|||
""") % (result.name, result.name, result.name) |
|||
value = {'name': f'filter.{result.name}', |
|||
'type': 'search', |
|||
'model': 'account.move', |
|||
'mode': 'extension', |
|||
'inherit_id': inherit_id.id, |
|||
'arch_base': arch_base, |
|||
'active': True} |
|||
self.env['ir.ui.view'].sudo().create(value) |
|||
# we need to unlink from the view if the tags are removed from invoice |
|||
for tags in self.invoice_tag_ids.search([]): |
|||
if tags not in linked_tags: |
|||
self.env['ir.ui.view'].sudo().search( |
|||
[('name', '=', f'filter.{tags.name}')]).active = False |
|||
self.env['ir.ui.view'].sudo().search( |
|||
[('name', '=', f'filter.{tags.name}')]).unlink() |
|||
@ -0,0 +1,73 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################### |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions (odoo@cybrosys.com) |
|||
# |
|||
# |
|||
# This program is free software: you can modify |
|||
# it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) as |
|||
# published by the Free Software Foundation, either version 3 of the |
|||
# License, or (at your option) any later version. |
|||
# |
|||
# 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 LESSER GENERAL PUBLIC LICENSE for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# along with this program. If not, see <https://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################### |
|||
from random import randint |
|||
from odoo import fields, models, api, _ |
|||
|
|||
|
|||
class InvoiceTag(models.Model): |
|||
"""Class for creating tags""" |
|||
_name = "invoice.tag" |
|||
_description = "Invoice Tag" |
|||
|
|||
def _get_default_color(self): |
|||
"""Function to select color for tags""" |
|||
return randint(1, 11) |
|||
|
|||
name = fields.Char(string='Tag Name', required=True, translate=True, |
|||
help="Invoice tags") |
|||
color = fields.Integer(string='Color', default=_get_default_color, |
|||
help="Tag color") |
|||
|
|||
_sql_constraints = [ |
|||
('name_uniq', 'unique (name)', "Tag name already exists !"), |
|||
] |
|||
|
|||
def unlink(self): |
|||
"""Unlink the tags from filtering""" |
|||
for record in self: |
|||
tag_name = self.env['ir.ui.view'].sudo().search( |
|||
[('name', '=', f'filter.{record.name}')]) |
|||
tag_name.active = False |
|||
tag_name.unlink() |
|||
return super(InvoiceTag, self).unlink() |
|||
|
|||
@api.onchange('name') |
|||
def _onchange_tag_name(self): |
|||
"""Changed the filter name according to tag name""" |
|||
filter_name = self.browse(self._origin.id).name |
|||
tag_name = self.env['ir.ui.view'].sudo().search( |
|||
[('name', '=', f'filter.{filter_name}')]) |
|||
arch_base = _("""<?xml version="1.0"?> |
|||
<xpath expr="//filter[@name='myinvoices']" |
|||
position="after"> |
|||
<separator/> |
|||
<filter string="%s" name="%s" |
|||
domain="[('invoice_tag_ids','=','%s')]"/> |
|||
<separator/> |
|||
</xpath> |
|||
""") % ( |
|||
self.name, self.name, self.name) |
|||
tag_name.write({ |
|||
'name': f'filter{self.name}', |
|||
'arch_base': arch_base |
|||
}) |
|||
|
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 28 KiB |
|
After Width: | Height: | Size: 628 KiB |
|
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: 767 KiB |
|
After Width: | Height: | Size: 138 KiB |
|
After Width: | Height: | Size: 760 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 697 KiB |
|
After Width: | Height: | Size: 1.1 MiB |
|
After Width: | Height: | Size: 141 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 179 KiB |
|
After Width: | Height: | Size: 151 KiB |
|
After Width: | Height: | Size: 92 KiB |
|
After Width: | Height: | Size: 136 KiB |
|
After Width: | Height: | Size: 140 KiB |
|
After Width: | Height: | Size: 165 KiB |
|
After Width: | Height: | Size: 880 KiB |
|
After Width: | Height: | Size: 733 KiB |
|
After Width: | Height: | Size: 40 KiB |
@ -0,0 +1,56 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!--Add tags in invoice--> |
|||
<record id="view_move_form" model="ir.ui.view"> |
|||
<field name="name">account.move.view.form.inherit.invoice.tags</field> |
|||
<field name="model">account.move</field> |
|||
<field name="inherit_id" ref="account.view_move_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//group[@name='sale_info_group']" position="inside"> |
|||
<field name="invoice_tag_ids" string="Tags" |
|||
widget="many2many_tags" options="{'color_field': 'color'}"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
<!--list view--> |
|||
<record id="view_out_invoice_list" model="ir.ui.view"> |
|||
<field name="name">account.move.view.list.inherit.invoice.tags</field> |
|||
<field name="model">account.move</field> |
|||
<field name="inherit_id" ref="account.view_out_invoice_tree"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='invoice_date']" position="after"> |
|||
<field name="invoice_tag_ids" string="Tags" |
|||
widget="many2many_tags" options="{'color_field': 'color'}" |
|||
optional="hide"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
<!--Kanban view--> |
|||
<record id="view_account_move_kanban" model="ir.ui.view"> |
|||
<field name="name">account.move.view.kanban.inherit.invoice.tags</field> |
|||
<field name="model">account.move</field> |
|||
<field name="inherit_id" ref="account.view_account_move_kanban"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='amount_total_in_currency_signed']" position="after"> |
|||
<field name="invoice_tag_ids" |
|||
options="{'color_field': 'color'}"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
<!--Search and group by for tags--> |
|||
<record id="view_account_invoice_filter" model="ir.ui.view"> |
|||
<field name="name">account.move.view.search.inherit.invoice.tags</field> |
|||
<field name="model">account.move</field> |
|||
<field name="inherit_id" ref="account.view_account_invoice_filter"/> |
|||
<field name="arch" type="xml"> |
|||
<search> |
|||
<field name="invoice_tag_ids"/> |
|||
</search> |
|||
<xpath expr="//search/group" position="inside"> |
|||
<filter string="Invoice Tag" name="invoice_tag_ids" |
|||
context="{'group_by':'invoice_tag_ids'}"/> |
|||
</xpath> |
|||
<separator/> |
|||
</field> |
|||
</record> |
|||
</odoo> |
|||
@ -0,0 +1,48 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!--Invoice tag form view--> |
|||
<record id="invoice_tag_view_form" model="ir.ui.view"> |
|||
<field name="name">invoice.tag.view.form</field> |
|||
<field name="model">invoice.tag</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Tags"> |
|||
<sheet> |
|||
<div class="oe_title"> |
|||
<label for="name"/> |
|||
<h1><field name="name" placeholder="e.g. Services"/></h1> |
|||
</div> |
|||
<group> |
|||
<group> |
|||
<field name="color" required="True" |
|||
widget="color_picker"/> |
|||
</group> |
|||
</group> |
|||
</sheet> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!--Invoice tags list view--> |
|||
<record id="invoice_tag_view_list" model="ir.ui.view"> |
|||
<field name="name">invoice.tag.view.list</field> |
|||
<field name="model">invoice.tag</field> |
|||
<field name="arch" type="xml"> |
|||
<list string="Tags" editable="bottom" sample="1"> |
|||
<field name="name"/> |
|||
<field name="color" widget="color_picker" /> |
|||
</list> |
|||
</field> |
|||
</record> |
|||
<!-- Tags Configuration --> |
|||
<record id="invoice_tag_action" model="ir.actions.act_window"> |
|||
<field name="name">Tags</field> |
|||
<field name="res_model">invoice.tag</field> |
|||
<field name="view_id" ref="invoice_tag_view_list"/> |
|||
<field name="help" type="html"> |
|||
<p class="o_view_nocontent_smiling_face">Create Invoice Tags</p> |
|||
<p>Use Tags to manage and track your Invoice Details</p> |
|||
</field> |
|||
</record> |
|||
<!-- Add menu under configuration--> |
|||
<menuitem id="invoice_tag_menu" parent="account.account_invoicing_menu" |
|||
name="Tags" action="invoice_tag_action" sequence="110"/> |
|||
</odoo> |
|||