-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from sygel-technology/T-2911
T-2911[ADD]invoice_report_hide_price
- Loading branch information
Showing
9 changed files
with
139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
# 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", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from . import account_move_line | ||
from . import account_move |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
# 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 | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
# 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 | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<template id="invoice_report_hide_price_report_invoice_document" name="invoice.report.hide.price.report.invoice.document" inherit_id="account.report_invoice_document" > | ||
<xpath expr="//th[@name='th_priceunit']" position="attributes"> | ||
<attribute name="t-if">o.has_show_price_report_lines</attribute> | ||
</xpath> | ||
<xpath expr="//th[@name='th_price_unit']" position="attributes"> | ||
<attribute name="t-if">display_discount and o.has_show_price_report_lines</attribute> | ||
</xpath> | ||
<xpath expr="//th[@name='th_subtotal']" position="attributes"> | ||
<attribute name="t-if">o.has_show_price_report_lines</attribute> | ||
</xpath> | ||
<xpath expr="//t[@name='account_invoice_line_accountable']/td[3]" position="attributes"> | ||
<attribute name="t-if">o.has_show_price_report_lines</attribute> | ||
</xpath> | ||
<xpath expr="//t[@name='account_invoice_line_accountable']/td[4]" position="attributes"> | ||
<attribute name="t-if">display_discount and o.has_show_price_report_lines</attribute> | ||
</xpath> | ||
<xpath expr="//t[@name='account_invoice_line_accountable']/td[6]" position="attributes"> | ||
<attribute name="t-if">o.has_show_price_report_lines</attribute> | ||
</xpath> | ||
<xpath expr="//span[@t-field='line.price_unit']" position="attributes"> | ||
<attribute name="t-if">line.show_price_info_report</attribute> | ||
</xpath> | ||
<xpath expr="//span[@t-field='line.discount']" position="attributes"> | ||
<attribute name="t-if">line.show_price_info_report</attribute> | ||
</xpath> | ||
<xpath expr="//span[@t-field='line.price_subtotal']" position="attributes"> | ||
<attribute name="t-if">line.show_price_info_report</attribute> | ||
</xpath> | ||
<xpath expr="//span[@t-field='line.price_total']" position="attributes"> | ||
<attribute name="t-if">line.show_price_info_report</attribute> | ||
</xpath> | ||
</template> | ||
</odoo> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2022 Manuel Regidor <manuel.regidor@sygel.es> | ||
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). --> | ||
<odoo> | ||
<record id="invoice_report_hide_price_view_move_form" model="ir.ui.view"> | ||
<field name="name">invoice.report.hide.price.view.move.form</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_line_ids']" position="before"> | ||
<button name="action_activate_show_price_info_report" type="object" string="Show Lines Price Info in Report" /> | ||
<button name="action_deactivate_show_price_info_report" type="object" string="Hide Lines Price Info in Report" /> | ||
</xpath> | ||
<!-- We add the field to the line_ids tree view so it can be saved when modified | ||
from the invoice lines tabs --> | ||
<xpath expr="//field[@name='line_ids']/tree" position="inside"> | ||
<field name="show_price_info_report" invisible="1"/> | ||
</xpath> | ||
<xpath expr="//field[@name='invoice_line_ids']/tree" position="inside"> | ||
<field name="show_price_info_report" /> | ||
</xpath> | ||
</field> | ||
</record> | ||
</odoo> |