Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
1480 Vizualizări

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

Imagine profil
Abandonează
Cel mai bun răspuns

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

Imagine profil
Abandonează
Cel mai bun răspuns

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


Imagine profil
Abandonează
Cel mai bun răspuns

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


Imagine profil
Abandonează