Browse Source

[ADD] Calculo de interés y configuración para la factura

adrielso 6 years ago
parent
commit
e48e05e8db

+ 2 - 1
__init__.py

@@ -1 +1,2 @@
-# -*- coding ;utf-8 -*-
+# -*- coding: utf-8 -*-
+import models

+ 15 - 3
__openerp__.py

@@ -1,4 +1,4 @@
-# -*- coding ;utf-8 -*-
+# -*- coding: utf-8 -*-
 {
     'name': 'Eiru Account Interests',
     'author':  'Adrielso Kunert',
@@ -8,9 +8,21 @@
     'depends': [
         'account',
         'eiru_assets',
+        'sale'
+    ],
+    'data': [
+        'views/templates.xml',
+        'security/ir.model.access.csv',
+        'views/data_decimal_precision_interest.xml',
+        'views/account_interest.xml',
+        'views/account_interest_config.xml',
+        'views/eiru_verify_interest.xml',
+        'views/account_invoice_interst.xml',
+    ],
+    'qweb': [
+        'static/src/xml/*.xml',
+        'static/src/xml/modal/*.xml',
     ],
-    'data': [],
-    'qweb': [],
 
     'installable': True,
 }

+ 6 - 0
models/__init__.py

@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+
+import account_interest
+import account_interest_config
+import res_partner_interest
+import eiru_account_interest

+ 62 - 0
models/account_interest.py

@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+import openerp.addons.decimal_precision as dp
+from datetime import datetime
+
+class AccountInterest(models.Model):
+    _name = 'account.interest'
+
+    name = fields.Char()
+    date = fields.Date('Date', help="Fecha de operación")
+    state = fields.Selection([('cancel', 'Cancelado'),('open', 'Abierto'),('paid', 'Pagado')],'Estado del pago', default="open", help="Estado")
+    comment = fields.Text('Comment', help="Información adicional")
+    ## Cliente
+    customer_id = fields.Many2one('res.partner', string="customer")
+    ## factura
+    invoice_id = fields.Many2one('account.invoice', string='Invoice Reference', ondelete='restrict', index=True)
+    reference = fields.Char(string='Invoice Reference', help="Invoice Reference")
+    ## Currency
+    currency_id = fields.Many2one('res.currency', string="Currency", help="Moneda de la operación")
+    ## Line
+    lines_ids = fields.One2many('account.interest.line', 'interest_id', string='interest line')
+
+    '''
+        Create
+    '''
+    @api.model
+    def create(self, vals):
+        interest = super(AccountInterest, self).create(vals)
+        interest.write({'name':("INTEREST/%06d" % (interest.id))})
+        return interest
+
+'''
+    Invoice
+'''
+class accountInvoiceInterest(models.Model):
+    _inherit = 'account.invoice'
+
+    interest_ids = fields.One2many('account.interest', 'invoice_id', string=' Account Interest')
+
+'''
+    partner
+'''
+class ResPartnerInterest(models.Model):
+    _inherit = 'res.partner'
+
+    interest_ids = fields.One2many('account.interest', 'customer_id', string=' Account Interest')
+
+class AccountInterestLine(models.Model):
+    _name = 'account.interest.line'
+
+    ## Interest
+    interest_id = fields.Many2one('account.interest', string='Account Interest', ondelete='cascade', index=True, required=True)
+    move_line_id = fields.Many2one('account.move.line', string="Registros del diario", help="Registros del diario")
+    amount = fields.Float('amount', digits_compute=dp.get_precision('Account'), required=True, help="Monto del pago")
+    amount_residual = fields.Float('amount', digits_compute=dp.get_precision('Account'), required=True, help="Monto del pago")
+    amount_interest = fields.Float('amount', digits_compute=dp.get_precision('Account'), required=True, help="Monto del pago")
+    date_maturity = fields.Date()
+    expired_days = fields.Integer('Expired Days ')
+    invoice = fields.Many2one('account.invoice', string='Invoice Reference', index=True)
+    reference = fields.Char(string='Invoice Reference', help="Invoice Reference")
+    state = fields.Selection([('cancel','Cancelado'),('open','Abierto'),('invoiced','Facturado')],'Estado del pago', default="open")
+    amount_dicount = fields.Float('amount disconut', digits_compute=dp.get_precision('Account'), help="Monto del descuento")

+ 47 - 0
models/account_interest_config.py

@@ -0,0 +1,47 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api
+import openerp.addons.decimal_precision as dp
+
+class accountInterestConfig(models.Model):
+    _name = 'account.interest.config'
+
+    name = fields.Char('Name', required=True, readonly=True)
+    ''' Interest '''
+    interest_rate_year = fields.Float('Tasa de interés anual(%)', digits=(3,6), digits_compute=dp.get_precision('Interest'), required=True, help="Tasa de interés anual(%)")
+    interest_rate = fields.Float('Tasa de interés calculado(%)', digits=(3,6), digits_compute=dp.get_precision('Interest'), required=True, help="Tasa de interés diario(%)")
+    comment = fields.Text('Comment', help="Información adicional")
+    active =  fields.Boolean('active',default=True)
+    ''' Invoice '''
+    invoice_journal_id = fields.Many2one('account.journal', string='Journal', required=True, domain="[('type', '=', 'sale')]", help="Diario que utilizara para la facturación de interés.")
+    invoice_account_id = fields.Many2one('account.account', string='Account', required=True, domain="[('type', '=', 'receivable')]")
+    ''' Line '''
+    line_account_id = fields.Many2one('account.account', string='Account', required=True, domain=[('type', '=', 'other')])
+    line_tax_id = fields.Many2one('account.tax', string='Tax', domain=[('type_tax_use', '=', 'sale')])
+
+    @api.model
+    def create_default_interest_config(self):
+        decimal_precision = self.env['decimal.precision'].precision_get('Interest')
+
+        interest = {
+            'name': 'INTERÉS POR MORA',
+            'interest_rate_year': round(48.66, decimal_precision),
+            'interest_rate': round((48.66 / 365), decimal_precision),
+            'comment':  'Configuración de interés por mora \n'
+                        'Calculo:\n'
+                        '       Tasa de interés por día = (Tasa de interés anual(%) / 365(cantidad de días del año))',
+            'invoice_journal_id': 1,
+            'invoice_account_id': 16,
+            'line_account_id': 113,
+            'line_tax_id': 1
+        }
+
+        interesConfig = self.env['account.interest.config'].search([('name', '=', interest['name'])])
+
+        if (not interesConfig):
+            interesConfig.create(interest)
+
+    @api.one
+    @api.onchange('interest_rate_year','interest_rate')
+    def calculate_interest(self):
+        decimal_precision = self.env['decimal.precision'].precision_get('Interest')
+        self.interest_rate = round((self.interest_rate_year / 365), decimal_precision)

