Giter VIP home page Giter VIP logo

Comments (2)

guewen avatar guewen commented on July 1, 2024

Hi @dukedylan,

If the partner has a sales person, it could make sense to assign it to its new orders.
I don't want to add an option for every single detail though. So either we consider it is sufficiently generic (here I tend to think yes), either it should be done in a customization module.

You will have to modify the user_id mapping, the partner of the sale order is in self.options.partner_id, so you could modify it this way:

@mapping
def user_id(self, record):
    """ Assign the salesperson of the partner if any """
    if self.options.partner_id.user_id:
        return {'user_id': self.options.partner_id.user_id.id}
    return {'user_id': False}

from connector-magento.

yostashiro avatar yostashiro commented on July 1, 2024

Since self.options.partner_id is just an integer, the code should be like below:

    @mapping
    def user_id(self, record):
        """ Assign the salesperson of the partner if any """
        partner_rec = self.session.browse('res.partner', self.options.partner_id)
        if partner_rec.user_id:
            return {'user_id': partner_rec.user_id.id}
        return {'user_id': False}

from connector-magento.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.