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

[14.0][ADD] mrp_subcontracting_purchase #1082

Merged

Conversation

Volodiay622
Copy link

No description provided.

@Volodiay622 Volodiay622 marked this pull request as draft August 28, 2023 04:42
@francesco-ooops
Copy link
Contributor

@pedrobaeza could you please provide us instructions on how to correctly bring to merge this PR?

eg. regarding authorship and commits, as this is the backporting to v14 of odoo module https://github.com/odoo/odoo/tree/15.0/addons/mrp_subcontracting_purchase

Thanks!

@pedrobaeza
Copy link
Member

First, you should add a commit attributed to "Odoo SA odoo@odoo.com" with the contents as they are in the new version, and then add your commits with the changes needed to work on this version.

Then, check https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#10backporting-odoo-modules

@Volodiay622 Volodiay622 force-pushed the 14.0-t2784-mrp_subcontracting_purchase-add_module branch 2 times, most recently from cc876fc to f0fd491 Compare September 7, 2023 20:01
@Aldeigja
Copy link

First, you should add a commit attributed to "Odoo SA odoo@odoo.com" with the contents as they are in the new version, and then add your commits with the changes needed to work on this version.

Then, check https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#10backporting-odoo-modules

@pedrobaeza To make mrp_subcontracting_purchase work as per v15, we also had to port code from v15 of Odoo modules:

mrp_subcontracting_purchase,
mrp_subcontracting_dropshipping,
purchase_mrp,
purchase_stock

how do you suggest to proceed for code from those modules?

@pedrobaeza
Copy link
Member

You have to include the needed changes in your module, trying to be the most compatible possible. I needed to do similar things when I backported mrp_subcontracting. Some examples:

f32ce8b#diff-96c2f57c6a07eb25b5e8b5cbc49574423aa16aa8fbb1c50672de67d9a25aca56R150
f32ce8b#diff-96c2f57c6a07eb25b5e8b5cbc49574423aa16aa8fbb1c50672de67d9a25aca56L204
f32ce8b#diff-024c81702831beef5a3aaf69d8fb0342d470277883158ee96b248722f102a33bR20

Copy link

@geomer198 geomer198 left a comment

Choose a reason for hiding this comment

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

Please check my comments and upper your tests coverage.

def _prepare_purchase_order(self, company_id, origins, values):
"""Returns prepared data for create PO"""
if (
"partner_id" not in values[0]

Choose a reason for hiding this comment

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

value may be empty? If value will be empty than you need check this before this condition.

Copy link
Author

Choose a reason for hiding this comment

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

value is checking here

if po.origin:
missing_origins = origins - set(po.origin.split(", "))
if missing_origins:
po.write({"origin": po.origin + ", " + ", ".join(missing_origins)})

Choose a reason for hiding this comment

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

Could you use format function for preparing string value?

Copy link
Author

Choose a reason for hiding this comment

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

resolved

def _pre_button_mark_done(self):
if self._get_subcontract_move():
return True
return super()._pre_button_mark_done()

Choose a reason for hiding this comment

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

You can do like this (optional):

return True if self._get_subcontract_move() else super()._pre_button_mark_done()

Copy link
Author

Choose a reason for hiding this comment

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

applied, thanks

# which checks whether the subcontracting has been recorded or not

def filter_in(mo):
if (

Choose a reason for hiding this comment

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

You can inverse this big condition and write return without if:

return  not (mo.state in ("done", "cancel") .......)`

Please create a separate order for these."""
)
+ "\n\n"
+ "\n".join(not_in_bom_products.mapped("name"))

Choose a reason for hiding this comment

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

It's not good idea, you must use format like this for one variable _("....... \n\n%s", value).

def _compute_show_subcontracting_details_visible(self):
"""Compute if the action button in order to see moves raw is visible"""
self.show_subcontracting_details_visible = False
for move in self:

Choose a reason for hiding this comment

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

I think need add the filter for self

for move in self.filtered("is_subcontract"):
    ....

show details button is visible.
"""
res = super(StockMove, self)._compute_show_details_visible()
for move in self:

Choose a reason for hiding this comment

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

Here too

@geomer198 geomer198 force-pushed the 14.0-t2784-mrp_subcontracting_purchase-add_module branch 3 times, most recently from 5c50253 to 8dc1fe4 Compare October 9, 2023 18:23
Copy link
Contributor

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

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

Functional ok!

We should be good here, full test coverage and documentation

@pedrobaeza can we ask for your feedback? Thanks!

@francesco-ooops
Copy link
Contributor

@david-fleischmann would this help your flow?

@pedrobaeza pedrobaeza added this to the 14.0 milestone Oct 10, 2023
@pedrobaeza
Copy link
Member

I'm not seeing an initial commit authored by Odoo SA with the content as is on the next version, and then, all your modifications to make it work in v14.

Add a new module to add smart buttons between a subcontracting purchase
order and the ressuply component delivery.

task-2486811

Part-of: odoo/odoo#75041
@geomer198 geomer198 force-pushed the 14.0-t2784-mrp_subcontracting_purchase-add_module branch from 8dc1fe4 to 51c7c06 Compare October 13, 2023 10:14
@geomer198 geomer198 force-pushed the 14.0-t2784-mrp_subcontracting_purchase-add_module branch from 51c7c06 to 0765765 Compare October 13, 2023 10:16
@geomer198
Copy link

@pedrobaeza Could you check repository structure please?
Now is correct?

@@ -0,0 +1,2 @@
This module is a backport from Odoo SA and as such, it is not included in the OCA CLA.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This module is a backport from Odoo SA and as such, it is not included in the OCA CLA.
This bridge module adds some smart buttons between Purchase and Subcontracting
**DISCLAIMER:** This module is a backport from Odoo SA and as such, it is not included in the OCA CLA.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see that you have a DESCRIPTION.rst in the readme folder, so you have to introduce the disclaimer there.

Choose a reason for hiding this comment

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

Oh, I see that you have a DESCRIPTION.rst in the readme folder, so you have to introduce the disclaimer there.

Resolved

@geomer198 geomer198 force-pushed the 14.0-t2784-mrp_subcontracting_purchase-add_module branch from a1c6816 to 93cd12b Compare October 13, 2023 16:21
@@ -0,0 +1,5 @@
This bridge module adds some smart buttons between Purchase and Subcontracting

**DISCLAIMER:** This module is a backport from Odoo SA and as such, it is not included in the OCA CLA.
Copy link
Member

Choose a reason for hiding this comment

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

This should be put on readme/DESCRIPTION.rst, not here.

@pedrobaeza
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 14.0-ocabot-merge-pr-1082-by-pedrobaeza-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 095cef7 into OCA:14.0 Oct 13, 2023
6 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at c2c7aaa. Thanks a lot for contributing to OCA. ❤️

@francesco-ooops
Copy link
Contributor

Hi @pedrobaeza , thanks for your support on this one.

Do you have any idea why the "Configuration" file is not appearing in readme here?: https://github.com/OCA/manufacture/tree/14.0/mrp_subcontracting_purchase

Do you think it's a .md issue?

@pedrobaeza
Copy link
Member

It should be CONFIGURE.md, not CONFIGURATION.md.

@david-fleischmann
Copy link

@francesco-ooops thank you! Just found that notifications from github in my spam folder... sorry for that late reply!
I'll check this feature on our side within the next weeks. Best, David

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.

7 participants