+ 222 - 0
models/eiru_account_interest.py

@@ -0,0 +1,222 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api, _
+## date
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT
+from pytz import timezone
+from datetime import datetime,timedelta
+## logging
+import logging
+_logger = logging.getLogger(__name__)
+
+
+class EiruAccountInterest(models.Model):
+    _inherit = 'account.interest'
+
+    '''
+        timezone
+    '''
+    def get_timezone(self):
+        return timezone(self._context.get('tz') or self.env.user.tz)
+    '''
+        Datetime
+    '''
+    def get_datetime(self):
+        return datetime.now(self.get_timezone()).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+    '''
+        Date
+    '''
+    def get_date(self):
+        return datetime.now(self.get_timezone()).strftime(DEFAULT_SERVER_DATE_FORMAT)
+    '''
+        Convert Str --> Datetime
+    '''
+    def _convert_str_to_datetime(self, date):
+        return datetime.strptime(date,DEFAULT_SERVER_DATE_FORMAT)
+
+    '''
+        GET Account Interest
+    '''
+    @api.model
+    def get_account_interest(self, id):
+        return [{
+            'id': interest.id,
+            'name': interest.name,
+            'state': interest.state,
+            'invoiceId': interest.invoice_id.id,
+            'customer': [{
+                'id': partner.id,
+                'name': partner.name,
+            } for partner in self.env['res.partner'].browse(interest.customer_id.id)],
+            'currency': [{
+                'id': currency.id,
+                'symbol': currency.symbol,
+                'rate': currency.rate,
+                'thousandsSeparator': currency.thousands_separator,
+                'decimalSeparator': currency.decimal_separator,
+                'decimalPlaces': currency.decimal_places,
+                'position': currency.position,
+            } for currency in self.env['res.currency'].browse(interest.currency_id.id)]
+        }for interest in self.env['account.interest'].browse(id)]
+
+    '''
+        get Account Invoice
+    '''
+    @api.model
+    def get_account_invoice_interest(self, invoice=None, partner=None):
+        _logger.info('Verify invoice')
+        domain = [('state', '=', 'open')]
+
+        if (invoice):
+            domain.append(('id', '=', invoice))
+        if (partner):
+            domain.append(('partner_id.id', '=', partner))
+
+        accountInvoice = self.env['account.invoice'].search(domain)
+        for invoice in accountInvoice:
+            self.get_move_line_in_invoice(invoice.id)
+
+    '''
+        Get move Line.
+    '''
+    def get_move_line_in_invoice(self, invoice):
+        _logger.info('Get Move Line')
+        accountInvoice = self.env['account.invoice'].browse(invoice)
+
+        dateServer = self._convert_str_to_datetime(self.get_date())
+
+        domain = [('state','!=','draft'), ('credit','<=', 0), ('partner_id','=',accountInvoice.partner_id.id),('invoice','=',accountInvoice.id)]
+        for line in self.env['account.move.line'].search(domain):
+            expiredDays = dateServer - self._convert_str_to_datetime(line.date_maturity)
+            if ((line.amount_residual <= 0) or (expiredDays.days <= 0)):
+                continue
+
+            ''' verify account.interest '''
+            accountInterest = self.eiru_create_account_interest(accountInvoice.id)
+
+            ''' verify account.interest.line '''
+            interrstLine = self.eiru_create_account_interest_lines(accountInvoice.id, accountInterest.id, line.id, expiredDays.days)
+
+    '''
+        Create Account Interest
+    '''
+    def eiru_create_account_interest(self, invoiceId):
+        _logger.info('Verify account interest')
+        accountInvoice = self.env['account.invoice'].browse(invoiceId)
+
+        domain = [('invoice_id', '=', accountInvoice.id),('customer_id.id', '=', accountInvoice.partner_id.id)]
+        accountInterest = self.env['account.interest'].search(domain)
+
+        dateServer = self.get_date()
+
+        if (not accountInterest):
+            accountInterest = self.env['account.interest'].create({
+                'invoice_id': accountInvoice.id,
+                'customer_id': accountInvoice.partner_id.id,
+                'date': dateServer,
+                'currency_id': accountInvoice.currency_id.id,
+                'reference': accountInvoice.number,
+            })
+
+        return accountInterest
+
+    '''
+        create / write
+    '''
+    def eiru_create_account_interest_lines(self, invoiceId, interestID, moveId, expiredDays):
+        _logger.info('Verify account interest Line')
+        decimal_precision = self.env['decimal.precision'].precision_get('Account')
+        accountInvoice = self.env['account.invoice'].browse(invoiceId)
+        accountInterest = self.env['account.interest'].browse(interestID)
+        moveLine = self.env['account.move.line'].browse(moveId)
+        interestConfig = self.env['account.interest.config'].search([('active', '=', True)])
+        interestLine = self.env['account.interest.line'].search([('interest_id.id', '=', accountInterest.id),('move_line_id.id', '=',moveLine.id)])
+
+        decimalPlaces = accountInvoice.currency_id.decimal_places
+        if (not decimalPlaces):
+            decimalPlaces = 0
+
+        amount = (moveLine.amount_currency or moveLine.debit or 0.0)
+        amount_residual = (moveLine.amount_residual_currency or moveLine.amount_residual or 0.0)
+
+        line = {
+            'move_line_id': moveLine.id,
+            'amount': round(amount, decimalPlaces),
+            'date_maturity': moveLine.date_maturity,
+            'expired_days': expiredDays,
+            'amount_residual': round(amount_residual,decimalPlaces),
+            'amount_interest': round((expiredDays * (amount_residual * (interestConfig.interest_rate / 100))),decimalPlaces),
+            'interest_id': accountInterest.id
+        }
+
+        if (not interestLine):
+            return interestLine.create(line)
+
+        return interestLine.write(line)
+
+    '''    ____                _         ___                 _
+          / ___|_ __ ___  __ _| |_ ___  |_ _|_ ____   _____ (_) ___ ___
+         | |   | '__/ _ \/ _` | __/ _ \  | || '_ \ \ / / _ \| |/ __/ _ \
+         | |___| | |  __/ (_| | ||  __/  | || | | \ V / (_) | | (_|  __/
+          \____|_|  \___|\__,_|\__\___| |___|_| |_|\_/ \___/|_|\___\___|
+    '''
+    @api.model
+    def create_account_invoice_interest(self, id, interestLine):
+        _logger.info('Create invoice interest')
+        accountInterest = self.env['account.interest'].browse(id)
+        if (not accountInterest):
+            return {
+                'state': False,
+                'message': 'Error en obtener el registro de interés'
+            }
+        interestConfig = self.env['account.interest.config'].search([('active', '=', True)])
+        if (not interestConfig):
+            return {
+                'state': False,
+                'message': 'Error en obtener Configuración de interés'
+            }
+        decimal_precision = self.env['decimal.precision'].precision_get('Account')
+        dateServer = self.get_date()
+
+        invoice_line = []
+        for line in interestLine:
+            accountInterestLine = self.env['account.interest.line'].browse(line['id'])
+            descrip= "Deuda vencida al %s, días atrasados %d" % (accountInterestLine.date_maturity, accountInterestLine.expired_days)
+
+            if (line['discount'] > 0):
+                descrip = descrip+" Descuento %d" % (line['discount'])
+
+            if (accountInterestLine):
+                invoice_line.append([0,False, {
+                    'name': descrip,
+                    'account_id': interestConfig.line_account_id.id,
+                    'quantity': 1,
+                    'price_unit': round((accountInterestLine.amount_interest - line['discount']),decimal_precision),
+                    'price_subtotal': round((accountInterestLine.amount_interest - line['discount']),decimal_precision),
+                    'partner_id': accountInterest.customer_id.id,
+                    'invoice_line_tax_id': [(6, 0,[x.id for x in interestConfig.line_tax_id])],
+                }])
+
+        invoice = {
+            'partner_id': accountInterest.customer_id.id,
+            'currency_id': accountInterest.currency_id.id,
+            'date_invoice': dateServer,
+            'journal_id': interestConfig.invoice_journal_id.id,
+            'account_id': interestConfig.invoice_account_id.id,
+            'invoice_line': invoice_line,
+        }
+
+        accountInvoice = self.env['account.invoice'].create(invoice)
+        accountInvoice.signal_workflow('invoice_open')
+        for line in interestLine:
+            accountInterestLine = self.env['account.interest.line'].browse(line['id'])
+            if (accountInterestLine):
+                accountInterestLine.write({
+                    'invoice': accountInvoice.id,
+                    'reference':  accountInvoice.number,
+                    'state': 'invoiced'
+                })
+
+        return {
+            'state': True,
+            'message': 'Operación exitosa'
+        }

