我有来自OCA的odoo报告,我正在努力适应,以便能够作为电子邮件发送给个人客户。报告见Report and Github link
以下是重要部分(我认为)。在此函数中,“数据”从向导传递。
@api.multi
def render_html(self, docids, data):
company_id = data['company_id']
partner_ids = data['partner_ids']
date_start = data['date_start']
date_end = data['date_end']
today = fields.Date.today()
balance_start_to_display, buckets_to_display = {}, {}
lines_to_display, amount_due = {}, {}
currency_to_display = {}
today_display, date_start_display, date_end_display = {}, {}, {}
balance_start = self._get_account_initial_balance(
company_id, partner_ids, date_start)
当我尝试将报告添加到电子邮件模板作为附件时,我不知道如何将参数传递给它。所以我做了以下事情:
如果数据为无......
data={
'date_start': str(date.today()-timedelta(days=120)),
'date_end': str(date.today()),
'company_id': self.env.user.company_id.id,
'partner_ids': self._context['active_ids'],
'show_aging_buckets': True,
'filter_non_due_partners': True,
}`
问题是''partner_ids':self._context ['active_ids'],' 将电子邮件中的每个客户声明返回给每个客户。我如何才能做到这一点只适用于当前客户?
提前感谢您的任何帮助。