跳至内容
菜单
此问题已终结

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

形象
丢弃
最佳答案

(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) 

形象
丢弃
最佳答案

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.

形象
丢弃
最佳答案

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,
形象
丢弃
编写者

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

编写者

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

相关帖文 回复 查看 活动
1
9月 21
3563
1
3月 15
9553
1
1月 17
3905
1
1月 17
6587
2
3月 15
6479