[IMP] edi: review/improve EDI templates, cleanup, minor fixes (wip)
bzr revid: odo@openerp.com-20111026000110-12zecr32uyola9lc
This commit is contained in:
parent
d86d2c085e
commit
326a7b562c
|
@ -53,7 +53,7 @@ module named account_voucher.
|
|||
'website': 'http://www.openerp.com',
|
||||
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
|
||||
'init_xml': [],
|
||||
"depends" : ["base_setup", "product", "analytic", "process", "board", "edi", "email_template"],
|
||||
"depends" : ["base_setup", "product", "analytic", "process", "board", "edi"],
|
||||
'update_xml': [
|
||||
'security/account_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
|
|
|
@ -31,6 +31,9 @@ INVOICE_LINE_EDI_STRUCT = {
|
|||
'quantity': True,
|
||||
'discount': True,
|
||||
'note': True,
|
||||
|
||||
# fields used for web preview only - discarded on import
|
||||
'price_subtotal': True,
|
||||
}
|
||||
|
||||
INVOICE_TAX_LINE_EDI_STRUCT = {
|
||||
|
@ -57,6 +60,12 @@ INVOICE_EDI_STRUCT = {
|
|||
#custom: currency_id
|
||||
'invoice_line': INVOICE_LINE_EDI_STRUCT,
|
||||
'tax_line': INVOICE_TAX_LINE_EDI_STRUCT,
|
||||
|
||||
# fields used for web preview only - discarded on import
|
||||
#custom: 'partner_ref'
|
||||
'amount_total': True,
|
||||
'amount_untaxed': True,
|
||||
'amount_tax': True,
|
||||
}
|
||||
|
||||
class account_invoice(osv.osv, EDIMixin):
|
||||
|
@ -71,15 +80,14 @@ class account_invoice(osv.osv, EDIMixin):
|
|||
for invoice in records:
|
||||
# generate the main report
|
||||
self._edi_generate_report_attachment(cr, uid, invoice, context=context)
|
||||
|
||||
edi_doc = super(account_invoice,self).edi_export(cr, uid, [invoice], edi_struct, context)[0]
|
||||
edi_doc.update({
|
||||
'company_address': res_company.edi_export_address(cr, uid, invoice.company_id, context=context),
|
||||
'company_paypal_account': invoice.company_id.paypal_account,
|
||||
'partner_address': res_partner_address.edi_export(cr, uid, [invoice.address_invoice_id], context=context)[0],
|
||||
|
||||
'currency': self.pool.get('res.currency').edi_export(cr, uid, [invoice.currency_id], context=context),
|
||||
#'company_logo': #TODO
|
||||
'currency': self.pool.get('res.currency').edi_export(cr, uid, [invoice.currency_id], context=context)[0],
|
||||
'partner_ref': invoice.reference or False,
|
||||
})
|
||||
edi_doc_list.append(edi_doc)
|
||||
return edi_doc_list
|
||||
|
@ -200,6 +208,9 @@ class account_invoice(osv.osv, EDIMixin):
|
|||
# internal number: reset to False, auto-generated
|
||||
edi_document['internal_number'] = False
|
||||
|
||||
# discard web preview fields, if present
|
||||
edi_document.pop('partner_ref', None)
|
||||
|
||||
# journal_id: should be selected based on type: simply put the 'type' in the context when calling create(), will be selected correctly
|
||||
context.update(type=invoice_type)
|
||||
|
||||
|
@ -213,6 +224,9 @@ class account_invoice(osv.osv, EDIMixin):
|
|||
# account = fpos_obj.map_account(cr, uid, fiscal_position_id, account.id)
|
||||
edi_invoice_line['account_id'] = self.edi_m2o(cr, uid, account, context=context) if account else False
|
||||
|
||||
# discard web preview fields, if present
|
||||
edi_invoice_line.pop('price_subtotal', None)
|
||||
|
||||
# for tax lines, we disconnect from the invoice.line, so all tax lines will be of type 'manual', and default accounts should be picked based
|
||||
# on the tax config of the DB where it is imported.
|
||||
tax_account = self._edi_tax_account(cr, uid, context=context)
|
||||
|
|
|
@ -3,19 +3,7 @@
|
|||
<data>
|
||||
<!-- EDI Export + Send email Action -->
|
||||
<record id="ir_actions_server_edi_invoice" model="ir.actions.server">
|
||||
<field name="code"><![CDATA[
|
||||
try:
|
||||
if not object.partner_id.opt_out:
|
||||
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default="<WEB_ROOT_URL>")
|
||||
|
||||
# accessing the template will fail if it has been deleted - so we'll skip everything
|
||||
tmpl = self.pool.get('ir.model.data').get_object(cr, uid, 'account', 'email_template_edi_invoice')
|
||||
|
||||
edi_token = self.pool.get('edi.document').export_edi(cr, uid, [object], context = context)[0]
|
||||
context.update(edi_web_url_view='%s/web/view_edi?db=%s&token=%s' %(web_root_url, cr.dbname, edi_token))
|
||||
self.pool.get('email.template').send_mail(cr, uid,tmpl.id,object.id,context=context)
|
||||
except:
|
||||
pass]]></field>
|
||||
<field name="code"><![CDATA[if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='account.email_template_edi_invoice', context=context)]]></field>
|
||||
<field eval="6" name="sequence"/>
|
||||
<field name="state">code</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
|
@ -61,7 +49,7 @@ except:
|
|||
<p>
|
||||
You can view the invoice document, download it and pay online using the following link:
|
||||
</p>
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||
href="${ctx.get('edi_web_url_view') or ''}">View Invoice</a>
|
||||
|
||||
% if object.company_id.paypal_account:
|
||||
|
@ -77,7 +65,7 @@ except:
|
|||
%>
|
||||
<br/>
|
||||
<p>It is also possible to directly pay with Paypal:</p>
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||
href="${paypal_url}">Pay with Paypal</a>
|
||||
% endif
|
||||
|
||||
|
@ -86,12 +74,12 @@ except:
|
|||
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
|
||||
<br/>
|
||||
<br/>
|
||||
<div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; ">
|
||||
<h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); ">
|
||||
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
|
||||
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
|
||||
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
|
||||
</div>
|
||||
<div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); ">
|
||||
<span style="color: rgb(38, 72, 149); margin-bottom: 5px; display: block; ">
|
||||
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
|
||||
<span style="color: #222; margin-bottom: 5px; display: block; ">
|
||||
% if object.company_id.street:
|
||||
${object.company_id.street}<br/>
|
||||
% endif
|
||||
|
|
|
@ -36,7 +36,7 @@ technical OpenERP documentation at http://doc.openerp.com
|
|||
""",
|
||||
'author': 'OpenERP SA',
|
||||
'website': 'http://www.openerp.com',
|
||||
'depends': ['base'],
|
||||
'depends': ['base', 'email_template'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
],
|
||||
|
|
|
@ -53,11 +53,22 @@ class EDI(openerpweb.Controller):
|
|||
filename_utf8 = attachment['file_name']
|
||||
filename_encoded = "%s=%s" % ('filename*',
|
||||
utils.encode_rfc2231(filename_utf8, 'utf-8'))
|
||||
response = werkzeug.wrappers.Response( result, headers=[('Content-Type', 'application/pdf'),
|
||||
('Content-Disposition', 'inline; ' + filename_encoded),
|
||||
('Content-Length', len(result))])
|
||||
response = werkzeug.wrappers.Response(result, headers=[('Content-Type', 'application/pdf'),
|
||||
('Content-Disposition', 'inline; ' + filename_encoded),
|
||||
('Content-Length', len(result))])
|
||||
return response
|
||||
|
||||
@openerpweb.httprequest
|
||||
def binary(self, req, db, token, field_path="company_address.logo", content_type='image/png'):
|
||||
result = req.session.proxy('edi').get_edi_document(db, token)
|
||||
doc = json.loads(result)[0]
|
||||
for name in field_path.split("."):
|
||||
doc = doc[name]
|
||||
result = doc.decode('base64')
|
||||
response = werkzeug.wrappers.Response(result, headers=[('Content-Type', content_type),
|
||||
('Content-Length', len(result))])
|
||||
return response
|
||||
|
||||
@openerpweb.jsonrequest
|
||||
def get_edi_document(self, req, db, token):
|
||||
result = req.session.proxy('edi').get_edi_document(db, token)
|
||||
|
|
|
@ -24,24 +24,27 @@ import hashlib
|
|||
import json
|
||||
import logging
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
import openerp
|
||||
import openerp.release as release
|
||||
import netsvc
|
||||
from osv import osv,fields
|
||||
import pooler
|
||||
from osv import osv,fields,orm
|
||||
from tools.translate import _
|
||||
from tools.parse_version import parse_version
|
||||
from tools.safe_eval import safe_eval as eval
|
||||
|
||||
EXTERNAL_ID_PATTERN = re.compile(r'^(\S+:)?(\S+?)\.(\S+)$')
|
||||
EXTERNAL_ID_PATTERN = re.compile(r'^([^.:]+)(?::([^.]+))?\.(\S+)$')
|
||||
EDI_VIEW_WEB_URL = '%s/edi/view?debug=1&db=%s&token=%s'
|
||||
|
||||
def split_external_id(ext_id):
|
||||
match = EXTERNAL_ID_PATTERN.match(ext_id)
|
||||
assert match, \
|
||||
_("'%s' is an invalid external ID") % (ext_id)
|
||||
return {'module': match.group(1) and match.group(1)[:-1],
|
||||
return {'module': match.group(1),
|
||||
'db_uuid': match.group(2),
|
||||
'id': match.group(3),
|
||||
'full': match.group(0)}
|
||||
|
@ -408,11 +411,8 @@ class EDIMixin(object):
|
|||
for field in fields_to_export:
|
||||
column = self._all_columns[field].column
|
||||
value = getattr(record, field)
|
||||
if not value:
|
||||
if not value and value not in ('', 0):
|
||||
continue
|
||||
#if _fields[field].has_key('function') or _fields[field].has_key('related_columns'):
|
||||
# # Do not Export Function Fields and related fields
|
||||
# continue
|
||||
elif column._type == 'many2one':
|
||||
value = self.edi_m2o(cr, uid, value, context=context)
|
||||
elif column._type == 'many2many':
|
||||
|
@ -423,6 +423,48 @@ class EDIMixin(object):
|
|||
results.append(edi_dict)
|
||||
return results
|
||||
|
||||
def edi_export_and_email(self, cr, uid, ids, template_ext_id, context=None):
|
||||
"""Export the given records just like :meth:`~.export_edi`, the render the
|
||||
given email template, in order to trigger appropriate notifications.
|
||||
This method is intended to be called as part of business documents'
|
||||
lifecycle, so it silently ignores any error occurring during the process,
|
||||
as this is usually non-critical. To avoid any delay, it is also asynchronous
|
||||
and will spawn a short-lived thread to perform the action.
|
||||
|
||||
:param str template_ext_id: external id of the email.template to use for
|
||||
the mail notifications
|
||||
:return: True
|
||||
"""
|
||||
def email_task():
|
||||
db = pooler.get_db(cr.dbname)
|
||||
local_cr = None
|
||||
try:
|
||||
time.sleep(1) # FIXME: workaround to wait for commit of parent transaction
|
||||
# grab a fresh browse_record on local cursor
|
||||
local_cr = db.cursor()
|
||||
web_root_url = self.pool.get('ir.config_parameter').get_param(local_cr, uid, 'web.base.url')
|
||||
if not web_root_url:
|
||||
_logger.warning('Ignoring EDI mail notification, web.base.url not defined in parameters')
|
||||
return
|
||||
mail_tmpl = self._edi_get_object_by_external_id(local_cr, uid, template_ext_id, 'email.template', context=context)
|
||||
if not mail_tmpl:
|
||||
# skip EDI export if the template was not found
|
||||
_logger.warning('Ignoring EDI mail notification, template %s cannot be located', template_ext_id)
|
||||
return
|
||||
for edi_record in self.browse(local_cr, uid, ids, context=context):
|
||||
edi_token = self.pool.get('edi.document').export_edi(local_cr, uid, [edi_record], context = context)[0]
|
||||
edi_context = dict(context, edi_web_url_view=EDI_VIEW_WEB_URL % (web_root_url, local_cr.dbname, edi_token))
|
||||
self.pool.get('email.template').send_mail(local_cr, uid, mail_tmpl.id, edi_record.id, context=edi_context)
|
||||
except Exception:
|
||||
_logger.warning('Ignoring EDI mail notification, failed to generate it.', exc_info=True)
|
||||
finally:
|
||||
if local_cr:
|
||||
local_cr.commit()
|
||||
local_cr.close()
|
||||
|
||||
threading.Thread(target=email_task, name='EDI ExportAndEmail for %s %r' % (self._name, ids)).start()
|
||||
return True
|
||||
|
||||
def _edi_get_object_by_name(self, cr, uid, name, model_name, context=None):
|
||||
model = self.pool.get(model_name)
|
||||
search_results = model.name_search(cr, uid, name, operator='=', context=context)
|
||||
|
@ -448,7 +490,9 @@ class EDIMixin(object):
|
|||
if not report.attachment or not eval(report.attachment, eval_context):
|
||||
# no auto-saving of report as attachment, need to do it manually
|
||||
result = base64.b64encode(result)
|
||||
file_name = report.report_name+".printout.pdf"
|
||||
file_name = record.name_get()[0][1]
|
||||
file_name = re.sub(r'[^a-zA-Z0-9_-]', '_', file_name)
|
||||
file_name += ".pdf"
|
||||
ir_attachment = self.pool.get('ir.attachment').create(cr, uid,
|
||||
{'name': file_name,
|
||||
'datas': result,
|
||||
|
@ -493,9 +537,11 @@ class EDIMixin(object):
|
|||
db_uuid = self.pool.get('ir.config_parameter').get_param(cr, uid, 'database.uuid')
|
||||
module = ext_id_members['module']
|
||||
ext_id = ext_id_members['id']
|
||||
ext_module = '%s:%s' % (module, ext_id_members['db_uuid'])
|
||||
modules = [ext_module]
|
||||
if ext_id_members['db_uuid'] == db_uuid:
|
||||
modules = []
|
||||
ext_db_uuid = ext_id_members['db_uuid']
|
||||
if ext_db_uuid:
|
||||
modules.append('%s:%s' % (module, ext_id_members['db_uuid']))
|
||||
if ext_db_uuid is None or ext_db_uuid == db_uuid:
|
||||
# local records may also be registered without the db_uuid
|
||||
modules.append(module)
|
||||
data_ids = ir_model_data.search(cr, uid, [('model','=',model),
|
||||
|
|
|
@ -40,7 +40,11 @@ class res_company(osv.osv):
|
|||
res_partner_address = self.pool.get('res.partner.address')
|
||||
addresses = res_partner.address_get(cr, uid, [company.partner_id.id], ['default', 'contact', 'invoice'])
|
||||
addr_id = addresses['invoice'] or addresses['contact'] or addresses['default']
|
||||
result = {}
|
||||
if addr_id:
|
||||
address = res_partner_address.browse(cr, uid, addr_id, context=context)
|
||||
return res_partner_address.edi_export(cr, uid, [address], edi_struct=edi_address_struct, context=context)[0]
|
||||
return {}
|
||||
result = res_partner_address.edi_export(cr, uid, [address], edi_struct=edi_address_struct, context=context)[0]
|
||||
if company.logo:
|
||||
result['logo'] = company.logo # already base64-encoded
|
||||
|
||||
return result
|
||||
|
|
|
@ -1,44 +1,39 @@
|
|||
|
||||
|
||||
td.oe_edi_view {
|
||||
/** EDI content **/
|
||||
.openerp .company_logo {
|
||||
background-size: 180px 46px;
|
||||
}
|
||||
.oe_edi_view {
|
||||
width: 65%;
|
||||
vertical-align: top;
|
||||
padding: 10px;
|
||||
padding: 0px 25px;
|
||||
border-right: 1px solid #D2CFCF;
|
||||
}
|
||||
|
||||
.oe_edi_sidebar_container {
|
||||
width: 35%;
|
||||
padding: 10px;
|
||||
padding: 0px 10px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
div.oe_edi_center {
|
||||
margin: 25px;
|
||||
}
|
||||
|
||||
.oe_edi_right_top {
|
||||
margin-right: 5px;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
.oe_edi_nested_block {
|
||||
margin-left: 25px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.oe_edi_right_top .oe_edi_nested_block label {
|
||||
float: left;
|
||||
text-align: right;
|
||||
|
@ -47,3 +42,113 @@ button.oe_edi_action_print {
|
|||
font-weight: bold;
|
||||
min-width: 5em;
|
||||
}
|
||||
|
||||
/** Paperbox, from http://www.sitepoint.com/pure-css3-paper-curl/ **/
|
||||
body {
|
||||
background: #EEE; /* contrast with paper */
|
||||
}
|
||||
.oe_edi_paperbox {
|
||||
position: relative;
|
||||
width: 80%;
|
||||
padding: 5%;
|
||||
margin: 0 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: 13px;
|
||||
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 .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;
|
||||
}
|
||||
.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: rgb(142, 0, 0);
|
||||
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;
|
||||
}
|
|
@ -11,6 +11,8 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
|
|||
this.token = token;
|
||||
this.session = new openerp.web.Session();
|
||||
this.template = "EdiEmpty";
|
||||
this.content = "";
|
||||
this.sidebar = "";
|
||||
},
|
||||
start: function() {
|
||||
this._super();
|
||||
|
@ -20,12 +22,18 @@ openerp.edi.EdiView = openerp.web.Widget.extend({
|
|||
},
|
||||
on_document_loaded: function(docs){
|
||||
this.doc = docs[0];
|
||||
//console.log("docs",this.doc);
|
||||
var template = "Edi." + this.doc.__model + ".content";
|
||||
console.log("docs",this.doc);
|
||||
var template_content = "Edi." + this.doc.__model + ".content";
|
||||
var template_sidebar = "Edi." + this.doc.__model + ".sidebar";
|
||||
var param = {"widget":this, "doc":this.doc};
|
||||
this.center = openerp.web.qweb.render(template, param);
|
||||
//console.log(this.center);
|
||||
this.right = "";
|
||||
if (openerp.web.qweb.templates[template_sidebar]) {
|
||||
this.sidebar = openerp.web.qweb.render(template_sidebar, param);
|
||||
}
|
||||
console.log("sidebar",this.sidebar);
|
||||
if (openerp.web.qweb.templates[template_content]) {
|
||||
this.content = openerp.web.qweb.render(template_content, param);
|
||||
}
|
||||
console.log("sidebar",this.sidebar);
|
||||
this.$element.html(openerp.web.qweb.render("EdiView", param));
|
||||
this.$element.find('button.oe_edi_action_print').bind('click', this.do_print);
|
||||
this.$element.find('button.oe_edi_import_button').bind('click', this.do_import);
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%" id="oe_app" class="oe-application oe_forms">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" id="oe_header" class="header">
|
||||
<div> <a href="/" class="company_logo_link"> <div class="company_logo" /> </a> </div>
|
||||
<div> <a href="/" class="company_logo_link">
|
||||
<div class="company_logo"
|
||||
t-att-style="'background: url('+ (doc.company_address ? '/edi/binary?db='+widget.db+'&token='+widget.token : '/web/static/src/img/logo.png')+')'"/></a> </div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -14,8 +16,10 @@
|
|||
<table cellspacing="0" cellpadding="0" border="0" height="100%" width="100%">
|
||||
<tr>
|
||||
<td class="oe_edi_view">
|
||||
<p class="oe_form_paragraph"><t t-raw="widget.center"/></p>
|
||||
<button type="button" class="oe_edi_action_print">View/Print PDF</button>
|
||||
<p class="oe_form_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">
|
||||
|
@ -42,6 +46,7 @@
|
|||
<button type="button" class="oe_edi_import_button">Continue</button>
|
||||
|
||||
<div class="oe_edi_right_bottom">
|
||||
<t t-raw="widget.sidebar"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -1,123 +1,136 @@
|
|||
<template>
|
||||
<t t-name="Edi.account.invoice.content">
|
||||
<h1>Invoice <t t-esc="doc.internal_number"/>: <t t-esc="doc.amount_total"/><t t-esc="doc.currency_id[1]"/></h1>
|
||||
<p>
|
||||
<b><t t-esc="doc.company_id[1]"/></b><br/>
|
||||
<t t-if="doc.company_address">
|
||||
<t t-esc="doc.company_address.zip"/> <t t-esc="doc.company_address.street"/><br/>
|
||||
<t t-esc="doc.company_address.city"/><br/>
|
||||
<t t-if="doc.company_address.country_id" t-esc="doc.company_address.country_id[1]"/><br/>
|
||||
Phone: <t t-esc="doc.company_address.phone"/>
|
||||
</t>
|
||||
</p>
|
||||
<p align="right">
|
||||
<b><t t-esc="doc.partner_id[1]"/></b><br/>
|
||||
<t t-if="doc.partner_address">
|
||||
<t t-esc="doc.partner_address.zip"/> <t t-esc="doc.partner_address.street"/><br/>
|
||||
<t t-esc="doc.partner_address.city"/><br/>
|
||||
<t t-if="doc.partner_address.country_id" t-esc="doc.partner_address.country_id[1]"/><br/>
|
||||
Phone: <t t-esc="doc.partner_address.phone"/>
|
||||
</t>
|
||||
</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="doc.name"/><t t-esc="doc.comment"/></td>
|
||||
<td align="left"><t t-esc="doc.date_invoice"/></td>
|
||||
<td align="left"><t t-esc="doc.origin"/></td>
|
||||
<td align="left"><t t-esc="doc.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="doc.invoice_line" t-foreach="doc.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="doc.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="doc.amount_untaxed"/><t t-esc="doc.currency_id[1]"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td>Taxes: </td>
|
||||
<td align="right"><t t-esc="doc.amount_tax"/><t t-esc="doc.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="doc.amount_total"/><t t-esc="doc.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>
|
||||
<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="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-esc="doc.name"/></td>
|
||||
<td align="left"><t t-esc="doc.date_invoice"/></td>
|
||||
<td align="left"><t 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="invoice_line.quantity"/> <t t-esc="invoice_line.uos_id[1]"/></td>
|
||||
<td align="right"><t t-esc="invoice_line.price_unit"/></td>
|
||||
<td align="right"><t t-esc="invoice_line.discount"/></td>
|
||||
<td align="right"><t t-esc="invoice_line.price_subtotal"/> <t t-esc="doc.currency.code"/></td>
|
||||
</tr>
|
||||
<t t-if="doc.tax_line"><t t-foreach="doc.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="doc.currency_id[1]"/></td>
|
||||
<td align="right"><t t-esc="tax_line.amount"/><t t-esc="doc.currency_id[1]"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
</t>
|
||||
</table>
|
||||
</td>
|
||||
<td colspan="2"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</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="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="doc.amount_tax or 0.0"/> <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="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="tax_line.base_amount"/> <t t-esc="doc.currency.code"/></td>
|
||||
<td align="right"><t t-esc="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">
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td>
|
||||
<b>Pay this Invoice in Online</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<hr/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<!-- TODO replace this with correct <form>s to payement gw -->
|
||||
<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>
|
||||
<p class="oe_edi_sidebar_title">Pay Online</p>
|
||||
<!-- TODO replace this with correct <form>s to payement gw -->
|
||||
<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>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
|
|
|
@ -1,80 +1,137 @@
|
|||
<template>
|
||||
<t t-name="Edi.sale.order.content">
|
||||
<h1>Order <t t-esc="doc.name"/>: <t t-esc="doc.amount_total"/><t t-esc="doc.currency_id[1]"/></h1>
|
||||
<p>
|
||||
<b><t t-esc="doc.company_id[1]"/></b><br/>
|
||||
<t t-if="doc.company_address">
|
||||
<t t-esc="doc.company_address.zip"/> <t t-esc="doc.company_address.street"/><br/>
|
||||
<t t-esc="doc.company_address.city"/><br/>
|
||||
<t t-if="doc.company_address.country_id" t-esc="doc.company_address.country_id[1]"/><br/>
|
||||
Phone: <t t-esc="doc.company_address.phone"/>
|
||||
</t>
|
||||
</p>
|
||||
<p align="right">
|
||||
<b><t t-esc="doc.partner_id[1]"/></b><br/>
|
||||
<t t-if="doc.partner_order_id" t-esc="doc.partner_order_id[1]"/>
|
||||
<t t-if="doc.partner_address_id" t-esc="doc.partner_address_id[1]"/>
|
||||
</p>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<th align="left">Description</th>
|
||||
<th align="left">Date</th>
|
||||
<th align="left">Origin</th>
|
||||
<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">Order <t t-esc="doc.name"/>: <t t-esc="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">Your Reference</th>
|
||||
<th align="left">Date</th>
|
||||
<th align="left">Salesman</th>
|
||||
<th align="left">Payment terms</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left"><t t-esc="doc.name"/></td>
|
||||
<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-esc="doc.origin"/></td>
|
||||
<td align="left">TODO</td>
|
||||
<td align="left">
|
||||
<t t-if="doc.partner_ref" t-esc="doc.partner_ref"/>
|
||||
<t t-if="doc.client_order_ref" t-esc="doc.client_order_ref"/>
|
||||
<t t-if="doc.payment_term" t-esc="doc.payment_term[1]"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width="100%" >
|
||||
<tr>
|
||||
<p/>
|
||||
<table width="100%" class="oe_edi_data">
|
||||
<tr class="oe_edi_floor">
|
||||
<th align="left">Product Description</th>
|
||||
<th align="center">Unit Price</th>
|
||||
<th align="center">Quantity</th>
|
||||
<th align="center">UOM</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>
|
||||
<td align="left"><t t-esc="doc_line.product_id[1]"/></td>
|
||||
<td align="center"><t t-esc="doc_line.price_unit"/></td>
|
||||
<td align="center">
|
||||
<t t-if="doc_line.product_qty" t-esc="doc_line.product_qty"/>
|
||||
<t t-if="doc_line.product_uom_qty" t-esc="doc_line.product_uom_qty"/>
|
||||
</td>
|
||||
<td align="center"><t t-esc="doc_line.product_uom[1]"/></td>
|
||||
<td align="right"><t t-esc="doc_line.price_subtotal"/><t t-esc="doc.currency_id[1]"/></td>
|
||||
<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="doc_line.product_qty"/> <t t-esc="doc_line.product_uom[1]"/>
|
||||
</td>
|
||||
<td align="right"><t t-esc="doc_line.price_unit"/></td>
|
||||
<td align="right"><t t-esc="doc_line.discount"/></td>
|
||||
<td align="right"><t t-esc="doc_line.price_subtotal"/> <t t-esc="doc.currency.code"/></td>
|
||||
</tr>
|
||||
</t>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td colspan="2"><hr/></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="doc.amount_untaxed"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td>Net Total: </td>
|
||||
<td align="right"><t t-esc="doc.amount_untaxed"/><t t-esc="doc.currency_id[1]"/><t/></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="doc.amount_tax or 0.0"/> <t t-esc="doc.currency.code"/>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td>Taxes: </td>
|
||||
<td align="right"><t t-esc="doc.amount_tax"/><t t-esc="doc.currency_id[1]"/><t/></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="doc.amount_total"/><t t-esc="doc.currency_id[1]"/><t/></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="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">
|
||||
<p class="oe_edi_sidebar_title">Pay Online</p>
|
||||
|
||||
<input type="radio" id="oe_edi_pay_paypal" name="oe_edi_invoice_rd_pay" value="paypal"/>
|
||||
<label for="oe_edi_pay_paypal">Paypal</label>
|
||||
<a href="#"><img src="https://www.paypal.com/en_US/i/btn/btn_paynowCC_LG.gif"/></a>
|
||||
<br/>
|
||||
|
||||
<input type="radio" id="oe_edi_pay_bank" name="oe_edi_invoice_rd_pay" value="bank"/>
|
||||
<label for="oe_edi_pay_paypal">Bank wire Transfer</label>
|
||||
</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>
|
||||
|
|
|
@ -35,6 +35,9 @@ PURCHASE_ORDER_LINE_EDI_STRUCT = {
|
|||
'price_unit': True,
|
||||
'product_qty': True,
|
||||
'notes': True,
|
||||
|
||||
# fields used for web preview only - discarded on import
|
||||
'price_subtotal': True,
|
||||
}
|
||||
|
||||
PURCHASE_ORDER_EDI_STRUCT = {
|
||||
|
@ -174,6 +177,7 @@ class purchase_order(osv.osv, EDIMixin):
|
|||
edi_document.pop('amount_total', None)
|
||||
edi_document.pop('amount_tax', None)
|
||||
edi_document.pop('amount_untaxed', None)
|
||||
edi_document.pop('payment_term', None)
|
||||
|
||||
for order_line in edi_document['order_line']:
|
||||
self._edi_requires_attributes(('date_planned', 'product_id', 'product_uom', 'product_qty', 'price_unit'), order_line)
|
||||
|
@ -185,6 +189,8 @@ class purchase_order(osv.osv, EDIMixin):
|
|||
# sale order lines have sequence numbers, not purchase order lines
|
||||
order_line.pop('sequence', None)
|
||||
|
||||
# discard web preview fields, if present
|
||||
order_line.pop('price_subtotal', None)
|
||||
return super(purchase_order,self).edi_import(cr, uid, edi_document, context=context)
|
||||
|
||||
class purchase_order_line(osv.osv, EDIMixin):
|
||||
|
|
|
@ -3,19 +3,7 @@
|
|||
<data>
|
||||
<!--Export edi document -->
|
||||
<record id="ir_actions_server_edi_purchase" model="ir.actions.server">
|
||||
<field name="code"><![CDATA[
|
||||
try:
|
||||
if not object.partner_id.opt_out:
|
||||
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default="<WEB_ROOT_URL>")
|
||||
|
||||
# accessing the template will fail if it has been deleted - so we'll skip everything
|
||||
tmpl = self.pool.get('ir.model.data').get_object(cr, uid, 'purchase', 'email_template_edi_purchase')
|
||||
|
||||
edi_token = self.pool.get('edi.document').export_edi(cr, uid, [object], context = context)[0]
|
||||
context.update(edi_web_url_view='%s/web/view_edi?db=%s&token=%s' %(web_root_url, cr.dbname, edi_token))
|
||||
self.pool.get('email.template').send_mail(cr, uid,tmpl.id,object.id,context=context)
|
||||
except:
|
||||
pass]]></field>
|
||||
<field name="code"><![CDATA[if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='purchase.email_template_edi_purchase', context=context)]]></field>
|
||||
<field name="state">code</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="model_id" ref="purchase.model_purchase_order"/>
|
||||
|
@ -63,7 +51,7 @@ except:
|
|||
<p>
|
||||
You can view the order confirmation document, download it and pay online using the following link:
|
||||
</p>
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||
href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
|
||||
|
||||
% if object.company_id.paypal_account:
|
||||
|
@ -80,7 +68,7 @@ except:
|
|||
%>
|
||||
<br/>
|
||||
<p>It is also possible to directly pay with Paypal:</p>
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||
href="${paypal_url}">Pay with Paypal</a>
|
||||
% endif
|
||||
|
||||
|
@ -89,12 +77,12 @@ except:
|
|||
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
|
||||
<br/>
|
||||
<br/>
|
||||
<div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; ">
|
||||
<h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); ">
|
||||
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
|
||||
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
|
||||
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
|
||||
</div>
|
||||
<div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); ">
|
||||
<span style="color: rgb(38, 72, 149); margin-bottom: 5px; display: block; ">
|
||||
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
|
||||
<span style="color: #222; margin-bottom: 5px; display: block; ">
|
||||
% if object.company_id.street:
|
||||
${object.company_id.street}<br/>
|
||||
% endif
|
||||
|
|
|
@ -36,6 +36,9 @@ SALE_ORDER_LINE_EDI_STRUCT = {
|
|||
#custom: 'product_qty'
|
||||
'discount': True,
|
||||
'notes': True,
|
||||
|
||||
# fields used for web preview only - discarded on import
|
||||
'price_subtotal': True,
|
||||
}
|
||||
|
||||
SALE_ORDER_EDI_STRUCT = {
|
||||
|
@ -53,6 +56,7 @@ SALE_ORDER_EDI_STRUCT = {
|
|||
'amount_total': True,
|
||||
'amount_untaxed': True,
|
||||
'amount_tax': True,
|
||||
'payment_term': True,
|
||||
}
|
||||
|
||||
class sale_order(osv.osv, EDIMixin):
|
||||
|
@ -186,6 +190,9 @@ class sale_order(osv.osv, EDIMixin):
|
|||
delay = (datetime.strptime(date_planned, DEFAULT_SERVER_DATE_FORMAT) - \
|
||||
datetime.strptime(date_order, DEFAULT_SERVER_DATE_FORMAT)).days
|
||||
order_line['delay'] = delay
|
||||
|
||||
# discard web preview fields, if present
|
||||
order_line.pop('price_subtotal', None)
|
||||
return super(sale_order,self).edi_import(cr, uid, edi_document, context=context)
|
||||
|
||||
class sale_order_line(osv.osv, EDIMixin):
|
||||
|
|
|
@ -3,19 +3,7 @@
|
|||
<data>
|
||||
<!-- EDI Export + Send email Action -->
|
||||
<record id="ir_actions_server_edi_sale" model="ir.actions.server">
|
||||
<field name="code"><![CDATA[
|
||||
try:
|
||||
if not object.partner_id.opt_out:
|
||||
web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url', default="<WEB_ROOT_URL>")
|
||||
|
||||
# accessing the template will fail if it has been deleted - so we'll skip everything
|
||||
tmpl = self.pool.get('ir.model.data').get_object(cr, uid, 'sale', 'email_template_edi_sale')
|
||||
|
||||
edi_token = self.pool.get('edi.document').export_edi(cr, uid, [object], context = context)[0]
|
||||
context.update(edi_web_url_view='%s/edi/view?debug=1&db=%s&token=%s' %(web_root_url, cr.dbname, edi_token))
|
||||
self.pool.get('email.template').send_mail(cr, uid,tmpl.id,object.id,context=context)
|
||||
except:
|
||||
pass]]></field>
|
||||
<field name="code"><![CDATA[if not object.partner_id.opt_out: object.edi_export_and_email(template_ext_id='sale.email_template_edi_sale', context=context)]]></field>
|
||||
<field name="state">code</field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="model_id" ref="sale.model_sale_order"/>
|
||||
|
@ -65,7 +53,7 @@ except:
|
|||
<p>
|
||||
You can view the order confirmation document, download it and pay online using the following link:
|
||||
</p>
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||
href="${ctx.get('edi_web_url_view') or ''}">View Order</a>
|
||||
|
||||
% if object.company_id.paypal_account:
|
||||
|
@ -82,7 +70,7 @@ except:
|
|||
%>
|
||||
<br/>
|
||||
<p>It is also possible to directly pay with Paypal:</p>
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-radius: 2px 2px; background-position: 0% 0%; background-repeat: repeat no-repeat;"
|
||||
<a style="display:block; width: 150px; height:20px; margin-left: 120px; color: #FFF; font-family: 'Lucida Grande', Helvetica, Arial, sans-serif; font-size: 13px; font-weight: bold; text-align: center; text-decoration: none !important; line-height: 1; padding: 5px 0px 0px 0px; background-color: #8E0000; border-radius: 5px 5px; background-repeat: repeat no-repeat;"
|
||||
href="${paypal_url}">Pay with Paypal</a>
|
||||
% endif
|
||||
|
||||
|
@ -91,12 +79,12 @@ except:
|
|||
<p>Thank you for choosing ${object.company_id.name or 'us'}!</p>
|
||||
<br/>
|
||||
<br/>
|
||||
<div style="width: 375px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; overflow-x: hidden; overflow-y: hidden; zoom: 1; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(142, 0, 0); border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; border-bottom-right-radius: 0px 0px; border-bottom-left-radius: 0px 0px; background-position: 0% 0%; background-repeat: repeat no-repeat; ">
|
||||
<h3 style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 9px; padding-right: 14px; padding-bottom: 9px; padding-left: 14px; font-size: 12px; font-weight: normal; font-style: normal; color: rgb(255, 255, 255); ">
|
||||
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #8E0000; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
|
||||
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #FFF;">
|
||||
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
|
||||
</div>
|
||||
<div style="width: 347px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 12px; padding-right: 14px; padding-bottom: 12px; padding-left: 14px; overflow-x: hidden; overflow-y: hidden; zoom: 1; line-height: 16px; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(242, 242, 242); ">
|
||||
<span style="color: rgb(38, 72, 149); margin-bottom: 5px; display: block; ">
|
||||
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #F2F2F2;">
|
||||
<span style="color: #222; margin-bottom: 5px; display: block; ">
|
||||
% if object.company_id.street:
|
||||
${object.company_id.street}<br/>
|
||||
% endif
|
||||
|
|
Loading…
Reference in New Issue