diff --git a/addons/account/i18n/it.po b/addons/account/i18n/it.po index 79335be4e75..d38b9e78254 100644 --- a/addons/account/i18n/it.po +++ b/addons/account/i18n/it.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.0\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-03-29 15:32+0000\n" -"Last-Translator: Carlo Vettore \n" +"PO-Revision-Date: 2010-04-26 07:46+0000\n" +"Last-Translator: eLBati - albatos.com \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-04-17 04:06+0000\n" +"X-Launchpad-Export-Date: 2010-04-28 03:44+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account @@ -1192,7 +1192,7 @@ msgstr "Report tassa" #: wizard_button:account.analytic.account.chart,init,open:0 #: wizard_button:account.chart,init,open:0 msgid "Open Charts" -msgstr "Conti aperti" +msgstr "Apri" #. module: account #: wizard_view:account.fiscalyear.close.state,init:0 @@ -2301,6 +2301,8 @@ msgstr "" #: wizard_view:account.chart,init:0 msgid "(If you do not select Fiscal year it will take all open fiscal years)" msgstr "" +"Se non si seleziona un anno fiscale, verranno visualizzati tutti gli anni " +"fiscali aperti" #. module: account #: help:account.invoice.tax,base_code_id:0 @@ -4429,7 +4431,7 @@ msgstr "" #. module: account #: wizard_view:account.wizard_paid_open,init:0 msgid "Open Invoice" -msgstr "Fattura aperta" +msgstr "Apri fattura" #. module: account #: model:process.node,note:account.process_node_draftstatement0 diff --git a/addons/account/i18n/pl.po b/addons/account/i18n/pl.po index 12e8c9efdf8..6634fd4f9ec 100644 --- a/addons/account/i18n/pl.po +++ b/addons/account/i18n/pl.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.0\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-04-25 17:34+0000\n" +"PO-Revision-Date: 2010-04-27 19:28+0000\n" "Last-Translator: Grzegorz Grzelak (Cirrus.pl) \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-04-26 03:42+0000\n" +"X-Launchpad-Export-Date: 2010-04-28 03:44+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account @@ -2087,7 +2087,7 @@ msgstr "Wydatki" #. module: account #: field:account.journal,invoice_sequence_id:0 msgid "Invoice Sequence" -msgstr "Numeracja faktury" +msgstr "Numeracja faktur" #. module: account #: wizard_view:account.automatic.reconcile,init:0 diff --git a/addons/account_tax_include/i18n/cs.po b/addons/account_tax_include/i18n/cs.po index cd4dfc6f3ed..2cc4bc1bcc0 100644 --- a/addons/account_tax_include/i18n/cs.po +++ b/addons/account_tax_include/i18n/cs.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.4\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2009-08-28 16:01+0000\n" -"PO-Revision-Date: 2010-04-25 21:20+0000\n" +"PO-Revision-Date: 2010-04-26 09:10+0000\n" "Last-Translator: Martin Volf \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2010-04-26 03:41+0000\n" +"X-Launchpad-Export-Date: 2010-04-28 03:44+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_tax_include @@ -24,12 +24,12 @@ msgstr "Neplatný XML pro zobrazení architektury" #. module: account_tax_include #: field:account.invoice,price_type:0 msgid "Price method" -msgstr "" +msgstr "Metoda určování cen" #. module: account_tax_include #: model:ir.module.module,shortdesc:account_tax_include.module_meta_information msgid "Invoices and prices with taxes included" -msgstr "" +msgstr "Faktury a ceny včetně daní" #. module: account_tax_include #: selection:account.invoice,price_type:0 diff --git a/addons/base_module_record/base_module_record.py b/addons/base_module_record/base_module_record.py index 97c0ada4bca..899241b4188 100644 --- a/addons/base_module_record/base_module_record.py +++ b/addons/base_module_record/base_module_record.py @@ -30,19 +30,26 @@ import tools #objects_proxy = netsvc.ExportService.getService('object').__class__ class recording_objects_proxy(osv_pool): def execute(self, *args, **argv): - if len(args) >= 6 and isinstance(args[5], dict): + if args[3] == 'create': + _old_args = args[4].copy() + elif args[3] == 'write': _old_args = args[5].copy() + elif len(args) >= 5 and isinstance(args[4], dict): + _old_args = args[4].copy() else: _old_args = None res = super(recording_objects_proxy, self).execute(*args, **argv) pool = pooler.get_pool(args[0]) mod = pool.get('ir.module.record') + if mod and mod.recording: if args[3] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc', 'unlink'): if _old_args is not None: - args[5].update(_old_args) - if args[5]: - mod.recording_data.append(('query', args, argv,res)) + if args[3] == 'create': + args[4].update(_old_args) + elif args[3] == 'write': + args[5].update(_old_args) + mod.recording_data.append(('query', args, argv,res)) return res def exec_workflow(self, *args, **argv): @@ -125,7 +132,8 @@ class base_module_record(osv.osv): name = filter(lambda x: x in string.letters, (data.get('name','') or '').lower()) except: name='' - val = model.replace('.','_')+'_'+name+ str(i) +# name=data.get('name','') or ''.lower() + val = model.replace('.','_')+'_'+ name + str(i) i+=1 if val not in self.ids.values(): break @@ -146,7 +154,6 @@ class base_module_record(osv.osv): def _create_record(self, cr, uid, doc, model, data, record_id, noupdate=False): - data_pool = self.pool.get('ir.model.data') model_pool = self.pool.get(model) record = doc.createElement('record') @@ -196,12 +203,26 @@ class base_module_record(osv.osv): fname = model_pool._columns[key]._fields_id else: fname = model_pool._inherit_fields[key][2]._fields_id - valitem[2][fname] = record_id - newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1]) - if not newid: + if valitem[0] == 0: newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2]) + valitem[1]=newid + else: + newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1]) + if not newid: + newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2]) + valitem[1]=newid self.ids[(fields[key]['relation'], valitem[1])] = newid - +# if valitem[0] in (0,1): +# if key in model_pool._columns: +# fname = model_pool._columns[key]._fields_id +# else: +# fname = model_pool._inherit_fields[key][2]._fields_id +# valitem[2][fname] = record_id +# newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1]) +# if not newid: +# newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2]) +# self.ids[(fields[key]['relation'], valitem[1])] = newid +# childrecord, update = self._create_record(cr, uid, doc, fields[key]['relation'],valitem[2], newid) noupdate = noupdate or update record_list += childrecord @@ -245,7 +266,7 @@ class base_module_record(osv.osv): for key,val in data.items(): if ((key in defaults[model]) and (val == defaults[model][key])) and not(fields[key].get('required',False)): continue - if not (val or (fields[key]['type']=='boolean')): + if not (val or (fields[key]['type']=='function')): continue elif fields[key]['type'] in ('boolean',): if not val: @@ -267,12 +288,9 @@ class base_module_record(osv.osv): fname = model_pool._columns[key]._fields_id else: fname = model_pool._inherit_fields[key][2]._fields_id - valitem[2][fname] = record_id - newid,update = self._get_id(cr, uid, fields[key]['relation'], valitem[1]) - if not newid: - newid = self._create_id(cr, uid, fields[key]['relation'], valitem[2]) - self.ids[(fields[key]['relation'], valitem[1])] = newid - childrecord = self._create_yaml_record(cr, uid, fields[key]['relation'],valitem[2], newid) + del valitem[2][fname] #delete parent_field from child's fields list + + childrecord = self._create_yaml_record(cr, uid, fields[key]['relation'],valitem[2], None) items[0].append(childrecord['attrs']) attrs[key] = items elif fields[key]['type'] in ('many2many',): @@ -289,11 +307,11 @@ class base_module_record(osv.osv): if m2m[0]: attrs[key] = m2m else: - val=val.replace('"','\'') try: attrs[key]=str(val) except: attrs[key]=tools.ustr(val) + attrs[key]=attrs[key].replace('"','\'') record['attrs'] = attrs return record @@ -311,7 +329,7 @@ class base_module_record(osv.osv): for f in filter(lambda a: isinstance(obj._columns[a], fields.function)\ and (not obj._columns[a].store),obj._columns): del data[f] - + for key,val in data.items(): if result.has_key(key): continue @@ -361,16 +379,16 @@ class base_module_record(osv.osv): def _generate_object_xml(self, cr, uid, rec, recv, doc, result=None): record_list = [] noupdate = False - if rec[4]=='write': - for id in rec[5]: - id,update = self._get_id(cr, uid, rec[3], id) + if rec[3]=='write': + for id in rec[4]: + id,update = self._get_id(cr, uid, rec[2], id) noupdate = noupdate or update if not id: continue - record,update = self._create_record(cr, uid, doc, rec[3], rec[6], id) + record,update = self._create_record(cr, uid, doc, rec[2], rec[5], id) noupdate = noupdate or update record_list += record - + elif rec[4] in ('menu_create',): for id in rec[5]: id,update = self._get_id(cr, uid, rec[3], id) @@ -487,7 +505,10 @@ class base_module_record(osv.osv): yaml_file += str(object) + '''\n\n''' else: record= self._generate_object_yaml(cr, uid, rec[1],rec[3]) - yaml_file+="!comment Creating an %s record"%(record['model']) + '''\n''' + if self.mode == "create" or self.mode == "copy": + yaml_file+="!comment Creating a %s record"%(record['model']) + '''\n''' + else: + yaml_file+="!comment Modifying a %s record"%(record['model']) + '''\n''' object= yaml.load(unicode('''\n !record %s \n'''%record,'iso-8859-1')) yaml_file += str(object) + '''\n''' attrs=yaml.dump(object.attrs, default_flow_style=False) diff --git a/addons/base_setup/base_setup_installer.xml b/addons/base_setup/base_setup_installer.xml index 7a6d61a0e08..594133d3b12 100644 --- a/addons/base_setup/base_setup_installer.xml +++ b/addons/base_setup/base_setup_installer.xml @@ -28,7 +28,7 @@ If you don't think you need any of these right now, you can easily install them - + diff --git a/addons/base_setup/installer.py b/addons/base_setup/installer.py index 2c1ba113e47..9a817eaf10e 100644 --- a/addons/base_setup/installer.py +++ b/addons/base_setup/installer.py @@ -73,6 +73,7 @@ class base_setup_installer(osv.osv_memory): 'report_designer':fields.boolean('Advanced Reporting', help="Lets you install various tools to simplify and enhance " "OpenERP's report creation."), + 'thunderbird' :fields.boolean('Thunderbird'), # Vertical modules 'profile_association':fields.boolean('Associations', help="Installs a preselected set of OpenERP " diff --git a/addons/crm/crm_meeting.py b/addons/crm/crm_meeting.py index 495eb9f351a..6979f3e5eee 100644 --- a/addons/crm/crm_meeting.py +++ b/addons/crm/crm_meeting.py @@ -65,7 +65,7 @@ class crm_meeting(osv.osv): _defaults = { 'state': lambda *a: 'draft', } - + def open_meeting(self, cr, uid, ids, context=None): """ Open Crm Meeting Form for Crm Meeting. @@ -75,13 +75,14 @@ class crm_meeting(osv.osv): @param context: A standard dictionary for contextual values @return: Dictionary value which open Crm Meeting form. """ + if not context: context = {} - + data_obj = self.pool.get('ir.model.data') - + value = {} - + id2 = data_obj._get_id(cr, uid, 'crm', 'crm_case_form_view_meet') id3 = data_obj._get_id(cr, uid, 'crm', 'crm_case_tree_view_meet') id4 = data_obj._get_id(cr, uid, 'crm', 'crm_case_calendar_view_meet') @@ -93,17 +94,17 @@ class crm_meeting(osv.osv): id4 = data_obj.browse(cr, uid, id4, context=context).res_id for id in ids: value = { - 'name': _('Meeting'), - 'view_type': 'form', - 'view_mode': 'form,tree', - 'res_model': 'crm.meeting', - 'view_id': False, + 'name': _('Meeting'), + 'view_type': 'form', + 'view_mode': 'form,tree', + 'res_model': 'crm.meeting', + 'view_id': False, 'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')], - 'type': 'ir.actions.act_window', - 'res_id': base_calendar.base_calendar_id2real_id(id), + 'type': 'ir.actions.act_window', + 'res_id': base_calendar.base_calendar_id2real_id(id), 'nodestroy': True } - + return value crm_meeting() diff --git a/addons/document/__openerp__.py b/addons/document/__openerp__.py index 2ffb708738c..7626bd3c51b 100644 --- a/addons/document/__openerp__.py +++ b/addons/document/__openerp__.py @@ -46,6 +46,9 @@ 'report/document_report_view.xml' ], 'demo_xml': [ 'document_demo.xml',], + 'test': [ + 'test/document_test.yml', + ], 'installable': True, 'active': False, 'certificate': None, diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index c9c124cdfe0..19c4489132c 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -105,7 +105,11 @@ class document_directory(osv.osv): ] def name_get(self, cr, uid, ids, context={}): res = [] + all_ids = self.search(cr,uid,[]) for d in self.browse(cr, uid, ids, context=context): + if d.id not in all_ids: + continue + s = '' d2 = d while d2 and d2.parent_id: diff --git a/addons/document/test/document_test.yml b/addons/document/test/document_test.yml new file mode 100644 index 00000000000..fe3008d35da --- /dev/null +++ b/addons/document/test/document_test.yml @@ -0,0 +1,52 @@ +- | + In order to test the Document Management System In OpenERP. +- + In order to test behaviour of resource Directory I will make one resource Directory "Partner Labels" in OpenERP having type "Other Resources" and Directory mapped to object "Partner" +- + !record {model: 'document.directory', id: dir_partner_label}: + name : "Partner Labels" + storage_id : storage_default + type : ressource + content_ids: + - name: "Label" + report_id : base.res_partner_address_report +- + Assign "res.partner" object to ressource_type_id. +- + !python {model: document.directory}: | + ids = self.pool.get('ir.model').search(cr, uid, [('model','=','res.partner')]) + id = self.write(cr, uid, [ref("dir_partner_label")], {'ressource_type_id' : ids[0]}, context) +- + In order to check static directory in OpenERP which is the real directory just like system's local folders, + First I create a directory in OpenERP named "Directory 1" with storage as "Default File storage" and type as "Static Directory" +- + !record {model: 'document.directory', id: directory_1}: + name : "Directory 1" + storage_id : storage_default + type : directory +- + In order to make a directory hierarchy in OpenERP I will make other static directory "Directory 2" and I put its Parent Item as "Directory 1", + So I can see the directory hierarchy in OpenERP's client like :- Directory1 -> Directory2 +- + !record {model: 'document.directory', id: directory_2}: + name : "Directory 2" + storage_id : storage_default + type : directory + parent_id : directory_1 +- + I am create a one Document Attachment name "My document" and select "Directory 2" as its Directory, + And in order to put a File content. +- + When I am creating the document then "Resource Title" is filled automatic with "My document". +- + !record {model: 'ir.attachment', id: document_1}: + name : "My document" + parent_id : directory_2 +- + Attach a pdf file in "My document" +- + !python {model: ir.attachment}: | + import tools + import base64 + file = open(tools.config['addons_path'] + '/document/test/partner.pdf') + id = self.write(cr, uid, [ref("document_1")], {'datas' : base64.encodestring(file.read())}, context) diff --git a/addons/document/test/partner.pdf b/addons/document/test/partner.pdf new file mode 100644 index 00000000000..1b1c7f0daac --- /dev/null +++ b/addons/document/test/partner.pdf @@ -0,0 +1,118 @@ +%PDF-1.3 +%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com +% 'BasicFonts': class PDFDictionary +1 0 obj +% The standard fonts dictionary +<< /F1 2 0 R + /F2 3 0 R + /F3 4 0 R >> +endobj +% 'F1': class PDFType1Font +2 0 obj +% Font Helvetica +<< /BaseFont /Helvetica + /Encoding /WinAnsiEncoding + /Name /F1 + /Subtype /Type1 + /Type /Font >> +endobj +% 'F2': class PDFType1Font +3 0 obj +% Font Helvetica-Bold +<< /BaseFont /Helvetica-Bold + /Encoding /WinAnsiEncoding + /Name /F2 + /Subtype /Type1 + /Type /Font >> +endobj +% 'F3': class PDFType1Font +4 0 obj +% Font Times-Roman +<< /BaseFont /Times-Roman + /Encoding /WinAnsiEncoding + /Name /F3 + /Subtype /Type1 + /Type /Font >> +endobj +% 'Page1': class PDFPage +5 0 obj +% Page dictionary +<< /Contents 9 0 R + /MediaBox [ 0 + 0 + 841.8898 + 595.2756 ] + /Parent 8 0 R + /Resources << /Font 1 0 R + /ProcSet [ /PDF + /Text + /ImageB + /ImageC + /ImageI ] >> + /Rotate 0 + /Trans << >> + /Type /Page >> +endobj +% 'R6': class PDFCatalog +6 0 obj +% Document Root +<< /Outlines 10 0 R + /PageMode /UseNone + /Pages 8 0 R + /Type /Catalog >> +endobj +% 'R7': class PDFInfo +7 0 obj +<< /Author (Generated by OpenERP, Fabien Pinckaers) + /CreationDate (20100421145542) + /Keywords () + /Producer (ReportLab http://www.reportlab.com) + /Subject (\(unspecified\)) + /Title (Partner) >> +endobj +% 'R8': class PDFPages +8 0 obj +% page tree +<< /Count 1 + /Kids [ 5 0 R ] + /Type /Pages >> +endobj +% 'R9': class PDFStream +9 0 obj +% page stream +<< /Filter [ /ASCII85Decode + /FlateDecode ] + /Length 524 >> +stream +Gat=(?#P3ie[>S,B2ME\)S7:@oo6@nF8`I+h##OY3a-n#Qm!>5jiD.9pQ@E1#Xj$=)27)F3RmD%fbqZh,T`gJd0/,?A3`0:_VVm`"l`>oOf9p&HGF7>WCGVJoD2&_+c#BDb)/&0>>rL5@]KY$9YOAqZHTJq8k]!o+?4a5\-KbB#NYJC'`~>endstream + +endobj +% 'R10': class PDFOutlines +10 0 obj +<< /Count 0 + /Type /Outlines >> +endobj +xref +0 11 +0000000000 65535 f +0000000113 00000 n +0000000233 00000 n +0000000398 00000 n +0000000573 00000 n +0000000740 00000 n +0000001017 00000 n +0000001152 00000 n +0000001395 00000 n +0000001500 00000 n +0000002169 00000 n +trailer +<< /ID + % ReportLab generated PDF document -- digest (http://www.reportlab.com) + [(\210\344\006bE\230CUUi\010[\)Qif) (\210\344\006bE\230CUUi\010[\)Qif)] + + /Info 7 0 R + /Root 6 0 R + /Size 11 >> +startxref +2221 +%%EOF diff --git a/addons/document_ftp/__openerp__.py b/addons/document_ftp/__openerp__.py index b4c6b2c0b71..7fcdfd8d0d5 100644 --- a/addons/document_ftp/__openerp__.py +++ b/addons/document_ftp/__openerp__.py @@ -37,6 +37,9 @@ 'security/ir.model.access.csv' ], 'demo_xml': [], + 'test': [ + 'test/document_ftp_test.yml', + ], 'installable': True, 'active': False, 'certificate': None, diff --git a/addons/document_ftp/test/document_ftp_test.yml b/addons/document_ftp/test/document_ftp_test.yml new file mode 100644 index 00000000000..f7c4abb0cdf --- /dev/null +++ b/addons/document_ftp/test/document_ftp_test.yml @@ -0,0 +1,87 @@ +- | + In order to test the document_ftp module in OpenERP, I will try different operation on the FTP interface, and check their impacts on OpenERP's documents and vice-versa. +- + In order to test behaviour of resource Directory I will make one resource Directory "Labels" in OpenERP having type "Other Resources" and Directory mapped to object "Partner" +- + !record {model: 'document.directory', id: dir_label}: + name : "Labels" + storage_id : document.storage_default + type : ressource + content_ids: + - name: "Label" + report_id : base.res_partner_address_report +- + Assign "res.partner" object to ressource_type_id. +- + !python {model: document.directory}: | + ids = self.pool.get('ir.model').search(cr, uid, [('model','=','res.partner')]) + id = self.write(cr, uid, [ref("dir_label")], {'ressource_type_id' : ids[0]}, context) +- + In order to check static directory in OpenERP which is the real directory just like system's local folders, + First I create a directory in OpenERP named "Directory 1" with storage as "Default File storage" and type as "Static Directory" +- + !record {model: 'document.directory', id: directory_file}: + name : "File" + storage_id : document.storage_default + type : directory +- + I am create a one Document name "Document" and select "File" as its Directory, +- + When I am creating the record then "Resource Title" is filled automatic with "Document". +- + !record {model: 'ir.attachment', id: document_1}: + name : "Document" + parent_id : directory_file +- + In order to connect FTP server and set "File" path. + I create one directory "New" in "File" directory from FTP and check its effect in OpenERP +- + Also Rename the directory name "New" to "New Directory". +- + Remove directory "New Directory" and remove file "Document". +- + !python {model: ir.attachment}: | + from ftplib import FTP + from tools.misc import detect_ip_addr + from tools import config + ftp = FTP() + if detect_ip_addr: + host = config.get('ftp_server_host', detect_ip_addr()) + else: + host = config.get('ftp_server_host', '127.0.0.1') + port = config.get('ftp_server_port','8021') + ftp.connect(host,port) + user = self.pool.get('res.users').read(cr, uid, uid, context) + ftp.login(user.get('login',''),user.get('password','')) + ftp.cwd("/" + cr.dbname+"/Documents/File/") + ftp.mkd("New") + ftp.rename('New','New Directory') + ftp.cwd("/" + cr.dbname+"/Documents/File/") + ftp.rmd('New Directory') + ftp.delete('Document') + ftp.quit() +- + In order to check directory created from FTP is working perfectly +- + Now I will test the same for Resource directory which is mapped with OpenERP object. + When you open this directory from FTP clients, it displays each records of mapped resource object as directory. +- + Now I test FTP client and Open the "Labels" Directory to check Resource Directory in FTP. + I can see that all Label of OpenERP are shown as children of "Labels" in FTP client as Directories +- + !python {model: ir.attachment}: | + from ftplib import FTP + from tools.misc import detect_ip_addr + from tools import config + ftp = FTP() + if detect_ip_addr: + host = config.get('ftp_server_host', detect_ip_addr()) + else: + host = config.get('ftp_server_host', '127.0.0.1') + port = config.get('ftp_server_port','8021') + ftp.connect(host,port) + user = self.pool.get('res.users').read(cr, uid, uid, context) + ftp.login(user.get('login',''),user.get('password','')) + ftp.cwd("/" + cr.dbname+"/Documents/Labels/") +- + I make sure that I Open Labels Directory successfully. diff --git a/addons/fetchmail/fetchmail.py b/addons/fetchmail/fetchmail.py index 611b7c178fb..3639decf3dc 100644 --- a/addons/fetchmail/fetchmail.py +++ b/addons/fetchmail/fetchmail.py @@ -137,7 +137,8 @@ class email_server(osv.osv): ('imap','IMAP Server'), ],'State', select=True, readonly=False), 'is_ssl':fields.boolean('SSL ?', required=False), - 'date': fields.date('Date'), + 'attach':fields.boolean('Add Attachments ?', required=False), + 'date': fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}), 'user' : fields.char('User Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}), 'password' : fields.char('Password', size=1024, invisible=True, required=True, readonly=True, states={'draft':[('readonly',False)]}), 'note': fields.text('Description'), @@ -292,17 +293,18 @@ class email_server(osv.osv): else: logger.notifyChannel('imap', netsvc.LOG_WARNING, 'method def message_new is not define in model %s' % (model_pool._name)) return False - -# for attactment in attachents or []: -# data_attach = { -# 'name': attactment, -# 'datas':binascii.b2a_base64(str(attachents.get(attactment))), -# 'datas_fname': attactment, -# 'description': 'Mail attachment', -# 'res_model': server.object_id.model, -# 'res_id': res_id, -# } -# self.pool.get('ir.attachment').create(cr, uid, data_attach) + + if server.attach: + for attactment in attachents or []: + data_attach = { + 'name': attactment, + 'datas':binascii.b2a_base64(str(attachents.get(attactment))), + 'datas_fname': attactment, + 'description': 'Mail attachment', + 'res_model': server.object_id.model, + 'res_id': res_id, + } + self.pool.get('ir.attachment').create(cr, uid, data_attach) if server.action_id: action_pool = self.pool.get('ir.actions.server') @@ -319,10 +321,15 @@ class email_server(osv.osv): his_id = history_pool.create(cr, uid, res) return res_id - - def __fetch_mail(self, cr, uid, ids, context={}): - sendmail_thread = threading.Thread(target=self.fetch_mail, args=(cr, uid, ids)) - sendmail_thread.start() + + def set_draft(self, cr, uid, ids, context={}): + self.write(cr, uid, ids , {'state':'draft'}) + return True + + def button_fetch_mail(self, cr, uid, ids, context={}): + self.fetch_mail(cr, uid, ids) +# sendmail_thread = threading.Thread(target=self.fetch_mail, args=(cr, uid, ids)) +# sendmail_thread.start() return True def _fetch_mails(self, cr, uid, ids=False, context={}): diff --git a/addons/fetchmail/fetchmail_view.xml b/addons/fetchmail/fetchmail_view.xml index a3a8534b559..ea08706b62d 100644 --- a/addons/fetchmail/fetchmail_view.xml +++ b/addons/fetchmail/fetchmail_view.xml @@ -26,15 +26,15 @@ - - + + @@ -58,7 +58,8 @@ -