Browse Source

[FIX] Changed Functionaly

pull/30/merge
SHEREEF PT 8 years ago
parent
commit
9ddf689d86
  1. 4
      tax_invoice_report/__manifest__.py
  2. 38
      tax_invoice_report/invoice_report.py
  3. 2
      tax_invoice_report/static/description/index.html
  4. 16
      tax_invoice_report/tax_view.xml

4
tax_invoice_report/__manifest__.py

@ -23,7 +23,7 @@
{
'name': 'Tax Invoice Report',
'version': '10.0.1.0',
'version': '10.0.2.0',
'summary': 'Tax Amount to Accounting Business Intelligence Report',
'description': 'Total taxable amount to the accounting report',
'category': 'Accounting',
@ -33,7 +33,7 @@
'depends': [
'base', 'account',
],
'data': [],
'data': ['tax_view.xml'],
'images': ['static/description/banner.jpg'],
'license': 'AGPL-3',
'installable': True,

38
tax_invoice_report/invoice_report.py

@ -21,23 +21,51 @@
#
##############################################################################
from odoo import fields, models
from odoo import fields, models,api, _
class Invoicelinecount(models.Model):
_inherit = 'account.invoice'
@api.model
def get_count_as(self):
for inv in self:
inv.count_line = len(inv.invoice_line_ids)
inv.count_line1 = len(inv.invoice_line_ids)
inv.write({'count_line1': len(inv.invoice_line_ids)})
@api.multi
def _write(self, vals):
for i in self:
vals.update({'count_line1': len(i.invoice_line_ids)})
pre_not_reconciled = self.filtered(lambda invoice: not invoice.reconciled)
pre_reconciled = self - pre_not_reconciled
res = super(Invoicelinecount, self)._write(vals)
reconciled = self.filtered(lambda invoice: invoice.reconciled)
not_reconciled = self - reconciled
(reconciled & pre_reconciled).filtered(lambda invoice: invoice.state == 'open').action_invoice_paid()
(not_reconciled & pre_not_reconciled).filtered(lambda invoice: invoice.state == 'paid').action_invoice_re_open()
return res
count_line = fields.Integer(string="Count", compute="get_count_as", store=True)
count_line1 = fields.Integer(string="Count1", default=1)
class AccountInvoiceReport(models.Model):
_inherit = 'account.invoice.report'
tax_amount = fields.Float(string='Total Tax', readonly=True)
total_amount = fields.Float(string='Total With Tax', readonly=True)
amount_taxes = fields.Float(string='Total Tax', readonly=True)
amount_totals = fields.Float(string='Total With Tax', readonly=True)
number = fields.Char(string='Invoice Number')
def _select(self):
return super(AccountInvoiceReport, self)._select() \
+ ", sub.tax_amount as tax_amount,sub.total_amount as total_amount,sub.number"
+ ", sub.amount_taxes as amount_taxes,sub.amount_totals as amount_totals,sub.number"
def _sub_select(self):
return super(AccountInvoiceReport, self)._sub_select() \
+ ",ai.amount_tax as tax_amount, ai.amount_total as total_amount,ai.number as number"
+ ",(ai.amount_tax)/(ai.count_line1) AS amount_taxes, " \
"(ai.amount_total)/(ai.count_line1) as amount_totals ,ai.number"
def _group_by(self):
return super(AccountInvoiceReport, self)._group_by() + ", ai.number"

2
tax_invoice_report/static/description/index.html

@ -2,7 +2,7 @@
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Tax Invoice Report</h2>
<h3 class="oe_slogan">Tax Amount to Accounting Business Intelligence Report</h3>
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4>
<h4 class="oe_slogan"><a href="https://www.cybrosys.com">Cybrosys Technologies</a> </h4>
</div>
</section>

16
tax_invoice_report/tax_view.xml

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.ui.view" id="invoice_line_extend_view">
<field name="name">invoice.line.extend</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='payment_term_id']" position="before">
<field name="count_line" invisible="1"/>
<field name="count_line1" invisible="1"/>
</xpath>
</field>
</record>
</odoo>
Loading…
Cancel
Save