gpt4 book ai didi

javascript - Odoo - 自动关闭向导并刷新父级

转载 作者:行者123 更新时间:2023-11-29 21:02:56 27 4
gpt4 key购买 nike

我为模块中的类创建了一个普通 View 。现在我想通过单击按钮在另一个类中显示相同的 View 。我已经这样做了,但我面临的问题是,当弹出窗口打开时,它会提供两个按钮 SaveDiscard。单击保存后,我应该自动关闭,它还应该刷新加载它的父 View 。这在 Odoo 中可行吗?

除此之外,我如何在 Odoo 中创建一个 javascript 文件。我访问了官方文档,但我无法理解我们是否有针对每个类或每个模块的 javascript 文件以及如何创建它以及我可以在该 javscript 文件中做什么。基本上我要求一个很好的文档以便更好地理解。

编辑:这是我的按钮点击功能

@api.multi
def add_deposit_action(self):
return {
"type": "ir.actions.act_window",
"name": 'Add A Deposit',
"res_model": "amgl.order",
"views": [[False, "form"]],
"context": {'customer_id': self.id,
'account_number': self.account_number,
'date_opened': self.date_opened,
'account_type': self.account_type},
'target': 'new',
'is_deposit': True
}

最佳答案

I visited official documentation but i was unable to understand that do we have a javascript file against each class or against each module and how to create that and what are the things i can do in that javscript file. Basically i am asking for a well documentation for better understanding.

Odoo 的官方文档在这里:https://www.odoo.com/documentation/master/ .了解 Odoo 并了解如何使用界面非常好。但是可能很难在那里找到您的技术问题的答案。

另一种更好的方法是在此处的论坛中创建您的问题:https://www.odoo.com/de_DE/forum/hilfe-1

对我来说,我从这本书中学到了很多东西:Odoo 开发指南。如果您想使用 Odoo 进行更多开发,可以尝试看看这本书。


I have done that but the issue i am facing is that when that popup open it gives two buttons Save and Discard. Once i click save i should auto close and it should also refresh the parent view from which it was loaded. Is this possible in Odoo?

是的,这是可能的。重新加载父 View (原始 View ),需要返回标签reload在由按钮调用的函数中 Save在您的弹出窗口中。

例如:

def function():
# do something here
return {
'type': 'ir.actions.client',
'tag': 'reload',
}

关于javascript - Odoo - 自动关闭向导并刷新父级,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45576313/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com