这是我的销售订单群发代码。但我只是错过了一件事。它应该添加一个我创建的销售订单报表到每个报表中,以便为生成电子邮件。有什么建议可以让我做这个工作吗?
<data>
<act_window name="Mass Sale Order Email"
res_model="mail.compose.message"
src_model="sale.order"
view_mode="form"
multi="True"
target="new"
key2="client_action_multi"
id="action_send_mass_sale_order"
context="{
'default_composition_mode': 'mass_mail',
'default_email_to': '{($object.email or \'\')|safe}',
'mass_mark_sale_order_as_sent': True,
'default_model': 'sale.order',
}"
/>
</data>
class MailComposeMessage(models.TransientModel):
_inherit = 'mail.compose.message'
@api.multi
def send_mail(self, auto_commit=False):
context = self._context
sale_order = self.env['sale.order']
sale_order_ids = context.get('active_ids')
if context.get('mass_mark_sale_order_as_sent') and \
context.get('default_model') == 'sale.order':
for order in sale_order.browse(sale_order_ids):
order.sent = True
return super(MailComposeMessage, self).send_mail(auto_commit=auto_commit)
<report
id="report_htp_sale_order"
string="Htp Sale Order"
model="sale.order"
name="config_htp.htp_sale_order"
rml="config_htp/report/htp_sale_order.ods"
menu="True"
/>
<record model="ir.actions.report.xml" id="report_htp_sale_order">
<field name="report_type">aeroo</field>
<field name="parser_loc">config_htp/report/htp_sale_order.pyc</field>
<field name="tml_Source">file</field>
<field name="parser_state">loc</field>
<field name="out_format" ref="report_aeroo.report_mimetypes_ods_ods"/>
<field name="in_format">oo-ods</field>
<field name="auto" eval="True" />
</record>