7.0 [IMP] product: improve store for field name_template

Add store to field name_template to avoid unecessary browse and write.
Done by back-porting 2 commits from 8.0 and improving the store declaration to restrict the trigger for product on the field product_tmpl_id

(PR on odoo https://github.com/odoo/odoo/pull/3277)
Could you consider rewriting these 3 lines as

    result = list(set(template_ids))

and removing line 536. This should be slightly more efficient (looping over the list being done in C rather than in Python).