1

When Click the send by email button in sale, the default sale order attachment is loaded.

In my custom module I am try to change the default report to custom sale order report attachment

the email_template_edi_sale id is noupdate="1"

so i added 'post_init_hook': 'post_init_hook', in manifest file

in hooks.py file i added a function for change report_template

def post_init_hook(cr, registry):
    env = api.Environment(cr, SUPERUSER_ID, {})
    sale_template = env.ref('sale.email_template_edi_sale')
    sale_template.write({'report_template':custom_sale_quotation})

But The default sale order report attachment will not be changed

is it possible to use this method for changing the report template?

reference:Can we able to inherit and change the noupdate="1" in odoo?

code_explorer
  • 472
  • 6
  • 18
  • Did you check, if your function is called? `'post_init_hook': 'post_init_hook'` i don't know this method – qvpham Aug 02 '17 at 14:23
  • @ julivico : I added from .hooks import post_init_hook in __init__.py file but the function could not be called.I check in base it is used in some modules like partner_contract_gender,partner_contract_birthdate – code_explorer Aug 03 '17 at 04:37
  • Look at this link to see how to create a init script by install/update of module: [https://www.odoo.com/forum/help-1/question/how-can-i-execute-a-sql-statement-on-module-update-and-installation-6131](https://www.odoo.com/forum/help-1/question/how-can-i-execute-a-sql-statement-on-module-update-and-installation-6131) – qvpham Aug 03 '17 at 08:24
  • @ julivico: Thanks, I will check that – code_explorer Aug 03 '17 at 08:39

0 Answers0