+ 12 - 0
models/res_partner_interest.py

@@ -0,0 +1,12 @@
+# -*- coding: utf-8 -*-
+from openerp import models, fields, tools, api, _
+
+class ResPartnerInterest(models.Model):
+    _inherit = 'res.partner'
+
+    '''
+    '''
+    @api.model
+    def eiru_account_interest_verify(self, id):
+        interest = self. env['account.interest']
+        interest.get_account_invoice_interest(None,id)

+ 4 - 0
security/ir.model.access.csv

@@ -0,0 +1,4 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_account_interest_from,account.interest,model_account_interest,account.group_account_user,1,1,1,1
+access_account_interest_line_from,account.interest.line,model_account_interest_line,account.group_account_user,1,1,1,1
+access_account_interest_config_from,account.interest.config,model_account_interest_config,account.group_account_user,1,1,1,1

+ 169 - 0
static/src/css/style.css

@@ -0,0 +1,169 @@
+.button-interes-invoice {
+  height: 35px;
+}
+.interes-payments-discount {
+    text-align: right;
+    font-size: 11pt;
+    border: 1px solid #e3e3e3 !important;
+    background: #e6e4e4 !important;
+}
+.interest-discount-in {
+    background: white !important;
+}
+
+.payments-interest-label {
+    width: 150px;
+    height: 30px;
+    font-size: 14px;
+    padding-top: 5px;
+    padding-left: 5px;
+}
+.payments-interest-group {
+    width: calc(100% - 150px);
+    height: 30px;
+    padding-left: 5px;
+    padding-right: 5px;
+    float: right;
+}
+.payments-interest-input {
+    width: calc(100% - 30px);
+    height: 30px;
+    float: left;
+    font-size: 12pt;
+    text-align: right;
+}
+.payments-interest-symbol{
+    width: 30px;
+    height: 30px;
+    float: right;
+    text-align: center;
+    font-size: 16pt;
+    border: 1px solid #ccc;
+    background: #e3e3e3;
+}
+/*
+  * Table
+ */
+.select-interes-payments {
+    height: 20px !important;
+    margin: 0px;
+}
+.account-interest-table {
+    margin-top: 0px !important;
+}
+.expired-account-modal .selected-interest {
+     background: #d4e2f3  !important;
+}
+.expired-account-modal  .modal-head-wrapper-account-interest {
+    width: 100%;
+}
+.expired-account-modal .modal-item-account-interest {
+    width: 100%;
+    height: 110px;
+    overflow-y: auto;
+}
+.expired-account-modal .account-interest-table table tbody tr {
+    height: 35px;
+}
+.expired-account-modal .account-interest-table table thead tr {
+    height: 40px !important;
+}
+/******************************************************************************/
+/* id */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(1){
+    display: none;
+}
+.expired-account-modal table thead tr th:nth-child(1){
+    display: none;
+}
+/******************************************************************************/
+/* checkbox */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(2){
+    width: 33px ;
+}
+.expired-account-modal .account-interest-table table thead tr th:nth-child(2){
+    width: 33px;
+}
+/******************************************************************************/
+/* Vencimineto */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(3){
+    width: 130px ;
+    font-size: 11pt;
+    padding-left: 10px;
+    padding-top: 8px;
+}
+/* Vencimineto */
+.expired-account-modal .account-interest-table table thead tr th:nth-child(3){
+    width: 130;
+    padding-left: 10px;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/******************************************************************************/
+/* Atrasos */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(4){
+    width: 80px ;
+    /* padding-right: 10px; */
+    text-align: center;
+    font-size: 11pt;
+    padding-top: 8px;
+}
+/* Atrasos */
+.expired-account-modal .account-interest-table table thead tr th:nth-child(4){
+    width: 80px;
+    text-align: center;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/******************************************************************************/
+/* Interes */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(5){
+    width: 190px ;
+    padding-right: 10px;
+    text-align: right;
+    font-size: 11pt;
+    padding-top: 8px;
+}
+/* Interes */
+.expired-account-modal .account-interest-table table thead tr th:nth-child(5){
+    width: 190px;
+    padding-right: 20px;
+    text-align: center;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/******************************************************************************/
+/* Descuento */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(6){
+    width: 200px ;
+    padding-right: 10px;
+    text-align: right;
+    font-size: 11pt;
+    padding-top: 8px;
+}
+/* Descuento */
+.expired-account-modal .account-interest-table table thead tr th:nth-child(6){
+    width: 215px;
+    padding-right: 20px;
+    text-align: center;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/******************************************************************************/
+/* Total */
+.expired-account-modal .account-interest-table table tbody tr td:nth-child(7){
+    width: 190px ;
+    padding-right: 10px;
+    text-align: right;
+    font-size: 11pt;
+    padding-top: 8px;
+}
+/* Total */
+.expired-account-modal .account-interest-table table thead tr th:nth-child(7){
+    width: 190px;
+    padding-right: 20px;
+    text-align: center;
+    font-size: 12pt;
+    font-weight: bold;
+}
+/******************************************************************************/

+ 265 - 0
static/src/js/account_interest_invoice.js

@@ -0,0 +1,265 @@
+(function() {
+
+    openerp.widgetInstanceInterestInvoice = null;
+    openerp.parentInstanceInterestInvoice = {};
+    var QWeb = openerp.web.qweb;
+    var instanceWeb = openerp.web;
+
+    openerp.BankPaymentsInterestInvoice = openerp.Widget.extend({
+        template: 'eiruAccountInterest.Invoice',
+        id: undefined,
+        buttons: undefined,
+        accountInterest: [],
+        accountInterestline: [],
+        /* init */
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+        /* start */
+        start: function () {
+            var self = this;
+            this.$el.click(function(){
+                self.fetchInitial();
+            });
+        },
+        /* Check state*/
+        checkState: function(id, state) {
+            var self = this;
+            self.id = id;
+        },
+        /* Reload Page*/
+        reloadPage: function() {
+            openerp.parentInstanceInterestInvoice.reload();
+        },
+        /* Description: Función para remover el modal */
+        removeModal: function() {
+            $('.expired-account-modal').remove();
+            $('.modal-backdrop').remove();
+        },
+        /* Método inicial  */
+        fetchInitial: function() {
+            var self = this;
+            self.fetchAccountInterest(self.id).then(function(accountInterest) {
+                return accountInterest;
+            }).then(function(accountInterest) {
+                self.accountInterest = accountInterest;
+                return self.fetchAccountInterestLine(self.id)
+            }).then(function(accountInterestline) {
+                self.accountInterestline = accountInterestline
+                return self.showModalPayments();
+            });
+        },
+        /* Get account.interest */
+        fetchAccountInterest: function(id) {
+            var accountInterest = new instanceWeb.Model('account.interest');
+            return accountInterest.call('get_account_interest', [id], {
+                context: new instanceWeb.CompoundContext()
+            });
+        },
+        /* GET account.interest.line */
+        fetchAccountInterestLine: function(id) {
+            var interestLine = new openerp.web.Model('account.interest.line');
+            var fields = ['id','interest_id','amount_interest','date_maturity','expired_days','state'];
+            var domain = [['interest_id', '=', id],['state', '=', 'open']];
+            return interestLine.query(fields).filter(domain).order_by('date_maturity').all();
+        },
+
+        /* Modal */
+        showModalPayments: function() {
+            var self = this;
+            var line = [];
+            var results = true;
+            var defer =$.Deferred();
+            var interest = self.accountInterest[0];
+            var currency = !!interest.currency.length ? interest.currency[0] : [];
+            var insteresPayments = [];
+
+            _.each(self.accountInterestline, function(item){
+                line.push({
+                    'id' : item.id,
+                    'amount_interest': item.amount_interest,
+                    'amountInterestformat': instanceWeb.formatCurrency(item.amount_interest, currency),
+                    'date_maturity': item.date_maturity,
+                    'dateMaturity': moment(item.date_maturity).format("DD-MM-YYYY"),
+                    'expired_days': item.expired_days,
+                    'state': item.state,
+                });
+            })
+
+            var modal = QWeb.render('eiruAccountInterest.ModaleInvoice',{
+                'line': line
+            });
+
+            $('.openerp_webclient_container').after(modal);
+            $('.expired-account-modal').modal();
+
+            var tableRow = $('.expired-account-modal').find('.table-tbody').find('tr');
+            /* Detalles */
+            var amountSymbolInterest = $('.expired-account-modal').find('.amount-symbol-interest');
+            var amountInterest = $('.expired-account-modal').find('.amount-interest');
+            var amountInterésDiscount = $('.expired-account-modal').find('.amount-interés-discount');
+            var amountInterésPayments = $('.expired-account-modal').find('.amount-interés-payments');
+            /* button Crear Factura */
+            var buttonAccept = $('.expired-account-modal').find('.button-accept');
+
+            amountSymbolInterest.text(currency.symbol)
+
+            tableRow.keyup(function(e) {
+                if (($(e.target).index() !== 0) && ($(e.target)[0].className !== 'interes-payments-discount'))
+                    return false;
+
+                if (e.key === currency.decimalSeparator && currency.decimalPlaces > 0)
+                    return false ;
+
+                var discount = $($(e.target).closest('tr').children()[5]).find('.interes-payments-discount');
+                var amount = instanceWeb.unFormatCurrency( discount.val());
+                amount = instanceWeb.formatCurrency(amount, currency)
+
+                discount.val(amount);
+                discount.css('border-color','#ccc');
+            });
+
+            tableRow.focusout(function(e) {
+                if (($(e.target).index() !== 0) ||(($(e.target).index() === 0) && ($(e.target)[0].className === 'select-interes-payments')))
+                    return false;
+
+                var interest = ($(e.target).closest('tr').children()[4].textContent).trim();
+                var discount = $($(e.target).closest('tr').children()[5]).find('.interes-payments-discount');
+                var total = $($(e.target).closest('tr').children()[6]);
+
+                var amountInterst = instanceWeb.unFormatCurrency(interest);
+                var amountDiscount = instanceWeb.unFormatCurrency(discount.val());
+
+                if (amountInterst < amountDiscount) {
+                    instanceWeb.notification.do_warn("Atencion", "El monto del descuento supera el interés calculado.");
+                    amountDiscount = 0;
+                    discount.val(instanceWeb.formatCurrency(amountDiscount, currency));
+                    discount.css('border-color','red');
+                }
+
+                idRow = parseInt(($(e.target).closest('tr').children()[0].textContent).trim());
+                _.each(insteresPayments, function(item) {
+                    if (item.id === idRow)
+                        item.discount = amountDiscount;
+                });
+
+                total.text(instanceWeb.formatCurrency((amountInterst - amountDiscount),currency));
+                self.reloadAmountInterest(insteresPayments, amountInterest, amountInterésDiscount, amountInterésPayments, currency)
+            });
+
+            /* Selecionar las cuotas */
+            tableRow.click(function(e) {
+
+                if (($(e.target).index() !== 0) ||(($(e.target).index() === 0) && ($(e.target)[0].className !== 'select-interes-payments')))
+                    return false;
+
+                var discount = $($(e.target).closest('tr').children()[5]).find('.interes-payments-discount');
+                idRow = parseInt(($(e.target).closest('tr').children()[0].textContent).trim());
+
+                if (e.target.checked === true) {
+                    idRow = parseInt(($(e.target).closest('tr').children()[0].textContent).trim());
+                    var interest = ($(e.target).closest('tr').children()[4].textContent).trim();
+
+                    $(e.target).closest('tr').addClass('selected-interest');
+                    discount.removeAttr("disabled");
+                    discount.addClass('interest-discount-in');
+
+                    insteresPayments.push({
+                        'id': idRow,
+                        'interes': instanceWeb.unFormatCurrency(interest),
+                        'discount': instanceWeb.unFormatCurrency(discount.val())
+                    });
+
+                } else {
+                    var indexSplice= undefined;
+                    _.each(insteresPayments, function(item, index){
+                        if (item.id === idRow)
+                            indexSplice = index
+                    })
+                    insteresPayments.splice(indexSplice,1);
+
+                    $(e.target).closest('tr').removeClass('selected-interest');
+                    discount.attr("disabled", true);
+                    discount.removeClass('interest-discount-in');
+                    discount.val(0);
+                }
+
+                self.reloadAmountInterest(insteresPayments, amountInterest, amountInterésDiscount, amountInterésPayments, currency)
+
+            });
+            buttonAccept.click(function(e) {
+
+                if (!insteresPayments.length){
+                    instanceWeb.notification.do_warn("Atencion", "Debes seleccionar al menos una linea del interés, para generar la factura.");
+                }
+
+                self.cretaIvoiceInterest(insteresPayments).then(function(resultsInvoice) {
+                    return resultsInvoice;
+                }).then(function(resultsInvoice) {
+                    if (!resultsInvoice.state) {
+                        results = resultsInvoice.state;
+                        instanceWeb.notification.do_warn("Atencion", message);
+                    }
+                    self.reloadPage();
+                    self.removeModal(e);
+                });
+
+                defer.resolve(results);
+            });
+
+            /* Cerrar */
+            $('.expired-account-modal').on('hidden.bs.modal', function(e) {
+                results = false;
+                defer.resolve(results);
+                self.removeModal(e);
+            });
+            return defer;
+        },
+        /* */
+        reloadAmountInterest: function( interestSelected, interest, discount,payments, currency){
+            var discountAmount = _.reduce(_.map(interestSelected, function(item){return item.discount}), function(memo, num){ return memo + num; }, 0);
+            var interestAmount = _.reduce(_.map(interestSelected, function(item){return item.interes}), function(memo, num){ return memo + num; }, 0);
+            interest.val(instanceWeb.formatCurrency(interestAmount, currency));
+            discount.val(instanceWeb.formatCurrency(discountAmount, currency));
+            payments.val(instanceWeb.formatCurrency((interestAmount - discountAmount), currency));
+        },
+
+        /*createI Invoice */
+        cretaIvoiceInterest: function(insteresPayments){
+            var self = this;
+            var accountInterest = new instanceWeb.Model('account.interest');
+            return accountInterest.call('create_account_invoice_interest', [self.id, insteresPayments], {
+                context: new instanceWeb.CompoundContext()
+            });
+        }
+    });
+
+    if (openerp.web && openerp.web.FormView) {
+        openerp.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'account.interest')
+                    return;
+
+                openerp.parentInstanceInterestInvoice = this;
+
+                if (openerp.widgetInstanceInterestInvoice) {
+                    openerp.widgetInstanceInterestInvoice.checkState(record.id, record.state);
+                    if (this.$el.find('.button-interes-invoice').length !== 0)
+                        return;
+                }
+
+                if (this.$el.find('.button-interes-invoice').length !== 0)
+                    return;
+
+                openerp.widgetInstanceInterestInvoice = new openerp.BankPaymentsInterestInvoice(this);
+                var element =this.$el.find('.oe_form').find('.account-interes-invoice');
+
+                openerp.widgetInstanceInterestInvoice.appendTo(element[0]);
+                openerp.widgetInstanceInterestInvoice.checkState(record.id, record.state);
+            }
+        });
+    }
+})();

