Ver código fonte

commit inicial

Rodney Elpidio Enciso Arias 5 anos atrás
commit
10dd5df4df

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+*.pyc

+ 2 - 0
__init__.py

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

+ 21 - 0
__openerp__.py

@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+{
+    'name' : 'Impresion de pagare Crifin',
+    'version' : '1.0',
+    'description' : """
+Este modulo Permite realizar impresión del pagare CRIFIN
+    """,
+    'author' : 'Eiru',
+    'category' : 'Service',
+    'depends' : [
+        'account',
+        'eiru_num2word',
+    ],
+    'data' : [
+        'views/template.xml',
+        'views/account_invoice_view.xml'
+    ],
+    'qweb' : ['static/src/xml/*.xml',],
+    'installable' : True,
+    'auto_install' : False,
+}

+ 102 - 0
models.py

@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+
+from openerp import models, fields, api
+
+class AccountInvoice(models.Model):
+	_inherit = 'account.invoice'
+
+	@api.model
+	def getAccountInvoicePagare(self,domain):
+		AccountInvoice = self.env['account.invoice'].search(domain)
+		values = []
+		for invoice in AccountInvoice:
+			values.append({
+                # ID
+				'id': invoice.id,
+                'number': invoice.number,
+                'origin': invoice.origin,
+                'date_invoice': invoice.date_invoice,
+                'user_name': invoice.user_id.name,
+                'amount_untaxed': invoice.amount_untaxed,
+                'amount_tax': invoice.amount_untaxed,
+                'amount_total': invoice.amount_untaxed,
+                # PARTNER INFO
+				'partner_id':[{
+					'id': invoice.partner_id.id,
+					'name': invoice.partner_id.name,
+					'ruc': invoice.partner_id.ruc,
+					'address': invoice.partner_id.street,
+	                'phone': invoice.partner_id.phone,
+	                'mobile': invoice.partner_id.mobile,
+				}],
+                # COMPANY INFO
+				'company_id': [{
+					'id':invoice.user_id.company_id.id,
+	                'name': invoice.user_id.company_id.name,
+	                'logo': invoice.user_id.company_id.logo,
+	                'phone': invoice.user_id.company_id.phone,
+				}],
+				# CURRENCY INFO
+				'currency_id':[{
+					'id': invoice.currency_id.id,
+					'name': invoice.currency_id.name,
+					'symbol': invoice.currency_id.symbol,
+					'thousands_separator': invoice.currency_id.thousands_separator,
+					'decimal_separator': invoice.currency_id.decimal_separator,
+					'decimal_places': invoice.currency_id.decimal_places,
+					'symbol_position': invoice.currency_id.symbol,
+				}],
+			})
+
+		return values
+
+	@api.model
+	def getAccountInvoicePagareQuota(self,domain):
+		AccountInvoice = self.env['account.invoice'].search(domain)
+		AccountMoveLine = self.env['account.move.line'].search([('move_id','=',AccountInvoice.number),('debit','>',0)],order='date_maturity')
+
+		i = 1
+		x = len(AccountMoveLine)
+		values = []
+
+		for line in AccountMoveLine:
+			amount = 0
+			value = 0
+			state = 'No pagado'
+			if(line.reconcile_ref != False):
+				if(line.amount_residual == 0):
+					state = 'Pagado'
+
+				if(line.amount_residual > 0):
+					value = line.debit - line.amount_residual
+					state = 'Amortizado'
+
+			values.append({
+				'date': line.date_maturity,
+				'name': 'Cuota ' + str(i) + ' / ' + str(x),
+				'state': state,
+				'value': value,
+				'amount': line.debit,
+				'residual': line.amount_residual,
+			})
+			i = i + 1
+
+		return values
+
+class AccountInvoiceLine(models.Model):
+	_inherit = 'account.invoice.line'
+
+	@api.model
+	def getAccountInvoiceLinePagare(self,domain):
+		AccountInvoiceLine = self.env['account.invoice.line'].search(domain)
+		values = []
+		for line in AccountInvoiceLine:
+			values.append({
+				'id': line.id,
+                'name': line.name,
+                'quantity': line.quantity,
+                'price_unit': line.price_unit,
+                'price_subtotal': line.price_subtotal,
+			})
+
+		return values

BIN
static/description/icon.png


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

@@ -0,0 +1,4 @@
+.pagare_button_box {
+    width: auto;
+    float: left;
+}

Diferenças do arquivo suprimidas por serem muito extensas
+ 269 - 0
static/src/js/main.js


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

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<template xml:space="preserve">
+    <t t-name="pagare_crifin.PagareCrifin">
+        <button class="print_pagare_crifin oe_button oe_form_button oe_highlight">
+            <div> Imprimir Pagare</div>
+        </button>
+    </t>
+</template>

+ 18 - 0
views/account_invoice_view.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+        <record model="ir.ui.view" id="account_invoice_button">
+            <field name="name">account.invoice.button</field>
+            <field name="model">account.invoice</field>
+            <field name="inherit_id" ref="account.invoice_form"/>
+            <field name="arch" type="xml">
+				<xpath expr="//button[@name='invoice_print']" position="replace">
+					<div class="pagare_button_box" attrs="{'invisible': [('state','not in',['open','paid'])]}"></div>
+				</xpath>
+				<xpath expr="//button[@name='action_invoice_sent']" position="attributes">
+					<attribute name="invisible">1</attribute>
+				</xpath>
+            </field>
+        </record>
+	</data>
+</openerp>

+ 10 - 0
views/template.xml

@@ -0,0 +1,10 @@
+<openerp>
+    <data>
+        <template id="pagare_crifin.assets_backend" name="pagare_crifin_assets" inherit_id="eiru_assets.assets">
+            <xpath expr="." position="inside">
+                <link rel="stylesheet" href="/pagare_crifin/static/src/css/style.css"/>
+                <script type="text/javascript" src="/pagare_crifin/static/src/js/main.js"/>
+            </xpath>
+        </template>
+    </data>
+</openerp>

Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff