Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

[14.0][IMP] shopfloor_reception: Multi company capability#1133

Open
mt-software-de wants to merge 2 commits intoOCA:14.0from
mt-software-de:14-reception-company
Open

[14.0][IMP] shopfloor_reception: Multi company capability#1133
mt-software-de wants to merge 2 commits intoOCA:14.0from
mt-software-de:14-reception-company

Conversation

@mt-software-de
Copy link

@mt-software-de mt-software-de commented Feb 17, 2026

Search locations for company of picking type. Create lots with company of picking type.

Depends on #1131

cc @i-vyshnevska @raumschmiede-joshuaL @jbaudoux

@OCA-git-bot
Copy link
Contributor

Hi @JuMiSanAr, @mmequignon, @guewen, @simahawk, @sebalix,
some modules you are maintaining are being modified, check this out!

Comment on lines 1350 to +1352
search = self._actions_for("search")

location = search.location_from_scan(location_name)
location = search.location_from_scan(location_name, company=picking.company_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about

Suggested change
search = self._actions_for("search")
location = search.location_from_scan(location_name)
location = search.location_from_scan(location_name, company=picking.company_id)
search = self._actions_for("search").with_company(picking.company_id)
location = search.location_from_scan(location_name)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will change it i like your suggestion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with_company cannot be called on a work component.

@simahawk How would you solve to provide the right company to the env of the component as it affects several search methods in shopfloor

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will change it i like your suggestion

I will give it a try tomorrow by extending shopfloor.search.action

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mt-software-de You could modify shopfloor base service with something like this to define with_company

    @property
    def company(self):
        if self._company is None:
            return self.env.company
        return self._company

    @contextmanager
    def with_company(self, company):
        try:
            self._company = company
            yield
        finally:
            self._company = None


    def _actions_for(self, usage, **kw):
        return get_actions_for(self, usage, company=self.company, **kw)

You would need to initialize in an init method _company = None in that base service

In the action, you could then retrieve the company with self.work.company instead of using self.env.company

@jbaudoux
Copy link
Contributor

cc @nicolas-delbovier-acsone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants