コンテンツへスキップ
メニュー
この質問にフラグが付けられました
3 返信
1526 ビュー

 I need the salesperson to always be the same when creating a new sales order.

アバター
破棄
最善の回答

Hi,
* Enable debug mode
* Select the sales person in the field
* Click Debugger button
* Click Set Defaults
* In Pop up, select sales person = value in the field
* Save

See:   How To Set Default Value For A Field in Odoo

Now the selected sales person will be defaulted always.

Thanks

アバター
破棄
最善の回答

Activate Developer Mode> Edit Sales Order Form> Enable Debugging> Customization> Locate Sales Order Model> Set Default Value > Save Changes.


アバター
破棄
最善の回答

Hello Maicon,

You can use following code to set default salesperson

from odoo import models, fields


class ResPartner(models.Model):

    _inherit = 'res.partner'


    def default_get(self, fields):

        res = super(ResPartner, self).default_get(fields)

        if 'user_id' in fields:

            res['user_id'] = your_default_salesperson_id  # Replace with appropriate ID

        return res


I hope this code will help you

Thanks & Regards,

Ankit Vaghela


アバター
破棄