İçereği Atla
Menü
Bu soru işaretlendi
5 Cevaplar
10937 Görünümler

I would like when opening the partner view to have the opt_out checkbox always checked. How can I do that?

Avatar
Vazgeç
En İyi Yanıt

(Credit goes to Med Said BARA)

Hi...

For that you need to change here: For V8

module : email_template

file : res_partner.py 

 _defaults = {
    'opt_out': True,
}

For V9:

module: mail

file: res_partner

opt_out = fields.Boolean(
'Opt-Out', default=True, help="If opt-out is checked, this contact has refused to receive emails for mass mailing and marketing campaign. "
"Filter 'Available for Mass Mailing' allows users to filter the partners when performing mass mailing.")


Then restart your server, update module(email_temaplte(v8), mail(v9)).

Just refresh your page, click on create of partner form and see the magic in opt_out.

(It will be good if you do that all thing by inheriting respected model) 

Avatar
Vazgeç
En İyi Yanıt

I've found a way to do it. Here is the description:

Activate the "Technical features" from Settings -> Users -> Users -> USERNAME -> Access Rights (tab in the form) and check the "Technical features" checkbox and refresh with F5.

After this go to Settings -> Technical -> Actions -> User-defined Defaults. Then click on "Create" and fill in the fields as follows:

Name = opt_out (field name)

Model Name - leave it empty, because the next field will auto fill it

Model = res.partner (you can set also crm.lead if you use CRM module)

Condition - leave empty, because you want in any condition to have the opt_out field checked

User - leave empty if you want to activate this action for every user

Textarea (under Model field) = 1.

Finally, save the action and create a new partner. The field opt_out should be checked by default now.

I have used the same procedure to check this field by default for crm.lead and res.partner models. It works fine.

Avatar
Vazgeç
En İyi Yanıt

Hi;

Edit the file .../openerp/addons/crm/crm_lead.py around the line 317 add 'opt_out': 1,

Like:

_defaults = {

   'opt_out': 1,    <------------------- add this line

    'active': 1,

    'type': 'lead',

    'user_id': lambda s, cr, uid, c: s._get_default_user(cr, uid, c),

    'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c),

    'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),

    'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c),

    'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.lead', context=c),

    'priority': lambda *a: crm.AVAILABLE_PRIORITIES[2][0],

    'color': 0,

}

_sql_constraints = [

Update the module crm.

Sory, change it here: openerp/addons/email_template/res_partner.py

Change False to True

_defaults = {

    'opt_out': False,

try with:

_defaults = {

    'opt_out':  lambda *a: True,
Avatar
Vazgeç
Üretici

Well, this does not work. I've also changed the 'active' value to 0, restarted the server updating all modules, and nothing changed.

Üretici

Already tried the 'False to True' change in openerp/addons/email_template/res_partner.py. This has no effect....

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Eyl 21
3570
1
Mar 15
9562
1
Oca 17
3908
1
Oca 17
6594
2
Mar 15
6484