[14.0][IMP] shopfloor_reception: Multi company capability#1133
[14.0][IMP] shopfloor_reception: Multi company capability#1133mt-software-de wants to merge 2 commits intoOCA:14.0from
Conversation
|
Hi @JuMiSanAr, @mmequignon, @guewen, @simahawk, @sebalix, |
a46e1fc to
7682920
Compare
| search = self._actions_for("search") | ||
|
|
||
| location = search.location_from_scan(location_name) | ||
| location = search.location_from_scan(location_name, company=picking.company_id) |
There was a problem hiding this comment.
What about
| 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) |
There was a problem hiding this comment.
i will change it i like your suggestion
There was a problem hiding this comment.
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
There was a problem hiding this comment.
i will change it i like your suggestion
I will give it a try tomorrow by extending shopfloor.search.action
There was a problem hiding this comment.
@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
Search locations for company of picking type. Create lots with company of picking type.
Depends on #1131
cc @i-vyshnevska @raumschmiede-joshuaL @jbaudoux