Odoo中文社区可以通过以下两个域名访问:shine-it.net , odoo.net.cn

由于系统升迁的原因,本论坛部分较早期的内容存在格式和链接损坏失效的问题,并非本论坛系统本身的缺陷,望谅解

本社区没有维护任何QQ群讨论组,任何与本社区同名的QQ群讨论组的言论与本社区无关!

开发人员可以登录gitter讨论组: http://gitter.im/odoo-china/Talk, 需要github账号

如果您登录系统碰到问题,请在微信公众号留言:

供應商資料EXCEL檔匯入



  • 請教一下,我目前做了一個測試,想要把供商EXCEL檔,直接匯入到OE內

    請問,可以這樣做嗎??

    若可以的話,要怎麼做才能將EXCEL的資料匯入OE內呢?EXCEL格式要怎麼弄?

    再麻煩各位若知道的話,將操作流程給我測試一下了,謝謝! 🙂



  • 好像是导入csv ,你先把xls保存为csv格式,然后再导入呢。



  • 我只贴导入部分的代码,希望对你有帮助。

    1. 定义一个wizard

    <br />class cash_bill_import(osv.osv_memory):<br />&nbsp; &nbsp; _name = &quot;fg_account.cash_bill.import.wizard&quot;<br />&nbsp; &nbsp; _description = &quot;导入现金账单明细&quot;<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; _columns = {<br />&nbsp; &nbsp; &nbsp; &nbsp; &#039;excel&#039;: fields.binary(&#039;excel文件&#039;, filters=&#039;*.xls&#039;),<br />&nbsp; &nbsp; }<br /><br /><br />&nbsp; &nbsp; def import_bill(self, cr, uid, ids, context=None):<br />&nbsp; &nbsp; &nbsp; &nbsp; result = {&#039;type&#039;: &#039;ir.actions.act_window_close&#039;}<br />&nbsp; &nbsp; &nbsp; &nbsp; for wiz in self.browse(cr,uid,ids):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not wiz.excel: continue<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; excel = xlrd.open_workbook(file_contents=base64.decodestring(wiz.excel))<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sh = excel.sheet_by_index(0)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for rx in range(sh.nrows):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; date_s = sh.cell(rx, 0).value<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cash_in = sh.cell(rx, 3).value<br /><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .....<br /><br />
    




Log in to reply