问题描述
当我的res_partner表的特定字段导出时,我想要更新一个ir.config_parameter,例如,如果age被导出,我希望res_partner中的最高ID存储在我的config_parameter中,名为 last_age。年龄导出时,如何触发set_param(cr,uid,'my_module.last_age','higgest_id')?
I have an ir.config_parameter I'd like to update when a specific field of my res_partner table is exported, for exemple if "age" is exported, I want the higgest ID in res_partner to be stored in my config_parameter named "last_age". How can I trigger a set_param(cr, uid, 'my_module.last_age', 'higgest_id') when age is exported?
如果是甚至可能?
谢谢
编辑:
我在我的res.partner中这样做:
I did this in my res.partner:
def export_data(self, cr, uid, ids, fields_to_export, context=None):
super(res_partner, self).export_data(cr, uid, ids, fields_to_export, context=context)
但是在第一行,发生错误:
TypeError:export_data()获取了关键字参数'context'的多个值
But in the first line, an error occur:TypeError: export_data() got multiple values for keyword argument 'context'
如果我删除 context = None
,发生另一个错误:
TypeError:export_data()只需要5个参数(7个给定)
如果我删除 self
If I delete context=None
, an other error occur:TypeError: export_data() takes exactly 5 arguments (7 given)Same error if I remove self
在google中出现几次export_data(),我搜索了很多,但没有发现任何内容。
Really few occurence of "export_data()" appear in google, I searched a lot but found nothing.
推荐答案
每个Odoo模型将继承已经定义的方法的Model / TransienModel(旧版本osv.osv),如read,search,create ... ...
Every Odoo model will inherit Model/TransienModel (older versions osv.osv) which comes with already defined methods, like read, search, create, ...
Odoo的导出(csv。 excel)正在使用export_data()方法。只需覆盖它并在其中设置参数。
Odoo's export (csv. excel) is using the method export_data(). Just override it and set your parameter within it.
这篇关于如何触发出口Odoo的赎回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!