关于odoo中的_onchange_spec()方法的一些文档
在《Odoo开发食谱》一书的第6章中,作者介绍了_onchange_spec()方法,并将其介绍如下: 此方法将检索由其他字段的修改触发的更新。它通过检查模型的表单视图来实现这一点(记住,onchange方法通常由web客户端调用)。关于odoo中的_onchange_spec()方法的一些文档,odoo,Odoo,在《Odoo开发食谱》一书的第6章中,作者介绍了_onchange_spec()方法,并将其介绍如下: 此方法将检索由其他字段的修改触发的更新。它通过检查模型的表单视图来实现这一点(记住,onchange方法通常由web客户端调用)。 我需要更多详细信息欢迎来到stackoverflow社区 onchange\u spec()方法的主要目标是从服务器端调用onchange方法 在您提到的书的示例中,解释为: 您可以自己进行所需的计算,但并不总是这样 可能,因为onchange方法可以由 实例上安
我需要更多详细信息欢迎来到stackoverflow社区 onchange\u spec()方法的主要目标是从服务器端调用onchange方法 在您提到的书的示例中,解释为: 您可以自己进行所需的计算,但并不总是这样 可能,因为onchange方法可以由 实例上安装的第三方加载项模块 知道 调用时: 没有争论。此方法将检索由修改哪个其他字段触发的更新。它通过检查模型的表单视图来实现这一点 如何使用它: 当您想要手动运行onchange方法并在创建或更新注册表之前计算某些内容时,必须使用它 示例
@api.multi
def return_all_books(self):
self.ensure_one
wizard = self.env['library.returns.wizard']
#this is the manual change (update the member)
values = {'member_id': self.id}
#this examines the form to find the changes
specs = wizard._onchange_spec()
#This gets the values of the onchange
updates = wizard.onchange(values, ['member_id'], specs)
#Combine the results with the new manually added value
values.update(updates.get('value', {}))
record = wizard.create(values)
对于另一个实现,您可以在下面查看
欢迎来到stackoverflow社区 onchange\u spec()方法的主要目标是从服务器端调用onchange方法 在您提到的书的示例中,解释为: 您可以自己进行所需的计算,但并不总是这样 可能,因为onchange方法可以由 实例上安装的第三方加载项模块 知道 调用时: 没有争论。此方法将检索由修改哪个其他字段触发的更新。它通过检查模型的表单视图来实现这一点 如何使用它: 当您想要手动运行onchange方法并在创建或更新注册表之前计算某些内容时,必须使用它 示例
@api.multi
def return_all_books(self):
self.ensure_one
wizard = self.env['library.returns.wizard']
#this is the manual change (update the member)
values = {'member_id': self.id}
#this examines the form to find the changes
specs = wizard._onchange_spec()
#This gets the values of the onchange
updates = wizard.onchange(values, ['member_id'], specs)
#Combine the results with the new manually added value
values.update(updates.get('value', {}))
record = wizard.create(values)
对于另一个实现,您可以在下面查看