diff --git a/README.md b/README.md index cac2a95..93d48ce 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ Available addons addon | version | summary --- | --- | --- -[delete_payment_reference_invoice_report](delete_payment_reference_invoice_report/) | 14.0.1.0.0 | Remove the payment reference message from the outgoing invoice reports. +[delete_payment_reference_invoice_report](delete_payment_reference_invoice_report/) | 15.0.1.0.0 | Remove the payment reference message from the outgoing invoice reports. +[invoice_report_hide_price](invoice_report_hide_price/) | 15.0.1.0.0 | Show/Hide price info in invoice PDF. [//]: # (end addons) diff --git a/invoice_report_hide_price/__init__.py b/invoice_report_hide_price/__init__.py new file mode 100644 index 0000000..18143cb --- /dev/null +++ b/invoice_report_hide_price/__init__.py @@ -0,0 +1,4 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import models diff --git a/invoice_report_hide_price/__manifest__.py b/invoice_report_hide_price/__manifest__.py new file mode 100644 index 0000000..50f0347 --- /dev/null +++ b/invoice_report_hide_price/__manifest__.py @@ -0,0 +1,21 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +{ + "name": "Invoice Report Hide Price", + "summary": "Show/Hide price info in invoice PDF", + "version": "15.0.1.0.0", + "category": "Invoicing", + "website": "https://www.sygel.es", + "author": "Sygel", + "license": "AGPL-3", + "application": False, + "installable": True, + "depends": [ + 'account' + ], + "data": [ + "views/account_move_views.xml", + "report/report_invoice.xml", + ], +} diff --git a/invoice_report_hide_price/models/__init__.py b/invoice_report_hide_price/models/__init__.py new file mode 100644 index 0000000..7cbc6ca --- /dev/null +++ b/invoice_report_hide_price/models/__init__.py @@ -0,0 +1,5 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from . import account_move_line +from . import account_move diff --git a/invoice_report_hide_price/models/account_move.py b/invoice_report_hide_price/models/account_move.py new file mode 100644 index 0000000..db1f6f5 --- /dev/null +++ b/invoice_report_hide_price/models/account_move.py @@ -0,0 +1,33 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class AccountMove(models.Model): + _inherit = 'account.move' + + has_show_price_report_lines = fields.Boolean( + string="Has Show Price Report Lines", + compute="_compute_has_show_price_report_lines" + ) + + def _compute_has_show_price_report_lines(self): + for sel in self: + sel.has_show_price_report_lines = any( + line.show_price_info_report for line in sel.invoice_line_ids + ) + + def action_activate_show_price_info_report(self): + self.mapped('invoice_line_ids').filtered( + lambda a: not a.show_price_info_report + ).write({ + 'show_price_info_report': True + }) + + def action_deactivate_show_price_info_report(self): + self.mapped('invoice_line_ids').filtered( + lambda a: a.show_price_info_report + ).write({ + 'show_price_info_report': False + }) diff --git a/invoice_report_hide_price/models/account_move_line.py b/invoice_report_hide_price/models/account_move_line.py new file mode 100644 index 0000000..07f7f7d --- /dev/null +++ b/invoice_report_hide_price/models/account_move_line.py @@ -0,0 +1,13 @@ +# Copyright 2022 Manuel Regidor +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models, fields + + +class AccountMoveLine(models.Model): + _inherit = 'account.move.line' + + show_price_info_report = fields.Boolean( + string="Price in Report", + default=True + ) diff --git a/invoice_report_hide_price/report/report_invoice.xml b/invoice_report_hide_price/report/report_invoice.xml new file mode 100644 index 0000000..33dc9f8 --- /dev/null +++ b/invoice_report_hide_price/report/report_invoice.xml @@ -0,0 +1,37 @@ + + + + + diff --git a/invoice_report_hide_price/static/description/icon.png b/invoice_report_hide_price/static/description/icon.png new file mode 100644 index 0000000..207fb7a Binary files /dev/null and b/invoice_report_hide_price/static/description/icon.png differ diff --git a/invoice_report_hide_price/views/account_move_views.xml b/invoice_report_hide_price/views/account_move_views.xml new file mode 100644 index 0000000..e17d48e --- /dev/null +++ b/invoice_report_hide_price/views/account_move_views.xml @@ -0,0 +1,24 @@ + + + + + invoice.report.hide.price.view.move.form + account.move + + + +