+ 93 - 0
static/src/js/verify_interest.js

@@ -0,0 +1,93 @@
+(function() {
+
+    openerp.widgetInstanceInterest = null;
+    openerp.parentInstanceInterest = {};
+    var QWeb = openerp.web.qweb;
+    var instanceWeb = openerp.web;
+    openerp.BankPaymentsInterest = openerp.Widget.extend({
+        template: 'verify.Interest',
+        id: undefined,
+        buttons: undefined,
+        bankPayments: [],
+        /* init */
+        init: function(parent) {
+            this._super(parent);
+            this.buttons = parent.$buttons;
+        },
+        /* start */
+        start: function () {
+            var self = this;
+            this.$el.click(function(){
+                self.fetchInitial();
+            });
+            self.buttons.click(function(e) {
+                /* C (Crear) */
+                if (e.target.accessKey === 'C')
+                    self.$el.css('display','none');
+                /* E (Editar) */
+                if (e.target.accessKey === 'E')
+                    self.$el.css('display','none');
+                /* S (Guarrdar) */
+                if (e.target.accessKey === 'S')
+                    self.$el.css('display','flex');
+                /* D (Cancelar) */
+                if (e.target.accessKey === 'D')
+                    self.$el.css('display','flex');
+            });
+        },
+        /* Check state*/
+        checkState: function(id, state) {
+            var self = this;
+            self.id = id;
+        },
+        /* Reload Page*/
+        reloadPage: function() {
+            openerp.parentInstanceInterest.reload();
+        },
+        // /* Método inicial  */
+        fetchInitial: function() {
+            var self = this;
+            self.fetchBankPaymentsJournal(self.id).then(function(bankPayments) {
+                return bankPayments;
+            }).then(function(bankPayments) {
+                self.bankPayments = bankPayments;
+                return self.reloadPage();
+            });
+        },
+        fetchBankPaymentsJournal: function(id) {
+            var bankStatement = new instanceWeb.Model('res.partner');
+            return bankStatement.call('eiru_account_interest_verify',[id],{
+                context: new instanceWeb.CompoundContext()
+            });
+        },
+    });
+
+    if (openerp.web && openerp.web.FormView) {
+        openerp.web.FormView.include({
+            load_record: function(record) {
+                this._super.apply(this, arguments);
+
+                if (this.model !== 'res.partner')
+                    return;
+
+                openerp.parentInstanceInterest = this;
+
+                if (openerp.widgetInstanceInterest) {
+                    openerp.widgetInstanceInterest.checkState(record.id, record.state);
+                    if (this.$el.find('.verify-interest-partner').length !== 0)
+                        return;
+                }
+
+                if (this.$el.find('.verify-interest-partner').length !== 0)
+                    return;
+
+                openerp.widgetInstanceInterest = new openerp.BankPaymentsInterest(this);
+
+                var element =this.$el.find('.oe_form').find('.eiru-verify-interest');
+
+                openerp.widgetInstanceInterest.appendTo(element[0]);
+                openerp.widgetInstanceInterest.checkState(record.id, record.state);
+            }
+        });
+    }
+})();

