modify invoice report

This commit is contained in:
sonal
2020-07-29 14:41:19 +05:30
parent c881ba4ea9
commit 3673f18d27
6 changed files with 142 additions and 0 deletions

1
reports/__init__.py Normal file
View File

@@ -0,0 +1 @@
from . import account

23
reports/__manifest__.py Normal file
View File

@@ -0,0 +1,23 @@
{
'name': 'Reports',
'version': '13.0.1.0.0',
'summary': 'Reports for sale, account etc.',
'description': """
""",
'category': 'tools',
'author': "",
'company': '',
'maintainer': '',
'website': "",
'depends': [
'base', 'account', 'bi_professional_reports_templates'
],
'data': [
'views/invoice_report.xml',
],
'demo': [],
'images': [],
'installable': True,
'auto_install': False,
'application': False,
}

Binary file not shown.

Binary file not shown.

24
reports/account.py Normal file
View File

@@ -0,0 +1,24 @@
from odoo import models, api, fields
from datetime import date
class AccountMove(models.Model):
_inherit = "account.move"
txn_id = fields.Char("Transaction ID")
signed_by = fields.Char("signed by", compute='compute_signature')
print_date = fields.Date("Print date", compute='compute_print_date')
def compute_print_date(self):
for rec in self:
if rec.invoice_origin:
sale_id = self.env['sale.order'].sudo().search([('name', '=', rec.invoice_origin)])
for doc in sale_id:
rec.print_date = doc.signed_on
def compute_signature(self):
for rec in self:
if rec.invoice_origin:
sale_id = self.env['sale.order'].sudo().search([('name', '=', rec.invoice_origin)])
for doc in sale_id:
rec.signed_by = doc.signed_by

View File

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="account_invoice_inherit_form_view2" model="ir.ui.view">
<field name="name">account_invoice_inherit.inherit_form_view</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form" />
<field name="type">form</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='journal_id']" position="after">
<field name="txn_id"/>
</xpath>
</field>
</record>
<template id="report_invoices_inherit1" inherit_id="bi_professional_reports_templates.fency_report_invoice_document">
<xpath expr="//t[@t-call='web.external_layout']/div/div[1]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/div[2]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
<strong>YOUR ORDER NO:</strong><br/>
<div class="text-right"><strong>D.O.NOS</strong><br/></div>
<div class="text-right"><strong>M.R.V NO.</strong><br/></div>
<strong>Sale Code:</strong>
<span t-esc="o.invoice_origin"/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/p[last()]" position="after">
<p>E &amp; OE</p><br/>
<span>Print Date: <span t-esc="o.print_date"/></span><br/>
<span>Signed by: <span t-esc="o.signed_by"/></span>
</xpath>
</template>
<template id="report_invoices_inherit2" inherit_id="bi_professional_reports_templates.classic_report_invoice_document">
<xpath expr="//t[@t-call='web.external_layout']/div/div[1]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/div[2]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
<strong>YOUR ORDER NO:</strong><br/>
<div class="text-right"><strong>D.O.NOS</strong><br/></div>
<div class="text-right"><strong>M.R.V NO.</strong><br/></div>
<strong>Sale Code:</strong>
<span t-esc="o.invoice_origin"/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/p[last()]" position="after">
<p>E &amp; OE</p><br/>
<span>Print Date: <span t-esc="o.print_date"/></span><br/>
<span>Signed by: <span t-esc="o.signed_by"/></span>
</xpath>
</template>
<template id="report_invoices_inherit3" inherit_id="bi_professional_reports_templates.modern_report_invoice_document">
<xpath expr="//t[@t-call='web.external_layout']/div/div[1]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/div[2]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
<strong>YOUR ORDER NO:</strong><br/>
<div class="text-right"><strong>D.O.NOS</strong><br/></div>
<div class="text-right"><strong>M.R.V NO.</strong><br/></div>
<strong>Sale Code:</strong>
<span t-esc="o.invoice_origin"/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/p[last()]" position="after">
<p>E &amp; OE</p><br/>
<span>Print Date: <span t-esc="o.print_date"/></span><br/>
<span>Signed by: <span t-esc="o.signed_by"/></span>
</xpath>
</template>
<template id="report_invoices_inherit4" inherit_id="bi_professional_reports_templates.odoo_std_report_invoice_document">
<xpath expr="//t[@t-call='web.external_layout']/div/div[1]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/div[2]" position="before">
<strong>TRN#</strong>
<span t-esc="o.txn_id"/><br/>
<strong>YOUR ORDER NO:</strong><br/>
<div class="text-right"><strong>D.O.NOS</strong><br/></div>
<div class="text-right"><strong>M.R.V NO.</strong><br/></div>
<strong>Sale Code:</strong>
<span t-esc="o.invoice_origin"/>
</xpath>
<xpath expr="//t[@t-call='web.external_layout']/div/p[last()]" position="after">
<p>E &amp; OE</p><br/>
<span>Print Date: <span t-esc="o.print_date"/></span><br/>
<span>Signed by: <span t-esc="o.signed_by"/></span>
</xpath>
</template>
</odoo>