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账号

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

    求助!!Odoo新手试写新建模块

    Odoo 新手求助
    2
    3
    1585
    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.
    • B
      bjevan last edited by

      前提:我在自己新建模块的Form表单中增加了一个查看按钮,并重写了保存的方法。
      目的:当创建数据时,点击查看按钮可以为其中字段赋值。点击保存
      结果:当我点击查看按钮时,字段没有被赋值,而是激发了被重写的保存方法。当我注释掉保存方法时,查看按钮可以正常工作

      请问那位可以帮我看看,这到底是那里的问题呢?
      我的代码:

       @api.one<br />&nbsp; &nbsp; def get_flow_number(self):<br />&nbsp; &nbsp; &nbsp; &nbsp; print u&#039;获取流水号&#039;<br /> @api.model<br />&nbsp; &nbsp; def create(self,values):<br />&nbsp; &nbsp; &nbsp; &nbsp; print u&#039;保存&#039;<br /><br /><br /> &lt;header&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;button name=&quot;get_flow_number&quot; type=&quot;object&quot;&nbsp; string=&quot;获取流水号&quot;	class=&quot;oe_edit_only&quot;	/&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/header&gt;<br />
      
      1 Reply Last reply Reply Quote 0
      • Joshua
        Joshua 管理员 last edited by

        表单上的object类型按钮都会先保存当前表单信息。

        【上海先安科技】(joshua AT openerp.cn),欢迎关注公众号:openerp_cn

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