+ 8 - 0
static/src/xml/account_interest_invoice.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<templates xml:space="preserve">
+    <t t-name="eiruAccountInterest.Invoice">
+        <button class="button-interes-invoice oe_button oe_form_button_save oe_highlight">
+            <div>Generar Factura </div>
+        </button>
+  </t>
+</templates>

+ 105 - 0
static/src/xml/modal/modal_account_interest_invoice.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="eiruAccountInterest.ModaleInvoice">
+        <div class="modal in expired-account-modal" tabindex="-1" role="dialog">
+            <div class="modal-dialog modal-lg" role="document">
+                <div class="modal-content openerp">
+                    <!-- title  -->
+                    <div class="modal-header">
+                        <button type="button" class="close" data-dismiss="modal" aria-label="Close" aria-hidden="true">×</button>
+                        <h3 class="modal-title">Generar Factura</h3>
+                    </div>
+                    <!-- Body -->
+                    <div class="modal-body">
+                        <!-- Table -->
+                        <div class=" oe_view_manager_body account-interest-table">
+                            <div class="modal-head-wrapper-account-interest">
+                                <table class="oe_list_content">
+                                    <thead >
+                                        <tr class="oe_list_header_columns"  >
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <th class="oe_list_header_char oe_sortable"></th>
+                                            <th class="oe_list_header_char oe_sortable">Vencimiento</th>
+                                            <th class="oe_list_header_char oe_sortable">Atrasos</th>
+                                            <th class="oe_list_header_char oe_sortable">Interés calculado</th>
+                                            <th class="oe_list_header_char oe_sortable">Descuento</th>
+                                            <th class="oe_list_header_char oe_sortable">Total</th>
+                                        </tr>
+                                    </thead>
+                                </table>
+                            </div>
+                            <div class="modal-item-account-interest">
+                                <table class="oe_list_content">
+                                    <tbody class="table-tbody">
+                                        <tr t-foreach="line" t-as="line">
+                                            <td>
+                                                <t t-esc="line_value.id"/>
+                                            </td>
+                                            <td>
+                                                <input type="checkbox" class="select-interes-payments"></input>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.dateMaturity"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.expired_days"/>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.amountInterestformat"/>
+                                            </td>
+                                            <td>
+                                                <input type="text" class="interes-payments-discount" disabled="disabled" value='0'></input>
+                                            </td>
+                                            <td>
+                                                <t t-esc="line_value.amountInterestformat"/>
+                                            </td>
+                                        </tr>
+                                    </tbody>
+                                </table>
+                            </div>
+                        </div>
+
+
+                        <div class="row ">
+                            <div class="col-xs-6">
+                                <label class="payments-interest-label">Total Interés</label>
+                                <div class="payments-interest-group">
+                                  <input type="text" class="form-control payments-interest-input amount-interest" readonly="readonly" value="0"></input>
+                                  <div class="payments-interest-symbol">
+                                    <span class="amount-symbol-interest"></span>
+                                  </div>
+                                </div>
+                            </div>
+                            <div class="col-xs-6">
+                                <label class="payments-interest-label">Total Descuentos</label>
+                                <div class="payments-interest-group">
+                                  <input type="text" class="form-control payments-interest-input amount-interés-discount" readonly="readonly" value="0"></input>
+                                  <div class="payments-interest-symbol">
+                                    <span class="amount-symbol-interest"></span>
+                                  </div>
+                                </div>
+                            </div>
+                        </div>
+                        <div class="row">
+                            <div class="col-xs-6">
+                                <label class="payments-interest-label">Total a Pagar</label>
+                                <div class="payments-interest-group">
+                                  <input type="text" class="form-control payments-interest-input amount-interés-payments" readonly="readonly" value="0"></input>
+                                  <div class="payments-interest-symbol">
+                                    <span class="amount-symbol-interest"></span>
+                                  </div>
+                                </div>
+                            </div>
+                        </div>
+
+                    </div>
+                    <!-- Pie de Pagina -->
+                    <div class="modal-footer paymnets-invoice-footer">
+                        <button type="button" class="oe_button oe_form_button oe_highlight button-accept">Crear Factura</button>
+                        <button type="button" class="oe_button oe_form_button oe_link dismmis-modal" data-dismiss="modal">Salir</button>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </t>
+</template>

+ 11 - 0
static/src/xml/verify_interest.xml

@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<templates xml:space="preserve">
+    <t t-name="verify.Interest">
+        <div class="paymnet-charge">
+            <button class="verify-interest-partner oe_button oe_form_button oe_highlight">
+                <div>Verificar deuda</div>
+            </button>
+        </div>
+  </t>
+</templates>

+ 93 - 0
views/account_interest.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- from -->
+        <record id="eiru_account_interest_from" model="ir.ui.view">
+            <field name="name">eiru.account.interest.from</field>
+            <field name="model">account.interest</field>
+            <field name="arch" type="xml">
+                <form string="Interés por mora" create="0" edit="0">
+                    <header>
+                        <field name="state" widget="statusbar"/>
+                    </header>
+                    <sheet>
+                        <h1>
+                            <field name='name'/>
+                        </h1>
+                        <group col="2" >
+                            <group>
+                                <field name="customer_id" string="Cliente" />
+                                <field name="reference" string="Factura" />
+                                <field name="currency_id" string="Moneda" />
+                            </group>
+                            <group>
+                                <field name="date"/>
+                            </group>
+                        </group>
+                        <notebook>
+                            <page string="Detalles">
+                                <div class="account-interes-invoice"></div>
+                                <field name="lines_ids" >
+                                    <!-- <tree string="Detalles de la deuda" editable="bottom" edit='false' delete='false' create='false' > -->
+                                    <tree string="Detalles de la deuda" editable="bottom" create="false" delete="false">
+                                        <field name="date_maturity" string="Vencimiento"/>
+                                        <field name="amount" string="Monto de la cuota"/>
+                                        <field name="amount_residual" string="Saldo pendiente"/>
+                                        <field name="expired_days" string="Días atrasados"/>
+                                        <field name="amount_interest" string="interés calculado"/>
+                                        <field name="amount_dicount" string="Descuento"/>
+                                        <field name="reference" string="Factura"/>
+                                        <field name="state" string="Estado"/>
+                                    </tree>
+                                </field>
+                            </page>
+                        </notebook>
+                        <group>
+                            <field name="comment" string="Información adicional"/>
+                        </group>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_account_interest_tree" model="ir.ui.view">
+			<field name="name">eiru.account.interest.tree</field>
+			<field name="model">account.interest</field>
+			<field name="arch" type="xml">
+				<tree create="0" edit="0">
+					<field name="name" />
+					<field name="date" />
+					<field name="customer_id" />
+					<field name="invoice_id" />
+					<field name="currency_id" />
+					<field name="state" string="Estado"/>
+				</tree>
+			</field>
+		</record>
+        <!--  Search -->
+        <record id="eiru_account_interest_search" model="ir.ui.view">
+            <field name="name">eiru.account.interest.search</field>
+            <field name="model">account.interest</field>
+            <field name="arch" type="xml">
+                <search>
+                    <group string="Agrupar por">
+                        <filter string="Cliente " context="{'group_by':'customer_id'}"/>
+                        <filter string="Moneda" context="{'group_by': 'currency_id'}"/>
+                        <filter string="Estado" context="{'group_by':'state'}"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+        <!-- Actions  -->
+        <record id="eiru_account_interest_actions" model="ir.actions.act_window">
+            <field name="name">Interés por mora</field>
+            <field name="res_model">account.interest</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+        <!-- Menu -->
+        <menuitem id="eiru_account_interest_menu" name="Interés moratorios" parent="account.menu_finance" sequence="2"/>
+        <menuitem id="eiru_account_interest" name="Interés por mora" parent="eiru_account_interest_menu" action="eiru_account_interest_actions" sequence="1" />
+    </data>
+</openerp>

+ 99 - 0
views/account_interest_config.xml

@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <!-- function -->
+        <function model="account.interest.config" name="create_default_interest_config"/>
+        <!-- from -->
+        <record id="eiru_account_interest_config_from" model="ir.ui.view">
+            <field name="name">eiru.account.interest.config.from</field>
+            <field name="model">account.interest.config</field>
+            <field name="arch" type="xml">
+                <form string="Interés por mora" create="0" delete="0">
+                    <sheet>
+                        <h1>
+                            <field name='name'/>
+                        </h1>
+                        <notebook>
+                            <!-- Interest -->
+                            <page string="Configuración de interés.">
+                                <group col="2" string="Detalles del interés" >
+                                    <group>
+                                        <field name="interest_rate_year" on_change='1'/>
+                                        <field name="interest_rate" on_change='1'/>
+                                    </group>
+                                </group>
+                                <group>
+                                    <field name="comment" string="Información adicional"/>
+                                </group>
+                            </page>
+                            <!-- Invoice && Line  -->
+                            <page string="Configuraciones de facturas">
+                                <!-- Invoice -->
+                                <group col="2" string="Detalles de la factura">
+                                    <group>
+                                        <label for="invoice_journal_id" string="Diario" style="width: 200px"></label>
+                                        <field name="invoice_journal_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                        <label for="invoice_account_id" string="Contabilidad" style="width: 200px"></label>
+                                        <field name="invoice_account_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                    </group>
+                                    <group>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Diario:</b>
+                                            Diario que utilizara para la facturación del interés, valor por defecto = <b style="color: #7C7BAD;">Diario de ventas (PYG)</b>
+                                        </div>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Contabilidad:</b>
+                                            Cuenta de la empresa utilizada para la facturación del interés, valor por defecto = <b style="color: #7C7BAD;"> 122000 Créditos por Ventas / Deudores Morosos</b>
+                                        </div>
+                                    </group>
+                                </group>
+
+                                <!-- Line -->
+                                <group string="Detalle de los ítem de la factura" col="2">
+                                    <group>
+                                        <label for="line_account_id" string="Contabilidad" style="width: 200px"></label>
+                                        <field name="line_account_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                        <label for="line_tax_id" string="Impuestos" style="width: 200px"></label>
+                                        <field name="line_tax_id" nolabel="1" options="{'no_create': True, 'no_open': True}"/>
+                                    </group>
+                                    <group>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Contabilidad</b>
+                                            Cuenta de ingresos o gastos  relacionado con la linea del interés, valor por defecto = <b style="color: #7C7BAD;">411.01 Ventas - Categoria de productos 01</b>
+                                        </div>
+                                        <div colspan="4">
+                                            <b style="font-size: 11pt;">Impuestos</b>
+                                            Impuestos aplicado sobre las lineas de los interés = <b style="color: #7C7BAD;">IVA 10% Venta</b>
+                                        </div>
+                                    </group>
+                                </group>
+                            </page>
+                        </notebook>
+                    </sheet>
+                </form>
+            </field>
+        </record>
+        <!-- Tree -->
+        <record id="eiru_account_interest_config_tree" model="ir.ui.view">
+			<field name="name">eiru.account.interest.config.tree</field>
+			<field name="model">account.interest.config</field>
+			<field name="arch" type="xml">
+				<tree create="0" edit="0">
+					<field name="name" />
+					<field name="interest_rate_year" />
+					<field name="interest_rate" />
+				</tree>
+			</field>
+		</record>
+        <!-- Actions  -->
+        <record id="eiru_account_interest_config_actions" model="ir.actions.act_window">
+            <field name="name">Configuración de Interés</field>
+            <field name="res_model">account.interest.config</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="target">current</field>
+        </record>
+        <!-- Menu -->
+        <menuitem id="eiru_account_interest_config" name="Configuración de Interés" parent="eiru_account_interest_menu" action="eiru_account_interest_config_actions" sequence="5" />
+    </data>
+</openerp>

