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

[16.0][FIX] product_supplierinfo_stock_picking_type: rename on change picking type method #1777

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

Conversation

AlexPForgeFlow
Copy link

@AlexPForgeFlow AlexPForgeFlow commented Nov 21, 2024

If module mrp_subcontracting_dropshipping, form Odoo, is installed in our system, there are conflicts between onchange methods, mrp_subcontracting_dropshipping method https://github.com/odoo/odoo/blob/16.0/addons/mrp_subcontracting_dropshipping/models/purchase.py#L23 is overriding the onchange method previously defined in this module. So I suggest renaming the onchange method.

@OCA-git-bot
Copy link
Contributor

Hi @victoralmau,
some modules you are maintaining are being modified, check this out!

@AlexPForgeFlow AlexPForgeFlow changed the title [16.0][FIX] product_supplierinfo_stock_picking_type: rename on chane picking type method [16.0][FIX] product_supplierinfo_stock_picking_type: rename on change picking type method Nov 21, 2024
@AlexPForgeFlow AlexPForgeFlow force-pushed the 16.0-fix-product_supplierinfo_stock_picking_type branch from 5c9f2eb to 7e35f92 Compare November 21, 2024 10:14
Copy link
Contributor

@GuillemCForgeFlow GuillemCForgeFlow left a comment

Choose a reason for hiding this comment

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

makes sense 👍🏿

@AlexPForgeFlow AlexPForgeFlow force-pushed the 16.0-fix-product_supplierinfo_stock_picking_type branch from 7e35f92 to 476055a Compare November 21, 2024 10:32
def onchange_picking_type_id(self):
def onchange_picking_type_id_onchange_product(self):
# Method name is to avoid conflicts with mrp_subcontracting_dropshipping
# that have an onchange method named onchange_picking_type_id
Copy link
Member

Choose a reason for hiding this comment

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

I think you can keep the same method but call the super if the method exists.

if hasattr(super(), "onchange_picking_type_id"):
    getattr(super(), "onchange_picking_type_id)

Copy link
Author

Choose a reason for hiding this comment

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

Hi @victoralmau !
No, as I already mentioned, the Odoo function is overriding the method, so in the module hierarchy, product_supplierinfo_stock_picking_type comes before mrp_subcontracting_dropshipping. For this reason, the method is being overridden. To implement your solution, we would need to add it to Odoo's method.

@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). 🤖

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

Successfully merging this pull request may close these issues.

8 participants