你可以通过修改AbstractModel来实现
例如:
<report
id="agedpartnerbalance_template"
string="Aged Partner Template"
model="account.move"
report_type="qweb-pdf"
file="account.report_agedpartnerbalance"
name="account.report_agedpartnerbalance"
/>
class ReportAgedPartnerBalance(models.AbstractModel):
_name = 'report.account.report_agedpartnerbalance'
@api.model
def render_html(self, docids, data=None):
*****
Your Logic
docs = self.env[model].browse(self.env.context.get('active_id'))
for doc in docs:
doc.state = 'sent'
*****
docargs = {
'doc_ids': self.ids,
'doc_model': model,
'data': data['form'],
'docs': docs,
'time': time,
'get_partner_lines': movelines,
'get_direction': total,
}
return self.env['report'].render('account.report_agedpartnerbalance', docargs)