Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][ADD] repair_part_source_location #67

Open
wants to merge 1 commit into
base: 17.0
Choose a base branch
from

Conversation

imlopes
Copy link

@imlopes imlopes commented Nov 19, 2024

No description provided.

@imlopes imlopes force-pushed the 17.0-add-repair_part_source_location branch from 90697bf to 3fe6650 Compare November 20, 2024 14:48
@imlopes imlopes marked this pull request as ready for review November 20, 2024 14:48
@api.onchange("picking_type_id")
def _onchange_picking_type_id(self):
if self.picking_type_id:
self.parts_source_location_id = self.picking_type_id.default_location_src_id
Copy link
Contributor

Choose a reason for hiding this comment

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

Onchanges are being replaced by computed methods, whenever possible.

Could you change it to a computed field, just like the other fields in this model. E.g.:

https://github.com/odoo/odoo/blob/8762a79186352890225ade787141503f84f2c2c0/addons/repair/models/repair.py#L101-L106

https://github.com/odoo/odoo/blob/8762a79186352890225ade787141503f84f2c2c0/addons/repair/models/repair.py#L202-L210

Comment on lines +15 to +18


class StockMove(models.Model):
_inherit = "stock.move"
Copy link
Contributor

Choose a reason for hiding this comment

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

If this ends up being empty like this, better to just remove it

Suggested change
class StockMove(models.Model):
_inherit = "stock.move"

MAP_REPAIR_LINE_TYPE_TO_MOVE_LOCATIONS_FROM_REPAIR,
)

MAP_REPAIR_LINE_TYPE_TO_MOVE_LOCATIONS_FROM_REPAIR["add"] = {
Copy link
Contributor

Choose a reason for hiding this comment

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

I have weird feelings about patching this.

It seems this variable is only used in the stock.move._get_repair_locations method, and that seems easy to override.

I think it'd be much cleaner to do that instead

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

Copy link
Contributor

@ppyczko ppyczko left a comment

Choose a reason for hiding this comment

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

This module doesn't seem to work.

I changed the repair parts source location:

imagen

With available stock:

imagen

Added the parts:

imagen

But the stock moves still use the picking types default source location:

imagen

@ivantodorovich
Copy link
Contributor

It may be conflicting with repair_type: https://github.com/OCA/repair/blob/17.0/repair_type/models/stock_move.py

@imlopes can you check?

@imlopes
Copy link
Author

imlopes commented Nov 28, 2024

I agreed with you @ivantodorovich
This module is not compatible with repair_type.
I'll update this PR because it seems we can manage same thing with repair_type with a little more configurations.
My module is only useful in the case when we need to manage the source location on each repair order or at least, in a recurrent way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants