[IMP]: made changes and removed unwanted code
bzr revid: han@tinyerp.com-20110819132422-5frpi82rdhczpykb
This commit is contained in:
@@ -26,6 +26,8 @@ import time
|
||||
import base64
|
||||
import urllib2
|
||||
import openerp.release as release
|
||||
from tools.translate import _
|
||||
import netsvc
|
||||
|
||||
edi_module = 'edi_import'
|
||||
|
||||
@@ -122,13 +124,19 @@ class ir_edi_document(osv.osv):
|
||||
|
||||
:param edi_dicts: list of edi_dict
|
||||
"""
|
||||
module_obj =self.pool.get('ir.module.module')
|
||||
res = []
|
||||
for edi_document in edi_documents:
|
||||
model = edi_document.get('__model')
|
||||
assert model, _('model should be provided in EDI Dict')
|
||||
model_obj = self.pool.get(model)
|
||||
record_id = model_obj.edi_import(cr, uid, edi_document, context=context)
|
||||
res.append((model,record_id))
|
||||
module = edi_document.get('__module')
|
||||
module_id = module_obj.search(cr, uid, [('name','=',module),('state','=','installed')])
|
||||
if module_id:
|
||||
model = edi_document.get('__model')
|
||||
assert model, _('model should be provided in EDI Dict')
|
||||
model_obj = self.pool.get(model)
|
||||
record_id = model_obj.edi_import(cr, uid, edi_document, context=context)
|
||||
res.append((model,record_id))
|
||||
else:
|
||||
raise osv.except_osv(_('Invalid action !'), _('Module is not Installed'))
|
||||
return res
|
||||
|
||||
def deserialize(self, edi_document_string):
|
||||
|
||||
@@ -111,7 +111,7 @@ class res_partner(osv.osv):
|
||||
_order = "name"
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=128, required=True, select=True),
|
||||
'opt_out':fields.boolean('Opt-out'),
|
||||
'opt_out':fields.boolean('Opt-out', help='After enable opt-out, Automated Mail will not be sent to provided email address of partner'),
|
||||
'date': fields.date('Date', select=1),
|
||||
'title': fields.many2one('res.partner.title','Partner Firm'),
|
||||
'parent_id': fields.many2one('res.partner','Parent Partner'),
|
||||
@@ -150,7 +150,7 @@ class res_partner(osv.osv):
|
||||
'customer': lambda *a: 1,
|
||||
'category_id': _default_category,
|
||||
'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'res.partner', context=c),
|
||||
'opt_out' : False
|
||||
'opt_out' : True
|
||||
}
|
||||
def copy(self, cr, uid, id, default={}, context={}):
|
||||
name = self.read(cr, uid, [id], ['name'])[0]['name']
|
||||
|
||||
@@ -40,10 +40,8 @@ from cStringIO import StringIO
|
||||
import threading
|
||||
|
||||
class edi(netsvc.ExportService):
|
||||
def exp_get_edi_document(self, edi_token, db_name=None):
|
||||
def exp_get_edi_document(self, edi_token, db_name):
|
||||
res = None
|
||||
if not db_name:
|
||||
db_name = getattr(threading.currentThread(), 'dbname', None)
|
||||
if db_name:
|
||||
cr = pooler.get_db(db_name).cursor()
|
||||
else:
|
||||
@@ -74,8 +72,8 @@ class edi(netsvc.ExportService):
|
||||
pool = pooler.get_pool(db)
|
||||
edi_pool = pool.get('ir.edi.document')
|
||||
try:
|
||||
cr.autocommit(True)
|
||||
res = edi_pool.import_edi(cr, uid, edi_url=edi_url, context=context)
|
||||
cr.commit()
|
||||
finally:
|
||||
cr.close()
|
||||
return res
|
||||
|
||||
Reference in New Issue
Block a user