+ 27 - 0
views/account_invoice_interst.xml

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+		<record id="account_invoices_interest" model="ir.ui.view">
+			<field name="name">account.invoices.interest</field>
+			<field name="model">account.invoice</field>
+			<field name="inherit_id" ref="account.invoice_form"/>
+			<field name="arch" type="xml">
+				<notebook>
+					 <page string=" Interés por  mora">
+	 					<div class="eiru-verify-interest"></div>
+						 <group col="1">
+						   <field name="interest_ids" readonly="1" nolabel='1' delete='false' create='false'>
+							   <tree delete='false' create='false' widget="many2onebutton">
+								   <field name="name"/>
+								   <field name="date"/>
+								   <field name="reference"/>
+								   <field name="state"/>
+							   </tree>
+						   </field>
+						 </group>
+					 </page>
+				</notebook>
+			</field>
+		</record>
+	</data>
+</openerp>

+ 9 - 0
views/data_decimal_precision_interest.xml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+        <record forcecreate="True" id="decimal_payment" model="decimal.precision">
+            <field name="name">Interest</field>
+            <field name="digits">6</field>
+        </record>
+    </data>
+</openerp>

+ 31 - 0
views/eiru_verify_interest.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+		<record id="view_eiru_verify_interest" model="ir.ui.view">
+			<field name="name">view.eiru.verify.interest</field>
+			<field name="model">res.partner</field>
+			<field name="inherit_id" ref="base.view_partner_form"/>
+			<field name="arch" type="xml">
+				<field name="street" position="before">
+					<div class="eiru-verify-interest"></div>
+				</field>
+
+				<notebook>
+					 <page string=" Interés por  mora">
+						 <group col="1">
+						   <field name="interest_ids" readonly="1" nolabel='1' delete='false' create='false'>
+							   <tree delete='false' create='false'>
+								   <field name="name"/>
+								   <field name="date"/>
+								   <field name="invoice_id"/>
+								   <field name="state"/>
+							   </tree>
+						   </field>
+						 </group>
+					 </page>
+				</notebook>
+
+			</field>
+		</record>
+	</data>
+</openerp>

+ 11 - 0
views/templates.xml

@@ -0,0 +1,11 @@
+<openerp>
+    <data>
+        <template id="eiru_account_interest.eiru_assets" name="eiru_account_interest_eiru_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/eiru_account_interest/static/src/css/style.css"/>
+                <script type="text/javascript" src="/eiru_account_interest/static/src/js/verify_interest.js"/>
+                <script type="text/javascript" src="/eiru_account_interest/static/src/js/account_interest_invoice.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>