Odoo 中文社区

    • Register
    • Login
    • Search
    • Categories
    • Tags
    • Popular
    • Users
    • Groups

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

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

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

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

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

    修改Many2One字段的链接打开方式

    Odoo 开发与实施交流
    3
    6
    5436
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      d_yang last edited by

      OE 6中, Many2One字段的只读显示方式如下:
      [attachimg=1]

      点击时, 是在本窗口打开这个对象的. 有时候非常的恼人. 很多用户不知道浏览器的前进后退, 所以还要从头找回去.

      想想, 不如改为浮动窗口的好点.

      打开浏览器的开发工具:
      [attachimg=2]

      链接都是"oe_form_uri" class. 在web模块的xml模版里, 发现这个class是 FieldURI.readonly 在使用.
      转而在web模块所带的一大堆js文件里搜索 "FieldURI". 发现一大堆的界面对象在使用这个模版.
      忽然想到, 应该有一个派生类, 名字类似于 many2one, 结果找到 view_page.js, line 171里.
      应该是打开一个新的浮动窗口, target不能是current.
      修改之
      line 171:

      <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var real_set_value = function(rval) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.value = rval;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.$element.find(&#039;a&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .unbind(&#039;click&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .text(rval ? rval[1] : &#039;&#039;)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  .click(function () {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.do_action({<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; type: &#039;ir.actions.act_window&#039;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res_model: self.field.relation,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; res_id: self.value[0],<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; context: self.build_context(),<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; views: [[false, &#039;page&#039;], [false, &#039;form&#039;]],<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; target: &#039;new&#039;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return false;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  });<br />
      



      打完收工.
      还没有验证是否影响到其他功能.

      微博 @杨振宇_  欢迎交流.

      1 Reply Last reply Reply Quote 0
      • J
        jerry79 last edited by

        楼主高人,这样的问题虽然小,但是非常影响用户体验。我在官方提了两个bug,都被官方以非block issue拒绝了,实在令人郁闷。
        请问楼主有没有遇到如下类似的问题(6.1版本):
        1、你在form上修改一个字段,改完后保存,视图直接跳到了tree页面,让你根本找不到刚才修改的是哪一个;
        2、你在form的tab上修改一个字段,改完后保存,视图跳到了另外一个tab上(通常是第一个tab),而不是停留在你刚才修改的tab。
        我觉得这两个问题也很影响用户体验啊,但是官方不接受。

        1 Reply Last reply Reply Quote 0
        • D
          d_yang last edited by

          据我的体验, 如果你点击tree view列表里最左边的编辑按钮进行编辑(打开一个form view), 保存后,你是返回到列表的, 这个时候你是不知道到底哪条修改过.
          如果你是在form view里点击编辑按钮进行编辑, 保存后你还是返回到form界面的.

          至于tab这个, 我先想想.

          1 Reply Last reply Reply Quote 0
          • J
            jerry79 last edited by

            谢谢d_yang, 第一个问题出现的几率不多,是有概率的。我先打开form,再编辑,再保存,是有可能跳到tree view的,不过我刚才又测试,又没出现,这个几率现在不好碰到。先不管了。

            1 Reply Last reply Reply Quote 0
            • mrshelly
              mrshelly last edited by

              赞.谢谢分享.. 要是给贴子加点标签 就更完美老...:)

              1 Reply Last reply Reply Quote 0
              • First post
                Last post