summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Dony <odo@openerp.com>2011-10-05 03:04:01 +0200
committerOlivier Dony <odo@openerp.com>2011-10-05 03:04:01 +0200
commitc018cd9bf34f2c9cedbb7a5af2fed70045c86529 (patch)
tree4d8a38ad7c99eca69748b8417528077605b489da
parent0f13e3052c2431505064d390b86a670160304ce1 (diff)
[ADD] account: moved web addon into account module (needs review)
bzr revid: odo@openerp.com-20111005010401-x6t8bdo7th8t2won
-rw-r--r--addons/account/__openerp__.py3
-rw-r--r--addons/account/static/src/js/edi_invoice.js50
-rw-r--r--addons/account/static/src/xml/edi_invoice.xml130
3 files changed, 183 insertions, 0 deletions
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 77f0f47569a..0bed25f87bc 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -150,6 +150,9 @@ module named account_voucher.
'test/test_edi_invoice.yml',
'test/account_report.yml',
],
+ "js": [
+ 'static/src/js/edi_invoice.js'
+ ],
'installable': True,
'active': False,
'certificate': '0080331923549',
diff --git a/addons/account/static/src/js/edi_invoice.js b/addons/account/static/src/js/edi_invoice.js
new file mode 100644
index 00000000000..c31c803d665
--- /dev/null
+++ b/addons/account/static/src/js/edi_invoice.js
@@ -0,0 +1,50 @@
+/*---------------------------------------------------------
+ * OpenERP Web_edi
+ *---------------------------------------------------------*/
+//
+openerp.edi.InvoiceEdiView = Class.extend({
+ init: function(element, edi){
+ var self = this;
+ this.edi_document = eval(edi.document)
+ this.$element = element;
+ QWeb.add_template("/web_edi_invoice/static/src/xml/edi_invoice.xml");
+ this.$_element = $('<div>')
+ .appendTo(document.body)
+ .delegate('#oe_edi_invoice_button_pay', 'click', {'edi': edi} , this.do_pay)
+ },
+ start: function() {
+ },
+ render: function(){
+ template = "InvoiceEdiView";
+ if (this.$current) {
+ this.$current.remove();
+ }
+ this.$current = this.$_element.clone(true);
+ this.$current.empty().append($(QWeb.render(template, {'invoices': this.edi_document})));
+ this.$element.append(this.$current);
+ },
+ do_pay: function(e){
+ $element = $(e.view.document.body)
+ token = e.data.edi.token
+ db = e.data.edi.db
+ var current_url = $(location).attr('href')
+ var pathName = current_url.substring(0, current_url.lastIndexOf('/') +1);
+
+ if ($element.find('#oe_edi_invoice_rd_pay_paypal').attr('checked') == true)
+ {
+ alert('Pay Invoice using Paypal service');
+
+ }
+ if ($element.find('#oe_edi_invoice_rd_pay_google_checkout').attr('checked') == true)
+ {
+ alert('Pay Invoice using Google Checkout');
+ }
+ if ($element.find('#oe_edi_invoice_rd_pay_bank').attr('checked') == true)
+ {
+ alert('Pay Invoice using Bankwire Trasnfer')
+ }
+ }
+});
+
+openerp.edi.forms.add('edi_center_account_invoice' , 'openerp.edi.InvoiceEdiView');
+// vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax:
diff --git a/addons/account/static/src/xml/edi_invoice.xml b/addons/account/static/src/xml/edi_invoice.xml
new file mode 100644
index 00000000000..9f68c7fedf8
--- /dev/null
+++ b/addons/account/static/src/xml/edi_invoice.xml
@@ -0,0 +1,130 @@
+<template>
+<t t-name="InvoiceEdiView">
+ <div>
+
+ <t t-foreach="invoices" t-as="invoice">
+ <t t-if="!invoice.reconciled">
+ <table width="100%">
+ <tr>
+ <td>
+ <b>Pay this Invoice in Online</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <hr/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input type="radio" id="oe_edi_invoice_rd_pay_paypal" name="oe_edi_invoice_rd_pay" value="paypal">Paypal</input>
+ <input type="radio" id="oe_edi_invoice_rd_pay_google_checkout" name="oe_edi_invoice_rd_pay" value="google">Google Checkout</input>
+ <input type="radio" id="oe_edi_invoice_rd_pay_bank" name="oe_edi_invoice_rd_pay" value="bank">Bank wire Transfer</input>
+ <button type="button" id="oe_edi_invoice_button_pay" name="oe_edi_invoice_button_pay">Pay</button>
+ </td>
+ </tr>
+
+ </table>
+ </t>
+ <h1>Invoice <t t-esc="invoice.internal_number"/>: <t t-esc="invoice.amount_total"/><t t-esc="invoice.currency_id[1]"/></h1>
+ <p>
+ <b><t t-esc="invoice.company_id[1]"/></b><br/>
+ <t t-esc="invoice.company_address.zip"/> <t t-esc="invoice.company_address.street"/><br/>
+ <t t-esc="invoice.company_address.city"/><br/>
+ <t t-esc="invoice.company_address.country_id[1]"/><br/>
+ Phone: <t t-esc="invoice.company_address.phone"/>
+ </p>
+ <p align="right">
+ <b><t t-esc="invoice.partner_id[1]"/></b><br/>
+ <t t-esc="invoice.address_invoice_id[1]"/>
+ </p>
+ <table width="100%">
+ <tr>
+ <th align="left">Description</th>
+ <th align="left">Date</th>
+ <th align="left">Origin</th>
+ <th align="left">Your Reference</th>
+ </tr>
+ <tr>
+ <td align="left"><t t-esc="invoice.name"/><t t-esc="invoice.comment"/></td>
+ <td align="left"><t t-esc="invoice.date_invoice"/></td>
+ <td align="left"><t t-esc="invoice.origin"/></td>
+ <td align="left"><t t-esc="invoice.reference"/></td>
+ </tr>
+ </table>
+ <table width="100%" >
+ <tr>
+ <th align="left">Product Description</th>
+ <th align="left">Quantity</th>
+ <th align="left">Unit Price</th>
+ <th align="left">Discount</th>
+ <th align="right">Price</th>
+ </tr>
+
+ <t t-if="invoice.invoice_line" t-foreach="invoice.invoice_line" t-as="invoice_line">
+ <tr>
+ <td align="left"><t t-esc="invoice_line.name"/><br/><t t-esc="invoice_line.note"/></td>
+ <td align="left"><t t-esc="invoice_line.quantity"/><t t-esc="invoice_line.uos_id[1]"/></td>
+ <td align="left"><t t-esc="invoice_line.price_unit"/></td>
+ <td align="left"><t t-esc="invoice_line.discount"/></td>
+ <td align="right"><t t-esc="invoice_line.price_subtotal"/><t t-esc="invoice.currency_id[1]"/></td>
+ </tr>
+ </t>
+
+
+ <tr>
+ <td colspan="3"></td>
+ <td colspan="2"><hr/></td>
+ </tr>
+ <tr>
+ <td colspan="3"></td>
+ <td>Net Total: </td>
+ <td align="right"><t t-esc="invoice.amount_untaxed"/><t t-esc="invoice.currency_id[1]"/></td>
+ </tr>
+ <tr>
+ <td colspan="3"></td>
+ <td>Taxes: </td>
+ <td align="right"><t t-esc="invoice.amount_tax"/><t t-esc="invoice.currency_id[1]"/></td>
+ </tr>
+ <tr>
+ <td colspan="3"></td>
+ <td colspan="2"><hr/></td>
+ </tr>
+ <tr>
+ <td colspan="3"></td>
+ <td>Total: </td>
+ <td align="right"><t t-esc="invoice.amount_total"/><t t-esc="invoice.currency_id[1]"/></td>
+ </tr>
+ <tr>
+<td colspan="3">
+ <table width="100%">
+ <tr>
+ <th align="left">Tax</th>
+ <th align="right">Base Amount</th>
+ <th align="right">Amount</th>
+
+ </tr>
+
+ <t t-if="invoice.tax_line"><t t-foreach="invoice.tax_line" t-as="tax_line">
+ <tr>
+ <td align="left"><t t-esc="tax_line.name"/></td>
+ <td align="right"><t t-esc="tax_line.base_amount"/><t t-esc="invoice.currency_id[1]"/></td>
+ <td align="right"><t t-esc="tax_line.amount"/><t t-esc="invoice.currency_id[1]"/></td>
+ </tr>
+ </t>
+
+ </t>
+
+ </table></td><td colspan="2"></td>
+ </tr>
+ </table>
+ </t>
+
+ </div>
+
+
+</t>
+
+
+
+</template>