[IMP] edi: ported web part to 7.0 + removed the EDI preview- and export-related parts
As started in previous commits, in 7.0 there is no more static storage of exported EDI documents, and they are instead replaced by the improved portal - which will provide the preview as well as export capabilities. (The export might be added in a second phase) bzr revid: odo@openerp.com-20121016122913-ndl0l36buhku3kxy
This commit is contained in:
parent
825746d087
commit
c7757baf77
|
@ -19,9 +19,8 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv, orm
|
||||
from openerp.osv import osv
|
||||
from edi import EDIMixin
|
||||
from edi.models import edi
|
||||
|
||||
INVOICE_LINE_EDI_STRUCT = {
|
||||
'name': True,
|
||||
|
@ -137,9 +136,14 @@ class account_invoice(osv.osv, EDIMixin):
|
|||
|
||||
# imported company_address = new partner address
|
||||
address_info = edi_document.pop('company_address')
|
||||
if '__import_model' not in address_info and '__model' not in address_info:
|
||||
# for pre-7.0 EDI format - address used to be a record of res.partner.address
|
||||
address_info['__import_model'] = 'res.partner'
|
||||
if 'name' not in address_info:
|
||||
# for pre-7.0 EDI format - address name was not required
|
||||
address_info['name'] = src_company_name
|
||||
address_info['type'] = 'invoice'
|
||||
address_info['is_company'] = True
|
||||
address_info.update(partner_value)
|
||||
address_id = res_partner.edi_import(cr, uid, address_info, context=context)
|
||||
|
||||
|
@ -190,7 +194,7 @@ class account_invoice(osv.osv, EDIMixin):
|
|||
invoice_type = invoice_type.startswith('in_') and invoice_type.replace('in_','out_') or invoice_type.replace('out_','in_')
|
||||
edi_document['type'] = invoice_type
|
||||
|
||||
#import company as a new partner
|
||||
# import company as a new partner
|
||||
partner_id = self._edi_import_company(cr, uid, edi_document, context=context)
|
||||
|
||||
# Set Account
|
||||
|
|
|
@ -45,39 +45,39 @@
|
|||
edi_doc = self.generate_edi(cr, uid, [invoice])
|
||||
assert isinstance(json.loads(edi_doc)[0], dict), 'EDI doc should be a JSON dict'
|
||||
-
|
||||
Then I import a sample EDI document of another customer invoice
|
||||
Then I import a sample EDI document of another customer invoice from OpenERP 7.0
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
import time
|
||||
edi_document = {
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.random_invoice_763jsms",
|
||||
"__id": "account:b33adf8a-decd-11f0-a4de-702a04e25700.random_invoice_763jsms",
|
||||
"__module": "account",
|
||||
"__model": "account.invoice",
|
||||
"__version": [6,1,0],
|
||||
"internal_number": time.strftime("SAJ/%Y/002"),
|
||||
"__version": [7,0,0],
|
||||
"internal_number": time.strftime("SAJ/%Y/070"),
|
||||
"company_address": {
|
||||
"__id": "base:b22acf7a-ddcd-11e0-a4db-701a04e25543.main_address",
|
||||
"__id": "base:b33adf8a-decd-11f0-a4de-702a04e25700.main_address",
|
||||
"__module": "base",
|
||||
"__model": "res.partner",
|
||||
"city": "Gerompont",
|
||||
"name": "Company main address",
|
||||
"zip": "1367",
|
||||
"country_id": ["base:b22acf7a-ddcd-11e0-a4db-701a04e25543.be", "Belgium"],
|
||||
"country_id": ["base:b33adf8a-decd-11f0-a4de-702a04e25700.be", "Belgium"],
|
||||
"phone": "(+32).81.81.37.00",
|
||||
"street": "Chaussee de Namur 40",
|
||||
"bank_ids": [
|
||||
["base:b22acf7a-ddcd-11e0-a4db-701a04e25543.res_partner_bank-ZrTWzesfsdDJzGbp","Sample bank: 123465789-156113"]
|
||||
["base:b33adf8a-decd-11f0-a4de-702a04e25700.res_partner_bank-ZrTWzesfsdDJzGbp","Sample bank: 70-123465789-156113"]
|
||||
],
|
||||
},
|
||||
"company_id": ["account:b22acf7a-ddcd-11e0-a4db-701a04e25543.res_company_test11", "Thomson pvt. ltd."],
|
||||
"company_id": ["account:b33adf8a-decd-11f0-a4de-702a04e25700.res_company_test11", "Thomson pvt. ltd."],
|
||||
"currency": {
|
||||
"__id": "base:b22acf7a-ddcd-11e0-a4db-701a04e25543.EUR",
|
||||
"__id": "base:b33adf8a-decd-11f0-a4de-702a04e25700.EUR",
|
||||
"__module": "base",
|
||||
"__model": "res.currency",
|
||||
"code": "EUR",
|
||||
"symbol": "€",
|
||||
},
|
||||
"partner_id": ["account:b22acf7a-ddcd-11e0-a4db-701a04e25543.res_partner_test20", "Junjun wala"],
|
||||
"partner_id": ["account:b33adf8a-decd-11f0-a4de-702a04e25700.res_partner_test20", "Junjun wala"],
|
||||
"partner_address": {
|
||||
"__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.res_partner_address_7wdsjasdjh",
|
||||
"__module": "base",
|
||||
|
@ -92,7 +92,7 @@
|
|||
"date_invoice": time.strftime('%Y-%m-%d'),
|
||||
"name": "sample invoice",
|
||||
"tax_line": [{
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.account_invoice_tax-4g4EutbiEMVl",
|
||||
"__id": "account:b33adf8a-decd-11f0-a4de-702a04e25700.account_invoice_tax-4g4EutbiEMVl",
|
||||
"__module": "account",
|
||||
"__model": "account.invoice.tax",
|
||||
"amount": 1000.0,
|
||||
|
@ -103,21 +103,21 @@
|
|||
"invoice_line": [{
|
||||
"__module": "account",
|
||||
"__model": "account.invoice.line",
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.account_invoice_line-1RP3so",
|
||||
"uos_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_uom_unit", "Unit"],
|
||||
"__id": "account:b33adf8a-decd-11f0-a4de-702a04e25700.account_invoice_line-1RP3so",
|
||||
"uos_id": ["product:b33adf8a-decd-11f0-a4de-702a04e25700.product_uom_unit", "Unit"],
|
||||
"name": "PC Assemble SC234",
|
||||
"price_unit": 10.0,
|
||||
"product_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_product_3", "[PCSC234] PC Assemble SC234"],
|
||||
"product_id": ["product:b33adf8a-decd-11f0-a4de-702a04e25700.product_product_3", "[PCSC234] PC Assemble SC234"],
|
||||
"quantity": 1.0
|
||||
},
|
||||
{
|
||||
"__module": "account",
|
||||
"__model": "account.invoice.line",
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.account_invoice_line-u2XV5",
|
||||
"uos_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_uom_unit", "Unit"],
|
||||
"__id": "account:b33adf8a-decd-11f0-a4de-702a04e25700.account_invoice_line-u2XV5",
|
||||
"uos_id": ["product:b33adf8a-decd-11f0-a4de-702a04e25700.product_uom_unit", "Unit"],
|
||||
"name": "PC on Demand",
|
||||
"price_unit": 100.0,
|
||||
"product_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_product_5", "[PC-DEM] PC on Demand"],
|
||||
"product_id": ["product:b33adf8a-decd-11f0-a4de-702a04e25700.product_product_5", "[PC-DEM] PC on Demand"],
|
||||
"quantity": 5.0
|
||||
}]
|
||||
}
|
||||
|
@ -128,10 +128,10 @@
|
|||
# check bank info on partner
|
||||
assert len(invoice_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"
|
||||
bank_info = invoice_new.partner_id.bank_ids[0]
|
||||
assert bank_info.acc_number == "Sample bank: 123465789-156113", 'Expected "Sample bank: 123465789-156113", got %s' % bank_info.acc_number
|
||||
assert bank_info.acc_number == "Sample bank: 70-123465789-156113", 'Expected "Sample bank: 70-123465789-156113", got %s' % bank_info.acc_number
|
||||
|
||||
assert invoice_new.partner_id.supplier, 'Imported Partner is not marked as supplier'
|
||||
assert invoice_new.reference == time.strftime("SAJ/%Y/002"), "internal number is not stored in reference"
|
||||
assert invoice_new.reference == time.strftime("SAJ/%Y/070"), "internal number is not stored in reference"
|
||||
assert invoice_new.reference_type == 'none', "reference type is not set to 'none'"
|
||||
assert invoice_new.internal_number == False, "internal number is not reset"
|
||||
assert invoice_new.journal_id.id, "journal id is not selected"
|
||||
|
@ -153,3 +153,110 @@
|
|||
for inv_tax in invoice_new.tax_line:
|
||||
assert inv_tax.manual, "tax line not set to manual"
|
||||
assert inv_tax.account_id, "missing tax line account"
|
||||
-
|
||||
Then I import a sample EDI document of another customer invoice from OpenERP 6.1 (to test backwards compatibility)
|
||||
-
|
||||
!python {model: account.invoice}: |
|
||||
import time
|
||||
edi_document = {
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.random_invoice_763jsms",
|
||||
"__module": "account",
|
||||
"__model": "account.invoice",
|
||||
"__version": [6,1,0],
|
||||
"internal_number": time.strftime("SAJ/%Y/061"),
|
||||
"company_address": {
|
||||
"__id": "base:b22acf7a-ddcd-11e0-a4db-701a04e25543.main_address",
|
||||
"__module": "base",
|
||||
"__model": "res.partner.address",
|
||||
"city": "Gerompont",
|
||||
"zip": "1367",
|
||||
"country_id": ["base:b22acf7a-ddcd-11e0-a4db-701a04e25543.be", "Belgium"],
|
||||
"phone": "(+32).81.81.37.00",
|
||||
"street": "Chaussee de Namur 40",
|
||||
"bank_ids": [
|
||||
["base:b22acf7a-ddcd-11e0-a4db-701a04e25543.res_partner_bank-ZrTWzesfsdDJzGbp","Sample bank: 123465789-156113"]
|
||||
],
|
||||
},
|
||||
"company_id": ["account:b22acf7a-ddcd-11e0-a4db-701a04e25543.res_company_test11", "Thomson pvt. ltd."],
|
||||
"currency": {
|
||||
"__id": "base:b22acf7a-ddcd-11e0-a4db-701a04e25543.EUR",
|
||||
"__module": "base",
|
||||
"__model": "res.currency",
|
||||
"code": "EUR",
|
||||
"symbol": "€",
|
||||
},
|
||||
"partner_id": ["account:b22acf7a-ddcd-11e0-a4db-701a04e25543.res_partner_test20", "Junjun wala"],
|
||||
"partner_address": {
|
||||
"__id": "base:5af1272e-dd26-11e0-b65e-701a04e25543.res_partner_address_7wdsjasdjh",
|
||||
"__module": "base",
|
||||
"__model": "res.partner.address",
|
||||
"phone": "(+32).81.81.37.00",
|
||||
"street": "Chaussee de Namur 40",
|
||||
"city": "Gerompont",
|
||||
"zip": "1367",
|
||||
"country_id": ["base:5af1272e-dd26-11e0-b65e-701a04e25543.be", "Belgium"],
|
||||
},
|
||||
"date_invoice": time.strftime('%Y-%m-%d'),
|
||||
"name": "sample invoice",
|
||||
"tax_line": [{
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.account_invoice_tax-4g4EutbiEMVl",
|
||||
"__module": "account",
|
||||
"__model": "account.invoice.tax",
|
||||
"amount": 1000.0,
|
||||
"manual": True,
|
||||
"name": "sale tax",
|
||||
}],
|
||||
"type": "out_invoice",
|
||||
"invoice_line": [{
|
||||
"__module": "account",
|
||||
"__model": "account.invoice.line",
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.account_invoice_line-1RP3so",
|
||||
"uos_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_uom_unit", "PCE"],
|
||||
"name": "Basic PC",
|
||||
"price_unit": 10.0,
|
||||
"product_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_product_pc1", "[PC1] Basic PC"],
|
||||
"quantity": 1.0
|
||||
},
|
||||
{
|
||||
"__module": "account",
|
||||
"__model": "account.invoice.line",
|
||||
"__id": "account:b22acf7a-ddcd-11e0-a4db-701a04e25543.account_invoice_line-u2XV5",
|
||||
"uos_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_uom_unit", "PCE"],
|
||||
"name": "Medium PC",
|
||||
"price_unit": 100.0,
|
||||
"product_id": ["product:b22acf7a-ddcd-11e0-a4db-701a04e25543.product_product_pc3", "[PC3] Medium PC"],
|
||||
"quantity": 5.0
|
||||
}]
|
||||
}
|
||||
invoice_id = self.edi_import(cr, uid, edi_document, context=context)
|
||||
assert invoice_id, 'EDI import failed'
|
||||
invoice_new = self.browse(cr, uid, invoice_id)
|
||||
|
||||
# check bank info on partner
|
||||
assert len(invoice_new.partner_id.bank_ids) == 1, "Expected 1 bank entry related to partner"
|
||||
bank_info = invoice_new.partner_id.bank_ids[0]
|
||||
assert bank_info.acc_number == "Sample bank: 123465789-156113", 'Expected "Sample bank: 123465789-156113", got %s' % bank_info.acc_number
|
||||
|
||||
assert invoice_new.partner_id.supplier, 'Imported Partner is not marked as supplier'
|
||||
assert invoice_new.reference == time.strftime("SAJ/%Y/061"), "internal number is not stored in reference"
|
||||
assert invoice_new.reference_type == 'none', "reference type is not set to 'none'"
|
||||
assert invoice_new.internal_number == False, "internal number is not reset"
|
||||
assert invoice_new.journal_id.id, "journal id is not selected"
|
||||
assert invoice_new.type == 'in_invoice', "Invoice type was not set properly"
|
||||
assert len(invoice_new.invoice_line) == 2, "invoice lines are not same"
|
||||
for inv_line in invoice_new.invoice_line:
|
||||
if inv_line.name == 'Basic PC':
|
||||
assert inv_line.uos_id.name == "Unit" , "uom is not same"
|
||||
assert inv_line.price_unit == 10 , "price unit is not same"
|
||||
assert inv_line.quantity == 1 , "product qty is not same"
|
||||
assert inv_line.price_subtotal == 10, "price sub total is not same"
|
||||
elif inv_line.name == 'Medium PC':
|
||||
assert inv_line.uos_id.name == "Unit" , "uom is not same"
|
||||
assert inv_line.price_unit == 100 , "price unit is not same"
|
||||
assert inv_line.quantity == 5 , "product qty is not same"
|
||||
assert inv_line.price_subtotal == 500, "price sub total is not same"
|
||||
else:
|
||||
raise AssertionError('unknown invoice line: %s' % inv_line)
|
||||
for inv_tax in invoice_new.tax_line:
|
||||
assert inv_tax.manual, "tax line not set to manual"
|
||||
assert inv_tax.account_id, "missing tax line account"
|
||||
|
|
|
@ -35,7 +35,6 @@ class Controller(openerp.addons.web.http.Controller):
|
|||
def retrieve(self, req, dbname, token):
|
||||
""" retrieve the user info (name, login or email) corresponding to a signup token """
|
||||
registry = RegistryManager.get(dbname)
|
||||
user_info = None
|
||||
with registry.cursor() as cr:
|
||||
res_partner = registry.get('res.partner')
|
||||
user_info = res_partner.signup_retrieve_info(cr, openerp.SUPERUSER_ID, token)
|
||||
|
|
|
@ -20,18 +20,9 @@
|
|||
##############################################################################
|
||||
import logging
|
||||
|
||||
from . import controllers
|
||||
from . import models
|
||||
from . import edi_service
|
||||
from models.edi import EDIMixin, edi
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
# web
|
||||
try:
|
||||
import openerp.addons.web.controllers
|
||||
except ImportError:
|
||||
_logger.warn(
|
||||
"""Could not load openerp-web section of EDI, EDI will not behave correctly
|
||||
|
||||
To fix, launch openerp-web in embedded mode""")
|
||||
from .models.edi import EDIMixin, edi
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
import openerp.addons.web.common.http as openerpweb
|
||||
import simplejson
|
||||
|
||||
import openerp.addons.web.http as openerpweb
|
||||
import openerp.addons.web.controllers.main as webmain
|
||||
|
||||
class EDI(openerpweb.Controller):
|
||||
|
@ -7,10 +9,17 @@ class EDI(openerpweb.Controller):
|
|||
|
||||
@openerpweb.httprequest
|
||||
def import_url(self, req, url):
|
||||
d = self.template(req)
|
||||
d["init"] = 's.edi.edi_import("%s");'%(url)
|
||||
r = webmain.html_template % d
|
||||
return r
|
||||
modules = webmain.module_boot(req) + ['edi']
|
||||
modules_str = ','.join(modules)
|
||||
modules_json = simplejson.dumps(modules)
|
||||
js = "\n ".join('<script type="text/javascript" src="%s"></script>' % i for i in webmain.manifest_list(req, modules_str, 'js'))
|
||||
css = "\n ".join('<link rel="stylesheet" href="%s">' % i for i in webmain.manifest_list(req, modules_str, 'css'))
|
||||
return webmain.html_template % {
|
||||
'js': js,
|
||||
'css': css,
|
||||
'modules': modules_json,
|
||||
'init': 's.edi.edi_import("%s");' % url,
|
||||
}
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def import_edi_url(self, req, url):
|
||||
|
|
|
@ -24,14 +24,12 @@ import hashlib
|
|||
import json
|
||||
import logging
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
import openerp
|
||||
import openerp.release as release
|
||||
import openerp.netsvc as netsvc
|
||||
from openerp.modules.registry import RegistryManager
|
||||
from openerp.osv import osv, fields
|
||||
from tools.translate import _
|
||||
from tools.safe_eval import safe_eval as eval
|
||||
|
@ -540,7 +538,7 @@ class EDIMixin(object):
|
|||
assert self._name == edi.get('__import_model') or \
|
||||
('__import_model' not in edi and self._name == edi.get('__model')), \
|
||||
"EDI Document Model and current model do not match: '%s' (EDI) vs '%s' (current)." % \
|
||||
(edi['__model'], self._name)
|
||||
(edi.get('__model'), self._name)
|
||||
|
||||
# First check the record is now already known in the database, in which case it is ignored
|
||||
ext_id_members = split_external_id(edi['__id'])
|
||||
|
|
|
@ -23,7 +23,6 @@ import logging
|
|||
from openerp.osv import osv
|
||||
from edi import EDIMixin
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.tools.translate import _
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
RES_PARTNER_EDI_STRUCT = {
|
||||
|
|
|
@ -1,210 +0,0 @@
|
|||
/** EDI content **/
|
||||
.openerp .company_logo {
|
||||
background-size: 180px 46px;
|
||||
}
|
||||
.oe_edi_view {
|
||||
width: 65%;
|
||||
vertical-align: top;
|
||||
padding: 0px 25px;
|
||||
border-right: 1px solid #D2CFCF;
|
||||
}
|
||||
.oe_edi_sidebar_container {
|
||||
width: 35%;
|
||||
padding: 0px 10px;
|
||||
vertical-align: top;
|
||||
}
|
||||
button.oe_edi_action_print {
|
||||
font-size: 1.5em;
|
||||
margin-left: 35%;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
button.oe_edi_action_print img {
|
||||
vertical-align: bottom;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
/** EDI Sidebar **/
|
||||
.oe_edi_sidebar_title {
|
||||
border-bottom: 1px solid #D2CFCF;
|
||||
font-weight: bold;
|
||||
font-size: 1.3em;
|
||||
min-width: 10em;
|
||||
}
|
||||
.oe_edi_nested_block, .oe_edi_nested_block_import, .oe_edi_nested_block_pay {
|
||||
margin: 0px 40px;
|
||||
min-width: 10em;
|
||||
display: none; /* made visible by click on parent input/label */
|
||||
}
|
||||
.oe_edi_right_top .oe_edi_nested_block label {
|
||||
float: left;
|
||||
text-align: right;
|
||||
margin-right: 0.5em;
|
||||
line-height: 180%;
|
||||
font-weight: bold;
|
||||
min-width: 5em;
|
||||
}
|
||||
.oe_edi_option {
|
||||
padding-left: 5px;
|
||||
line-height: 2em;
|
||||
}
|
||||
.oe_edi_option:hover {
|
||||
background: #e8e8e8;
|
||||
}
|
||||
.oe_edi_import_button {
|
||||
margin: 2px 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.oe_edi_small, .oe_edi_small input {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
/** Sidebar bottom **/
|
||||
.oe_edi_paypal_button {
|
||||
margin: 6px;
|
||||
}
|
||||
|
||||
|
||||
/** Paperbox, from http://www.sitepoint.com/pure-css3-paper-curl/ **/
|
||||
.oe_edi_paperbox {
|
||||
position: relative;
|
||||
width: 700px;
|
||||
padding: 30px;
|
||||
padding-bottom: 50px;
|
||||
margin: 20px auto;
|
||||
background-color: #fff;
|
||||
-webkit-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 0 0 5px rgba(0, 0, 0, 0.2), inset 0 0 50px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.oe_edi_paperbox:before, .oe_edi_paperbox:after {
|
||||
position: absolute;
|
||||
width: 40%;
|
||||
height: 10px;
|
||||
content: ' ';
|
||||
left: 12px;
|
||||
bottom: 15px;
|
||||
background: transparent;
|
||||
-webkit-transform: skew(-5deg) rotate(-5deg);
|
||||
-moz-transform: skew(-5deg) rotate(-5deg);
|
||||
-ms-transform: skew(-5deg) rotate(-5deg);
|
||||
-o-transform: skew(-5deg) rotate(-5deg);
|
||||
transform: skew(-5deg) rotate(-5deg);
|
||||
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
||||
-moz-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
|
||||
z-index: -1;
|
||||
}
|
||||
.oe_edi_paperbox:after {
|
||||
left: auto; right: 12px;
|
||||
-webkit-transform: skew(5deg) rotate(5deg);
|
||||
-moz-transform: skew(5deg) rotate(5deg);
|
||||
-ms-transform: skew(5deg) rotate(5deg);
|
||||
-o-transform: skew(5deg) rotate(5deg);
|
||||
transform: skew(5deg) rotate(5deg);
|
||||
}
|
||||
|
||||
/** Sale Order / Purchase Order Preview **/
|
||||
table.oe_edi_data, .oe_edi_doc_title {
|
||||
border-collapse: collapse;
|
||||
clear: both;
|
||||
}
|
||||
.oe_edi_data th {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.oe_edi_data .oe_edi_floor {
|
||||
border-bottom: 1px solid black;
|
||||
}
|
||||
.oe_edi_data .oe_edi_ceiling {
|
||||
border-top: 1px solid black;
|
||||
}
|
||||
.oe_edi_data .oe_edi_data_row {
|
||||
border-bottom: 1px solid #D2CFCF;
|
||||
}
|
||||
.oe_edi_data_row td {
|
||||
vertical-align: top;
|
||||
}
|
||||
.oe_edi_inner_note {
|
||||
font-style: italic;
|
||||
font-size: 95%;
|
||||
padding-left: 10px;
|
||||
|
||||
/* prevent wide notes from disrupting layout due to <pre> styling */
|
||||
white-space: pre-line;
|
||||
width: 90%;
|
||||
}
|
||||
.oe_edi_data_row .oe_edi_inner_note {
|
||||
/* prevent wide notes from disrupting layout due to <pre> styling */
|
||||
width: 25em;
|
||||
}
|
||||
.oe_edi_shade {
|
||||
background: #e8e8e8;
|
||||
}
|
||||
.oe_edi_company_name {
|
||||
text-transform: uppercase;
|
||||
font-weight: bold;
|
||||
}
|
||||
.oe_edi_address_from {
|
||||
float: left;
|
||||
}
|
||||
.oe_edi_address_to {
|
||||
float: right;
|
||||
margin-top: 25px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.oe_edi_company_block_title {
|
||||
width: 375px;
|
||||
margin: 0px;
|
||||
padding: 2px 14px;
|
||||
background-color: #252525;
|
||||
border-top-left-radius: 5px 5px;
|
||||
border-top-right-radius: 5px 5px;
|
||||
background-repeat: repeat no-repeat;
|
||||
}
|
||||
.oe_edi_company_block_title .oe_edi_company_name {
|
||||
margin: 0px;
|
||||
font-size: 1em;
|
||||
color: #FFF;
|
||||
}
|
||||
.oe_edi_company_block_body {
|
||||
width: 375px;
|
||||
margin: 0px;
|
||||
padding: 5px 14px;
|
||||
line-height: 16px;
|
||||
background-color: rgb(242, 242, 242);
|
||||
}
|
||||
.oe_edi_company_block_body p {
|
||||
color: #222;
|
||||
margin: 5px 0px;
|
||||
}
|
||||
.oe_edi_summary_label {
|
||||
float: left;
|
||||
}
|
||||
.oe_edi_summary_value {
|
||||
float: right;
|
||||
}
|
||||
|
||||
|
||||
/** Python code highlighting **/
|
||||
/* GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann
|
||||
(http://qbnz.com/highlighter/ and http://geshi.org/) */
|
||||
.python .de1, .python .de2 {font: normal normal 1em/1.2em monospace; margin:0; padding:0; background:none; vertical-align:top;}
|
||||
.python {font-family:monospace;}
|
||||
.python .imp {font-weight: bold; color: red;}
|
||||
.python li, .python .li1 {background: #ffffff; list-style: none;}
|
||||
.python .ln {width:1px;text-align:right;margin:0;padding:0 2px;vertical-align:top;}
|
||||
.python .li2 {background: #f8f8f8;}
|
||||
.python .kw1 {color: #ff7700;font-weight:bold;}
|
||||
.python .kw2 {color: #008000;}
|
||||
.python .kw3 {color: #dc143c;}
|
||||
.python .kw4 {color: #0000cd;}
|
||||
.python .co1 {color: #808080; font-style: italic;}
|
||||
.python .coMULTI {color: #808080; font-style: italic;}
|
||||
.python .es0 {color: #000099; font-weight: bold;}
|
||||
.python .br0 {color: black;}
|
||||
.python .sy0 {color: #66cc66;}
|
||||
.python .st0 {color: #483d8b;}
|
||||
.python .nu0 {color: #ff4500;}
|
||||
.python .me1 {color: black;}
|
||||
.python span.xtra { display:block; }
|
||||
.python ol { padding: 0px; }
|
Binary file not shown.
Before Width: | Height: | Size: 6.8 KiB |
|
@ -1,119 +1,8 @@
|
|||
openerp.edi = function(openerp) {
|
||||
openerp.edi = {}
|
||||
openerp.edi = function(instance) {
|
||||
var _t = instance.web._t;
|
||||
instance.edi = {}
|
||||
|
||||
openerp.edi.EdiView = openerp.web.Widget.extend({
|
||||
init: function(parent, db, token) {
|
||||
this._super();
|
||||
this.db = db;
|
||||
this.token = token;
|
||||
this.session = openerp.session;
|
||||
this.template = "EdiEmpty";
|
||||
this.content = "";
|
||||
this.sidebar = "";
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
var self = this;
|
||||
var param = {"db": self.db, "token": self.token};
|
||||
return self.rpc('/edi/get_edi_document', param, this.on_document_loaded, this.on_document_failed);
|
||||
},
|
||||
on_document_loaded: function(docs){
|
||||
this.doc = docs[0];
|
||||
var template_content = "Edi." + this.doc.__model + ".content";
|
||||
var template_sidebar = "Edi." + this.doc.__model + ".sidebar";
|
||||
var param = {"widget":this, "doc":this.doc};
|
||||
if (openerp.web.qweb.templates[template_sidebar]) {
|
||||
this.sidebar = openerp.web.qweb.render(template_sidebar, param);
|
||||
}
|
||||
if (openerp.web.qweb.templates[template_content]) {
|
||||
this.content = openerp.web.qweb.render(template_content, param);
|
||||
}
|
||||
this.$el.html(openerp.web.qweb.render("EdiView", param));
|
||||
this.$el.find('button.oe_edi_action_print').bind('click', this.do_print);
|
||||
this.$el.find('button#oe_edi_import_existing').bind('click', this.do_import_existing);
|
||||
this.$el.find('button#oe_edi_import_create').bind('click', this.do_import_create);
|
||||
this.$el.find('button#oe_edi_download').bind('click', this.do_download);
|
||||
this.$el.find('.oe_edi_import_choice, .oe_edi_import_choice_label').bind('click', this.toggle_choice('import'));
|
||||
this.$el.find('.oe_edi_pay_choice, .oe_edi_pay_choice_label').bind('click', this.toggle_choice('pay'));
|
||||
this.$el.find('#oe_edi_download_show_code').bind('click', this.show_code);
|
||||
},
|
||||
on_document_failed: function(response) {
|
||||
var self = this;
|
||||
var params = {
|
||||
error: response,
|
||||
//TODO: should this be _t() wrapped?
|
||||
message: "Sorry, this document cannot be located. Perhaps the link you are using has expired?"
|
||||
}
|
||||
$(openerp.web.qweb.render("DialogWarning", params)).dialog({
|
||||
title: "Document not found",
|
||||
modal: true,
|
||||
});
|
||||
},
|
||||
show_code: function($event) {
|
||||
$('#oe_edi_download_code').toggle();
|
||||
},
|
||||
get_download_url: function() {
|
||||
var l = window.location;
|
||||
var url_prefix = l.protocol + '//' + l.host;
|
||||
return url_prefix +'/edi/download?db=' + this.db + '&token=' + this.token;
|
||||
},
|
||||
get_paypal_url: function(document_type, ref_field) {
|
||||
var comp_name = encodeURIComponent(this.doc.company_id[1]);
|
||||
var doc_ref = encodeURIComponent(this.doc[ref_field]);
|
||||
var paypal_account = encodeURIComponent(this.doc.company_address.paypal_account);
|
||||
var amount = encodeURIComponent(this.doc.amount_total);
|
||||
var cur_code = encodeURIComponent(this.doc.currency.code);
|
||||
var paypal_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_xclick" +
|
||||
"&business=" + paypal_account +
|
||||
"&item_name=" + document_type + "%20" + comp_name + "%20" + doc_ref +
|
||||
"&invoice=" + doc_ref +
|
||||
"&amount=" + amount +
|
||||
"¤cy_code=" + cur_code +
|
||||
"&button_subtype=services&no_note=1&bn=OpenERP_PayNow_" + cur_code;
|
||||
return paypal_url;
|
||||
},
|
||||
toggle_choice: function(mode) {
|
||||
return function($e) {
|
||||
$('.oe_edi_nested_block_'+mode).hide();
|
||||
$('.'+$e.target.id+'_nested').show();
|
||||
return true;
|
||||
}
|
||||
},
|
||||
do_print: function(e){
|
||||
var l = window.location;
|
||||
window.location = l.protocol + '//' + l.host + "/edi/download_attachment?db=" + this.db + "&token=" + this.token;
|
||||
},
|
||||
do_import_existing: function(e) {
|
||||
var url_download = this.get_download_url();
|
||||
var $edi_text_server_input = this.$el.find('#oe_edi_txt_server_url');
|
||||
var server_url = $edi_text_server_input.val();
|
||||
$edi_text_server_input.removeClass('invalid');
|
||||
if (!server_url) {
|
||||
$edi_text_server_input.addClass('invalid');
|
||||
return false;
|
||||
}
|
||||
var protocol = "http://";
|
||||
if (server_url.toLowerCase().lastIndexOf('http', 0) == 0 ) {
|
||||
protocol = '';
|
||||
}
|
||||
window.location = protocol + server_url + '/edi/import_url?url=' + encodeURIComponent(url_download);
|
||||
},
|
||||
do_import_create: function(e){
|
||||
var url_download = this.get_download_url();
|
||||
window.location = "https://cc.my.openerp.com/odms/create_edi?url=" + encodeURIComponent(url_download);
|
||||
},
|
||||
do_download: function(e){
|
||||
window.location = this.get_download_url();
|
||||
}
|
||||
});
|
||||
|
||||
openerp.edi.edi_view = function (db, token) {
|
||||
openerp.session.session_bind().then(function () {
|
||||
new openerp.edi.EdiView(null,db,token).appendTo($("body").addClass('openerp'));
|
||||
});
|
||||
}
|
||||
|
||||
openerp.edi.EdiImport = openerp.web.Widget.extend({
|
||||
instance.edi.EdiImport = instance.web.Widget.extend({
|
||||
init: function(parent,url) {
|
||||
this._super();
|
||||
this.url = url;
|
||||
|
@ -137,7 +26,7 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({
|
|||
|
||||
show_login: function() {
|
||||
this.destroy_content();
|
||||
this.login = new openerp.web.Login(this);
|
||||
this.login = new instance.web.Login(this);
|
||||
this.login.appendTo(this.$el);
|
||||
},
|
||||
|
||||
|
@ -167,18 +56,18 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({
|
|||
window.location = "/";
|
||||
}
|
||||
}
|
||||
}).html('The document has been successfully imported!');
|
||||
}).html(_t('The document has been successfully imported!'));
|
||||
}
|
||||
},
|
||||
on_imported_error: function(response){
|
||||
var self = this;
|
||||
var msg = "Sorry, the document could not be imported.";
|
||||
var msg = _t("Sorry, the document could not be imported.");
|
||||
if (response.data.fault_code) {
|
||||
msg += "\n Reason:" + response.data.fault_code;
|
||||
msg += "\n " + _t("Reason:") + response.data.fault_code;
|
||||
}
|
||||
var params = {error: response, message: msg};
|
||||
$(openerp.web.qweb.render("CrashManagerWarning", params)).dialog({
|
||||
title: "Document Import Notification",
|
||||
$(instance.web.qweb.render("CrashManager.warning", params)).dialog({
|
||||
title: _t("Document Import Notification"),
|
||||
modal: true,
|
||||
buttons: {
|
||||
Ok: function() { $(this).dialog("close"); }
|
||||
|
@ -187,9 +76,9 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({
|
|||
}
|
||||
});
|
||||
|
||||
openerp.edi.edi_import = function (url) {
|
||||
openerp.session.session_bind().then(function () {
|
||||
new openerp.edi.EdiImport(null,url).appendTo($("body").addClass('openerp'));
|
||||
instance.edi.edi_import = function (url) {
|
||||
instance.session.session_bind().then(function () {
|
||||
new instance.edi.EdiImport(null,url).appendTo($("body").addClass('openerp'));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,93 +0,0 @@
|
|||
<template>
|
||||
<t t-name="EdiEmpty">
|
||||
<div style="height:100%;"></div>
|
||||
</t>
|
||||
<t t-name="EdiImport">
|
||||
<t t-call="WebClient"/>
|
||||
</t>
|
||||
<t t-name="EdiView">
|
||||
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" id="oe_app" class="oe-application oe_forms oe_semantic_html_override">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" id="oe_header" class="header">
|
||||
<div> <a href="/" class="company_logo_link">
|
||||
<div class="company_logo"
|
||||
t-att-style="'background-size: 180px 46px; background: url('+ (doc.company_address ? '/edi/binary?db='+widget.db+'&token='+widget.token : '/web/static/src/img/logo.png')+')'"/></a> </div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" valign="top" height="100%">
|
||||
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
||||
<tr>
|
||||
<td class="oe_edi_view">
|
||||
<p class="oe_paragraph"><t t-raw="widget.content"/></p>
|
||||
<button type="button" class="oe_edi_action_print">
|
||||
View/Print <img src="/edi/static/src/img/pdf.png"/>
|
||||
</button>
|
||||
</td>
|
||||
<td class="oe_edi_sidebar_container">
|
||||
<p class="oe_edi_sidebar_title">
|
||||
Import this document
|
||||
</p>
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_import_openerp" name="oe_edi_import" class="oe_edi_import_choice"/>
|
||||
<label for="oe_edi_import_openerp" id="oe_edi_import_openerp" class="oe_edi_import_choice_label">Import it into an existing OpenERP instance</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_import oe_edi_import_openerp_nested">
|
||||
<label for="oe_edi_txt_server_url">OpenERP instance address:</label>
|
||||
<br/>
|
||||
<input type="text" id="oe_edi_txt_server_url" placeholder="http://example.my.openerp.com/"/><br/>
|
||||
<button type="button" class="oe_edi_import_button" id="oe_edi_import_existing">Import</button>
|
||||
</p>
|
||||
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_import_saas" name="oe_edi_import" class="oe_edi_import_choice"/>
|
||||
<label for="oe_edi_import_saas" id="oe_edi_import_saas" class="oe_edi_import_choice_label">Import it into a new OpenERP Online instance</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_import oe_edi_import_saas_nested">
|
||||
<button type="button" class="oe_edi_import_button" id="oe_edi_import_create">Create my new OpenERP instance</button>
|
||||
</p>
|
||||
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_import_download" name="oe_edi_import" class="oe_edi_import_choice"/>
|
||||
<label for="oe_edi_import_download" id="oe_edi_import_download" class="oe_edi_import_choice_label">Import into another application</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_import oe_edi_small oe_edi_import_download_nested">
|
||||
OpenERP's Electronic Data Interchange documents are based on a generic and language
|
||||
independent <a href="http://json.org">JSON</a> serialization of the document's attribute.
|
||||
It is usually very quick and straightforward to create a small plug-in for your preferred
|
||||
application that will be capable of importing any OpenERP EDI document.
|
||||
You can find out more details about how to do this and what the content of OpenERP EDI documents
|
||||
is like in the <a href="http://doc.openerp.com/search.html?q=edi">OpenERP documentation</a>.
|
||||
<br/>
|
||||
To get started immediately, <a href="#" id="oe_edi_download_show_code">see is all it takes to use this EDI document in Python</a>.
|
||||
</p>
|
||||
<div class="python oe_edi_nested_block_import oe_edi_small" id="oe_edi_download_code" t-translation="off">
|
||||
<ol><li class="li1"><div class="de1"><span class="kw1">import</span> <span class="kw3">urllib2</span><span class="sy0">,</span> simplejson</div></li>
|
||||
<li class="li1"><div class="de1">edi_document <span class="sy0">=</span> <span class="kw3">urllib2</span>.<span class="me1">urlopen</span><span class="br0">(</span><span class="st0">'<t t-esc="widget.get_download_url()"/>'</span><span class="br0">)</span>.<span class="me1">read</span><span class="br0">(</span><span class="br0">)</span></div></li>
|
||||
<li class="li2"><div class="de2">document_data <span class="sy0">=</span> simplejson.<span class="me1">loads</span><span class="br0">(</span>edi_document<span class="br0">)</span><span class="br0">[</span><span class="nu0">0</span><span class="br0">]</span></div></li>
|
||||
<li class="li1"><div class="de1"><span class="kw1">print</span> <span class="st0">"Amount: "</span><span class="sy0">,</span> document_data<span class="br0">[</span><span class="st0">'amount_total'</span><span class="br0">]</span></div></li>
|
||||
</ol></div>
|
||||
<p class="oe_edi_nested_block_import oe_edi_small oe_edi_import_download_nested">
|
||||
You can download the raw EDI document here:<br/>
|
||||
<input type="text" readonly="readonly" t-att-value="widget.get_download_url()"/>
|
||||
<button type="button" class="oe_edi_import_button" id="oe_edi_download">Download</button>
|
||||
</p>
|
||||
|
||||
<div class="oe_edi_right_bottom">
|
||||
<t t-raw="widget.sidebar"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<div id="oe_footer" class="oe_footer">
|
||||
<p class="oe_footer_powered">Powered by <a href="http://www.openerp.com">OpenERP</a></p>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</t>
|
||||
</template>
|
|
@ -1,163 +0,0 @@
|
|||
<template>
|
||||
<t t-name="Edi.account.invoice.content">
|
||||
<div class="oe_edi_paperbox">
|
||||
<div class="oe_edi_address_from">
|
||||
<div class="oe_edi_company_block_title">
|
||||
<span class="oe_edi_company_name"><t t-esc="doc.company_id[1]"/></span>
|
||||
</div>
|
||||
<div class="oe_edi_company_block_body">
|
||||
<p>
|
||||
<t t-if="doc.company_address">
|
||||
<t t-if="doc.company_address.street" t-esc="doc.company_address.street"/><br/>
|
||||
<t t-if="doc.company_address.street2"><t t-esc="doc.company_address.street2"/><br/></t>
|
||||
<t t-if="doc.company_address.zip" t-esc="doc.company_address.zip"/> <t t-if="doc.company_address.city" t-esc="doc.company_address.city"/> <br/>
|
||||
<t t-if="doc.company_address.country_id"><t t-esc="doc.company_address.country_id[1]"/><br/></t>
|
||||
</t>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="oe_edi_address_to">
|
||||
<div class="oe_edi_company_block_title">
|
||||
<span class="oe_edi_company_name"><t t-esc="doc.partner_id[1]"/></span>
|
||||
</div>
|
||||
<div class="oe_edi_company_block_body">
|
||||
<p>
|
||||
<t t-if="doc.partner_address">
|
||||
<t t-if="doc.partner_address.street" t-esc="doc.partner_address.street"/><br/>
|
||||
<t t-if="doc.partner_address.street2"><t t-esc="doc.partner_address.street2"/><br/></t>
|
||||
<t t-if="doc.partner_address.zip" t-esc="doc.partner_address.zip"/> <t t-if="doc.partner_address.city" t-esc="doc.partner_address.city"/> <br/>
|
||||
<t t-if="doc.partner_address.country_id"><t t-esc="doc.partner_address.country_id[1]"/><br/></t>
|
||||
</t>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<h1 class="oe_edi_doc_title">Invoice <t t-esc="doc.internal_number"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
|
||||
<table width="100%" class="oe_edi_data oe_edi_shade">
|
||||
<tr class="oe_edi_floor">
|
||||
<th align="left">Description</th>
|
||||
<th align="left">Date</th>
|
||||
<th align="left">Your Reference</th>
|
||||
</tr>
|
||||
<tr class="oe_edi_data_row">
|
||||
<td align="left"><t t-if="doc.name" t-esc="doc.name"/></td>
|
||||
<td align="left"><t t-if="doc.date_invoice" t-esc="doc.date_invoice"/></td>
|
||||
<td align="left"><t t-if="doc.partner_ref" t-esc="doc.partner_ref"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p/>
|
||||
<table width="100%" class="oe_edi_data">
|
||||
<tr class="oe_edi_floor">
|
||||
<th align="left">Product Description</th>
|
||||
<th align="right">Quantity</th>
|
||||
<th align="right">Unit Price</th>
|
||||
<th align="right">Discount</th>
|
||||
<th align="right">Price</th>
|
||||
</tr>
|
||||
<t t-if="doc.invoice_line" t-foreach="doc.invoice_line" t-as="invoice_line">
|
||||
<tr class="oe_edi_data_row">
|
||||
<td align="left"><t t-esc="invoice_line.name"/>
|
||||
<t t-if="invoice_line.note">
|
||||
<pre class="oe_edi_inner_note"><t t-esc="invoice_line.note"/></pre>
|
||||
</t>
|
||||
</td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',invoice_line.quantity)"/> <t t-esc="invoice_line.uos_id[1]"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',invoice_line.price_unit)"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',invoice_line.discount)"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',invoice_line.price_subtotal)"/> <t t-esc="doc.currency.code"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td colspan="2" class="oe_edi_ceiling">
|
||||
<div class="oe_edi_summary_label">
|
||||
Net Total:
|
||||
</div>
|
||||
<div class="oe_edi_summary_value">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc.amount_untaxed)"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td colspan="2" class="oe_edi_floor">
|
||||
<div class="oe_edi_summary_label">
|
||||
Taxes:
|
||||
</div>
|
||||
<div class="oe_edi_summary_value">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc.amount_tax)"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<th colspan="2" class="oe_edi_shade">
|
||||
<div class="oe_edi_summary_label">
|
||||
Total:
|
||||
</div>
|
||||
<div class="oe_edi_summary_value">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
<t t-if="doc.tax_line">
|
||||
<table class="oe_edi_data" width="40%">
|
||||
<tr class="oe_edi_floor">
|
||||
<th align="left">Tax</th>
|
||||
<th align="right">Base Amount</th>
|
||||
<th align="right">Amount</th>
|
||||
</tr>
|
||||
<t t-if="doc.tax_line"><t t-foreach="doc.tax_line" t-as="tax_line">
|
||||
<tr class="oe_edi_data_row">
|
||||
<td align="left"><t t-esc="tax_line.name"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',tax_line.base_amount)"/> <t t-esc="doc.currency.code"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',tax_line.amount)"/> <t t-esc="doc.currency.code"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</table>
|
||||
</t>
|
||||
<t t-if="doc.comment">
|
||||
<p>Notes:</p>
|
||||
<pre class="oe_edi_inner_note"><t t-esc="doc.comment"/></pre>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="Edi.account.invoice.sidebar">
|
||||
<t t-if="!doc.reconciled && (doc.type == 'out_invoice' or doc.type == 'in_refund')">
|
||||
<t t-if="doc.company_address.paypal_account || doc.company_address.bank_ids">
|
||||
<p class="oe_edi_sidebar_title">Pay Online</p>
|
||||
<t t-if="doc.company_address.paypal_account">
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_paypal" name="oe_edi_pay" class="oe_edi_pay_choice"/>
|
||||
<label for="oe_edi_paypal" id="oe_edi_paypal" class="oe_edi_pay_choice_label">Paypal</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_pay oe_edi_paypal_nested">
|
||||
You may directly pay this invoice online via Paypal's secure payment gateway:<br/>
|
||||
<a t-att-href="widget.get_paypal_url('Invoice','internal_number')" target="_new">
|
||||
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
|
||||
</a>
|
||||
</p>
|
||||
</t>
|
||||
<t t-if="doc.company_address.bank_ids">
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_pay_wire" name="oe_edi_pay" class="oe_edi_pay_choice"/>
|
||||
<label for="oe_edi_pay_wire" id="oe_edi_pay_wire" class="oe_edi_pay_choice_label">Bank Wire Transfer</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_pay oe_edi_pay_wire_nested">
|
||||
Please transfer <strong><t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></strong> to
|
||||
<strong><t t-esc="doc.company_id[1]"/></strong> (postal address on the invoice header)
|
||||
using one of the following bank accounts. Be sure to mention the invoice
|
||||
reference <strong><t t-esc="doc.internal_number"/></strong> on the transfer:
|
||||
<br/><br/>
|
||||
</p>
|
||||
<ul class="oe_edi_nested_block_pay oe_edi_pay_wire_nested">
|
||||
<t t-foreach="doc.company_address.bank_ids" t-as="bank_info">
|
||||
<li><t t-esc="bank_info[1]"/></li>
|
||||
</t>
|
||||
</ul>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
|
@ -1,169 +0,0 @@
|
|||
<template>
|
||||
<t t-name="Edi.sale.order.content">
|
||||
<div class="oe_edi_paperbox">
|
||||
<div class="oe_edi_address_from">
|
||||
<div class="oe_edi_company_block_title">
|
||||
<span class="oe_edi_company_name"><t t-esc="doc.company_id[1]"/></span>
|
||||
</div>
|
||||
<div class="oe_edi_company_block_body">
|
||||
<p>
|
||||
<t t-if="doc.company_address">
|
||||
<t t-if="doc.company_address.street" t-esc="doc.company_address.street"/><br/>
|
||||
<t t-if="doc.company_address.street2"><t t-esc="doc.company_address.street2"/><br/></t>
|
||||
<t t-if="doc.company_address.zip" t-esc="doc.company_address.zip"/> <t t-if="doc.company_address.city" t-esc="doc.company_address.city"/> <br/>
|
||||
<t t-if="doc.company_address.country_id"><t t-esc="doc.company_address.country_id[1]"/><br/></t>
|
||||
</t>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="oe_edi_address_to">
|
||||
<div class="oe_edi_company_block_title">
|
||||
<span class="oe_edi_company_name"><t t-esc="doc.partner_id[1]"/></span>
|
||||
</div>
|
||||
<div class="oe_edi_company_block_body">
|
||||
<p>
|
||||
<t t-if="doc.partner_address">
|
||||
<t t-if="doc.partner_address.street" t-esc="doc.partner_address.street"/><br/>
|
||||
<t t-if="doc.partner_address.street2"><t t-esc="doc.partner_address.street2"/><br/></t>
|
||||
<t t-if="doc.partner_address.zip" t-esc="doc.partner_address.zip"/> <t t-if="doc.partner_address.city" t-esc="doc.partner_address.city"/> <br/>
|
||||
<t t-if="doc.partner_address.country_id"><t t-esc="doc.partner_address.country_id[1]"/><br/></t>
|
||||
</t>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<t t-if="(doc.state == 'draft' or doc.state == 'sent') and doc.__model == 'sale.order'">
|
||||
<h1 class="oe_edi_doc_title">Quotation <t t-esc="doc.name"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
|
||||
</t>
|
||||
<t t-if="(doc.state == 'draft' or doc.state == 'sent') and doc.__model == 'purchase.order'">
|
||||
<h1 class="oe_edi_doc_title">Request for Quotation <t t-esc="doc.name"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
|
||||
</t>
|
||||
<t t-if="(doc.state != 'draft' and doc.state != 'sent')">
|
||||
<h1 class="oe_edi_doc_title">Order <t t-esc="doc.name"/>: <t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></h1>
|
||||
</t>
|
||||
|
||||
<table width="100%" class="oe_edi_data oe_edi_shade">
|
||||
<tr class="oe_edi_floor">
|
||||
<th align="left">Your Reference</th>
|
||||
<th align="left">Date</th>
|
||||
<th align="left">Salesperson</th>
|
||||
<th align="left">Payment terms</th>
|
||||
</tr>
|
||||
<tr class="oe_edi_data_row">
|
||||
<td align="left"><t t-if="doc.partner_ref" t-esc="doc.partner_ref"/></td>
|
||||
<td align="left"><t t-esc="doc.date_order"/></td>
|
||||
<td align="left"><t t-if="doc.user_id" t-esc="doc.user_id[1]"/></td>
|
||||
<td align="left">
|
||||
<t t-if="doc.payment_term" t-esc="doc.payment_term[1]"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p/>
|
||||
<table width="100%" class="oe_edi_data">
|
||||
<tr class="oe_edi_floor">
|
||||
<th align="left">Product Description</th>
|
||||
<th align="right">Quantity</th>
|
||||
<th align="right">Unit Price</th>
|
||||
<th align="right">Discount(%)</th>
|
||||
<th align="right">Price</th>
|
||||
</tr>
|
||||
<t t-if="doc.order_line" t-foreach="doc.order_line" t-as="doc_line">
|
||||
<tr class="oe_edi_data_row">
|
||||
<td align="left"><t t-esc="doc_line.name"/>
|
||||
<t t-if="doc_line.notes">
|
||||
<pre class="oe_edi_inner_note"><t t-esc="doc_line.notes"/></pre>
|
||||
</t>
|
||||
</td>
|
||||
<td align="right">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc_line.product_qty)"/> <t t-esc="doc_line.product_uom[1]"/>
|
||||
</td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',doc_line.price_unit)"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',doc_line.discount or 0.0)"/></td>
|
||||
<td align="right"><t t-esc="_.str.sprintf('%.2f',doc_line.price_subtotal)"/> <t t-esc="doc.currency.code"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td colspan="2" class="oe_edi_ceiling">
|
||||
<div class="oe_edi_summary_label">
|
||||
Net Total:
|
||||
</div>
|
||||
<div class="oe_edi_summary_value">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc.amount_untaxed)"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td colspan="2" class="oe_edi_floor">
|
||||
<div class="oe_edi_summary_label">
|
||||
Taxes:
|
||||
</div>
|
||||
<div class="oe_edi_summary_value">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc.amount_tax)"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<th colspan="2" class="oe_edi_shade">
|
||||
<div class="oe_edi_summary_label">
|
||||
Total:
|
||||
</div>
|
||||
<div class="oe_edi_summary_value">
|
||||
<t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</table>
|
||||
<t t-if="doc.notes">
|
||||
<p>Notes:</p>
|
||||
<pre class="oe_edi_inner_note"><t t-esc="doc.notes"/></pre>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="Edi.sale.order.sidebar">
|
||||
<t t-if="doc.order_policy and (doc.order_policy == 'prepaid' || doc.order_policy == 'manual') and (doc.state != 'draft' and doc.state != 'sent')">
|
||||
<t t-if="doc.company_address.paypal_account || doc.company_address.bank_ids">
|
||||
<p class="oe_edi_sidebar_title">Pay Online</p>
|
||||
<t t-if="doc.company_address.paypal_account">
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_paypal" name="oe_edi_pay" class="oe_edi_pay_choice"/>
|
||||
<label for="oe_edi_paypal" id="oe_edi_paypal" class="oe_edi_pay_choice_label">Paypal</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_pay oe_edi_paypal_nested">
|
||||
You may directly pay this order online via Paypal's secure payment gateway:<br/>
|
||||
<a t-att-href="widget.get_paypal_url('Sale Order','name')" target="_new">
|
||||
<img class="oe_edi_paypal_button" src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/>
|
||||
</a>
|
||||
</p>
|
||||
</t>
|
||||
<t t-if="doc.company_address.bank_ids">
|
||||
<div class="oe_edi_option">
|
||||
<input type="radio" id="oe_edi_pay_wire" name="oe_edi_pay" class="oe_edi_pay_choice"/>
|
||||
<label for="oe_edi_pay_wire" id="oe_edi_pay_wire" class="oe_edi_pay_choice_label">Bank Wire Transfer</label>
|
||||
</div>
|
||||
<p class="oe_edi_nested_block_pay oe_edi_pay_wire_nested">
|
||||
Please transfer <strong><t t-esc="_.str.sprintf('%.2f',doc.amount_total)"/> <t t-esc="doc.currency.code"/></strong> to
|
||||
<strong><t t-esc="doc.company_id[1]"/></strong> (postal address on the order header)
|
||||
using one of the following bank accounts. Be sure to mention the document
|
||||
reference <strong><t t-esc="doc.name"/></strong> on the transfer:
|
||||
<br/><br/>
|
||||
</p>
|
||||
<ul class="oe_edi_nested_block_pay oe_edi_pay_wire_nested">
|
||||
<t t-foreach="doc.company_address.bank_ids" t-as="bank_info">
|
||||
<li><t t-esc="bank_info[1]"/></li>
|
||||
</t>
|
||||
</ul>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
<t t-name="Edi.purchase.order.content">
|
||||
<t t-call="Edi.sale.order.content"/>
|
||||
</t>
|
||||
<t t-name="Edi.purchase.order.sidebar">
|
||||
<t t-call="Edi.sale.order.sidebar"/>
|
||||
</t>
|
||||
</template>
|
Loading…
Reference in New Issue