I set up a default parameter to load, when i email a quotation. I see it added in my users default parameters, but it still picks nr 5 (portal template) as the default, instead of id:=4.
Any idea on how i can solve this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I set up a default parameter to load, when i email a quotation. I see it added in my users default parameters, but it still picks nr 5 (portal template) as the default, instead of id:=4.
Any idea on how i can solve this?
Here is a working and cleaner solution, I think.
Check out addons/portal_sale/portal_sale.py and search the function action_invoice_sent in the account_invoice class.
If the module portal_sale is installed, this function makes sure the portal version of the email.template for invoices is set dy default.
I just copy pasted this function/class in my module and changed the reference call to point towards my own version.
Hope that helps soemone.
this is a more logical solution, but didn't work for me. The invoice template introduced by the portal_sale module remains the default selected. I even specified a "sequence: 90" directive in the manifest, to make sure that my custom module got loaded after the portal_sale, but nothing changed.
Here is our solution to change the default mail template when we click on « send by email » in the sale order form.
import pdb
from openerp.osv import osv
import openerp.pooler
class sale_order(osv.osv):
_inherit = 'sale.order'
def action_quotation_send_pt(self, cr, uid, ids, context=None):
assert len(ids) == 1, 'This option should only be used for a single id at a time.'
irmodeldataaa = self.pool.get('ir.model.data')
try:
template_id = irmodeldataaa.get_object_reference(cr, uid, 'sale', 'email_template_edi_sale')[1]
except ValueError:
template_id = False
try:
compose_form_id = irmodeldataaa.get_object_reference(cr, uid, 'mail', 'email_compose_message_wizard_form')[1]
except ValueError:
compose_form_id = False ctx = dict()
ctx.update({
'default_model': 'sale.order',
'default_res_id': ids[0],
'default_use_template': bool(template_id),
'default_template_id': template_id,
'default_composition_mode': 'comment',
'mark_so_as_sent': True
})
return {
'type': 'ir.actions.act_window',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'mail.compose.message',
'views': [(compose_form_id, 'form')],
'view_id': compose_form_id,
'target': 'new',
'context': ctx,
}
We are happy!
this solved for me
I didn't have the external identifier. I just created as explained above and it solved my problem
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
1
thg 2 24
|
2749 | ||
Unable to Delete Company Parameter
Đã xử lý
|
|
1
thg 5 24
|
2393 | |
|
2
thg 1 23
|
2427 | ||
|
1
thg 8 22
|
5339 | ||
|
1
thg 1 19
|
3883 |
users default parameters? Where do you find it?
ok! I fave found users default parameters in Settings->Actions->User-Defined defaults Thanks