Skip to content
Permalink
Browse files

[ADD] l10n_il: display Original or Copy on the pdf

  • Loading branch information...
AdrienHorgnies committed Nov 8, 2019
1 parent 68b0f9c commit 6f4a1124eb556009abf7f53a9c37cda368a4215b
@@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import models
@@ -22,5 +22,6 @@
'data/account_tax_template_data.xml',
'data/account_chart_template_post_data.xml',
'data/account_chart_template_configure_data.xml',
'views/report_invoice.xml'
],
}
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import account_move
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo import models, fields


class AccountMove(models.Model):
_inherit = 'account.move'

is_original_printed = fields.Boolean(
default=False,
help="Technical field used to display 'Original' on first pdf print")

def consume_original_print(self):
"""
Inform if original pdf has been printed and mark it as printed if it wasn't already the case.
Only a posted invoice can consume the original print
:return: True the first time, False otherwise
"""
if self.state != 'posted' or self.is_original_printed:
return False
self.is_original_printed = True
return True
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="l10n_il_report_invoice_document_inherit" inherit_id="account.report_invoice_document">
<xpath expr="//h2" position="after">
<div t-if="o.consume_original_print()">Original</div>
<div t-else="o.state == 'posted'">Copy</div>
</xpath>
</template>
</odoo>

0 comments on commit 6f4a112

Please sign in to comment.
You can’t perform that action at this time.