如何覆盖按钮的打印功能 'print'
How can' i override the print function of the button 'print'
我正在使用 odoo 9,我想修改发票中打印按钮的功能。所以我创建了一个自定义模块来覆盖功能 invoice_print 以满足我的条件,但我注意到只有工作流栏中的按钮打印已更改,按钮操作旁边的另一个按钮打印不应用修改。我花了很多时间来搜索这个按钮的功能,但我不知道这个按钮的功能在哪里,请帮忙??
这里是我修改过的函数:
@api.multi
def invoice_print(self):
if (self.partner_id.CodeTVA == False) or (self.partner_id.street == False):
raise UserError(
_("vous ne pouvez pas lancer l impression. Veuillez remplir le code TVA et/ou l'adresse du partenaire" ))
elif (self.partner_id.CodeTVA == True) and (self.partner_id.street == True):
self.ensure_one()
self.sent = True
# return self.env['report'].get_action(self, 'account.report_invoice')
return self.env['report'].get_action(self, 'bi_professional_reports_templates.report_invoice')
使用管理员凭据登录,激活开发者模式,转到 Technical settings -> Reports (Under actions section)
,搜索要自定义的打印菜单,打开记录,查看元数据,获取 xml ID 并查找该 ID在源代码中。如果您想自定义该报告,请继承报告记录或操作并进行自定义。
我正在使用 odoo 9,我想修改发票中打印按钮的功能。所以我创建了一个自定义模块来覆盖功能 invoice_print 以满足我的条件,但我注意到只有工作流栏中的按钮打印已更改,按钮操作旁边的另一个按钮打印不应用修改。我花了很多时间来搜索这个按钮的功能,但我不知道这个按钮的功能在哪里,请帮忙??
这里是我修改过的函数:
@api.multi
def invoice_print(self):
if (self.partner_id.CodeTVA == False) or (self.partner_id.street == False):
raise UserError(
_("vous ne pouvez pas lancer l impression. Veuillez remplir le code TVA et/ou l'adresse du partenaire" ))
elif (self.partner_id.CodeTVA == True) and (self.partner_id.street == True):
self.ensure_one()
self.sent = True
# return self.env['report'].get_action(self, 'account.report_invoice')
return self.env['report'].get_action(self, 'bi_professional_reports_templates.report_invoice')
使用管理员凭据登录,激活开发者模式,转到 Technical settings -> Reports (Under actions section)
,搜索要自定义的打印菜单,打开记录,查看元数据,获取 xml ID 并查找该 ID在源代码中。如果您想自定义该报告,请继承报告记录或操作并进行自定义。