跳转至内容

Odoo 新手求助

No decsciption available
2.5k 主题 10.7k 帖子
  • 初学报表,不知从何处查错

    6
    0 赞同
    6 帖子
    5k 浏览
    JoshuaJ

    以你上面的代码为例:

    <br />&lt;report <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; auto=&quot;False&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id=&quot;training_lesson_report&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; model=&quot;oecn.training.lesson&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; header=&quot;False&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name=&quot;oecn.training.lesson_report&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rml=&quot;oecn_training/report/oecn_training_lesson.rml&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; string=&quot;课程报告&nbsp; Lesson report&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; /&gt;<br />


    这一段是在 [检测到链接无效,已移除] 里添加一条记录,你可以通过进入 设定->自定义->底层对象->报表 可以查看到自己的报表

    <br />report_sxw.report_sxw(&#039;report.oecn.training.lesson_report&#039;, &#039;oecn.training.lesson&#039;, &#039;addons/oecn_training_lesson/report/oecn_training_lesson_report.rml&#039;,<br />parser=training_lesson_report)<br />


    这一段是实例化了report_sxw,实际上是通过这个实例来打印报表的。

    而你问的问题我们可以通过到report\report_sxw.py 代码里看看。

    <br />&nbsp; &nbsp; &nbsp; &nbsp; ir_obj = pool.get(&#039;ir.actions.report.xml&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; report_xml_ids = ir_obj.search(cr, uid,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [(&#039;report_name&#039;, &#039;=&#039;, self.name[7:])], context=context)<br />&nbsp; &nbsp; &nbsp; &nbsp; if report_xml_ids:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; report_xml = ir_obj.browse(cr, uid, report_xml_ids[0], context=context)<br />&nbsp; &nbsp; &nbsp; &nbsp; else:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title = &#039;&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; report_file = tools.file_open(self.tmpl, subdir=None)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; try:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rml = report_file.read()<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; report_type= data.get(&#039;report_type&#039;, &#039;pdf&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; class a(object):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; def __init__(self, *args, **argv):<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; for key,arg in argv.items():<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setattr(self, key, arg)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; report_xml = a(title=title, report_type=report_type, report_rml_content=rml, name=title, attachment=False, header=self.header)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; finally:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; report_file.close()<br />


    这里的主要意思是他首先会根据名字report_name搜索 [检测到链接无效,已移除] ,如果有匹配的就取它的记录,如果没有就用上面实例化的那个实例。
    所以就是如果你向ir.actions.report.xml插入了报表数据 ,那么他就优先取它的数据而不是你在python里报表实例,这样的好处是你可以在openerp里面对报表直接进行修改(表头之类的),而不用修改代码。
    欢迎测试

  • 无法看到业务流程图

    4
    0 赞同
    4 帖子
    2k 浏览
    JoshuaJ

    嗯,很好,我再科普一下OpenERP的企业版与社区版
    http://www.openerp-china.org/index.php?page=FAQ&redirect=no

  • 有关openerp报表打印时使用chrome浏览器出现直接下载pdf文档问题

    4
    0 赞同
    4 帖子
    5k 浏览
    Y

    [quote author=软件钳工 link=topic=2755.msg9278#msg9278 date=1328676110]
    我在使用openerp报表打印功能是点击打印报表,在ie中可以直接显示出pdf文档,在chrome中打印报表时直接弹出下载对话框,我的预期是希望能在chrome中直接显示pdf文档,查阅代码之后找到
    /usr/local/lib/python2.7/dist-packages/openerp_web-6.0.3-py2.7.egg/addons/openerp/controllers/root.py:LINE 67
    @expose(content_type='application/octet-stream')
    修改成@expose(content_type='application/pdf')
    实现了直接在chrome浏览器中直接开启PDF的功能,具体代码并不理解,其他代码中有看到设置 ./addons/openerp/controller/actions.py 中对 content_type 有设置。pdf对应content_type:appliaction/pdf
    我们在设置的时候有设定报表的类型pdf
    如果不修改代码,执行的结果送到浏览器的http头部content_type始终是 application/octet-steam ,对于IE的处理方式会打开新页面直接显示pdf报表,而chrome是跳出下载对话框(我的预期是用chrome直接显示pdf报表,直接打印),不知道论坛里有解决这类问题的其他更优雅方法没有?
    [/quote]


    在firefox里也有同样的问题。打开.pdf是直接在浏览器内显示,但OE的打印是要下载后才显示的。不知有没有什么好的解决方案。

  • 安装后,在浏览器中:127.0.0.1:8069 打不开主页

    3
    0 赞同
    3 帖子
    5k 浏览
    JoshuaJ

    可以先看看这里<br / [检测到链接无效,已移除] br />

  • 新手求助,在安装openerp后运行localhost出现下列截图所示错误,,

    5
    0 赞同
    5 帖子
    3k 浏览
    C

    错误信息 很明确,在最后一行。

    就是2楼 说的情况

  • 大家一起完善中文顾问社区wiki(oecn_help 模块介绍)

    9
    0 赞同
    9 帖子
    7k 浏览
    JoshuaJ

    更新了:
    ir.actions.actions
    ir.actions.report.xml
    purchase.order
    purchase.order.line
    sale.order
    sale.order.line
    res.partner
    res.country
    res.partner.address
    sale.shop
    stock.warehouse.orderpoint
    product.product
    product.uom
    product.product
    product.category
    请看顶楼

  • 报表设计:sxw中的removeParentNode('para')是什么意思?

    4
    0 赞同
    4 帖子
    6k 浏览
    JoshuaJ

    一般这样使用<para> 条件 or removeParentNode('para')</para> 就是如果条件不成立就删除 <para></para>

  • OpenERP功能概要

    2
    0 赞同
    2 帖子
    4k 浏览
    尚无回复
  • 0 赞同
    6 帖子
    7k 浏览
    X

    [quote author=mrshelly link=topic=4190.msg11309#msg11309 date=1338991829]
    不错.... 能给贴子加上标签(Tag) 就更棒了哇. ....
    [/quote]

    😄 已添加

  • 实用工具-OpenERP基础篇-新手入门-数据导入-产品图片

    4
    0 赞同
    4 帖子
    7k 浏览
    mrshellyM

    嗯. 不错.... 推荐使用 xmlrpc 进行数据处理... 不推荐直接连数据库处理...

  • 0 赞同
    11 帖子
    8k 浏览
    X

    [quote author=mrshelly link=topic=2743.msg11297#msg11297 date=1338973067]
    嗯. 还是不推荐在数据库上面玩这些....  理论上, 应该可以二次开发, 修改  pos.order 的 create write 方法来实现...
    [/quote]

    确实是这样, 主要当时为了解决这个问题,而又不想去改动代码, 感觉通过数据触发器实现就能解决.

    所以官方不费吹灰之力,版本升级后就解决了.

    现在是用不到了,这里只做个记录.

  • Bzr 如何使用 proxy

    3
    0 赞同
    3 帖子
    3k 浏览
    JoshuaJ

    下载完第一次之后,就好了,每次更新不用很多。

  • 請教自定義Function放置的問題

    4
    0 赞同
    4 帖子
    2k 浏览
    wjfonhandW

    利用OpenERP介面產生
    那还有机会写python代码。只剩server action了,不过server action可实现不了onchange

  • 尽量简化菜单

    5
    0 赞同
    5 帖子
    3k 浏览
    Q

    Thanks, heaps !

  • 为什么本地可以打开openerp,局域网内的其他人打不开?紧急求助...

    11
    0 赞同
    11 帖子
    11k 浏览
    mrshellyM

    [quote author=stmakers link=topic=2786.msg11220#msg11220 date=1338534899]
    请教楼主,我装在win7上 ,版本v6-1-1,同样出现局域网无法访问,是否指导一下!
    [/quote]

    分明上面就讲了 "把防火墙关了" 的方案, 多向防火墙方面入手检查就行了...没有必要重复发问吧?

  • 0 赞同
    6 帖子
    4k 浏览
    JoshuaJ

    [quote author=ekcchina link=topic=4174.msg11218#msg11218 date=1338467680]
    希望版主 能出一些权限方面的教程 做一个简单的操作,让我们这些新手学习!
    [/quote]
    Shelly已经给出方法啦
    当然我们也有中文的http://www.openerp-china.org/index.php?page=ir.rule 楼主你配合addons里面的测试数据,研究下应该就明白了

  • 更换语言后,登入时出错,无法登入,提示错误

    2
    0 赞同
    2 帖子
    2k 浏览
    尚无回复
  • 0 赞同
    8 帖子
    4k 浏览
    K

    Joshua大 您好
    我的xml中訂義如下

    &lt;act_window<br />&nbsp; &nbsp; &nbsp; id=&quot;cr_prescription_act_view&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name=&quot;Create Prescription&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view_mode=&quot;form&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view_type=&quot;form&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; res_model=&quot;create.prescription&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_model=&quot;res.partner&quot;<br />&nbsp; /&gt;


    我反覆嘗試
    如果加上target="new"就不會出現Save,Save & Edit,Cancel 等三個按鈕,但是這是彈跳出一個新視窗,這不是我想要的--我想出現在右側主畫面
    如果沒加target="new"就會出現Save,Save & Edit,Cancel 等三個按鈕

    懇請指導

    附件為我整個wizard


    [quote author=Joshua link=topic=4171.msg11205#msg11205 date=1338254820]
    不知道你的wizard的view是怎么定义的,下面是价格表的wizard的代码,你可以比较下

    &lt;act_window id=&quot;action_product_price_list&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; key2=&quot;client_print_multi&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; name=&quot;Price List&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res_model=&quot;product.price_list&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; src_model=&quot;product.product&quot;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view_mode=&quot;form&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; target=&quot;new&quot; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; view_type=&quot;form&quot; /&gt;


    key2这个可以无视,这个只是因为他这里是想显示为打印按钮。
    [/quote]

  • 0 赞同
    8 帖子
    4k 浏览
    K

    mrshelly大
    經過您的提點,小弟再仔細比較-原來是function必須放置於_default之前
    (因為以前寫Java Class就沒有這種順序性的要求,所以一時沒想到會有影響)
    真是不好意思勞煩您再三提醒  感恩

    另外一個提問--Save,Save & Edit,Cancel 等三個按鈕不顯現的問題
    是否是在XML中訂義
    <act_windows
    view_type : "form"
    />
    小弟本來就有寫 但是無作用

    [quote author=mrshelly link=topic=4170.msg11196#msg11196 date=1338194528]
    请仔细看我的代码与你的代码.
    前前后后, 你都没有说明你的"出"的什么"错"!...
    [/quote]

  • OE 的送信機制.錯誤 log 如何偵錯啊.

    5
    0 赞同
    5 帖子
    4k 浏览
    JoshuaJ

    换其他邮箱试试,或者跟踪代码到smtplib.py 里面