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

[ADD] product_top_category #1173

Closed

Conversation

victor-champonnois
Copy link
Member

No description provided.


# what if there is a change in parent of parent ? how to trigger the compute ?
# note : the field is store as related in product.template
@api.depends('parent_id')
Copy link
Contributor

Choose a reason for hiding this comment

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

You could dépend on parent_id.top_categ_id. Dont you think ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good idea thanks :)

@victor-champonnois victor-champonnois marked this pull request as ready for review October 27, 2022 08:17
@victor-champonnois
Copy link
Member Author

@legalsylvain any idea why travis is failing ? The error is

January 2021. pip 21.0 will remove support for this functionality.

ERROR: Could not find a version that satisfies the requirement pylint-plugin-utils==0.7 (from -r /home/travis/maintainer-quality-tools/travis/pylint_odoo_requirements.txt (line 1)) (from versions: 0.1, 0.1.1, 0.2, 0.2.1, 0.2.2, 0.2.3, 0.2.4, 0.2.6, 0.3, 0.4, 0.5, 0.6)

ERROR: No matching distribution found for pylint-plugin-utils==0.7 (from -r /home/travis/maintainer-quality-tools/travis/pylint_odoo_requirements.txt (line 1))

The command "travis_install_nightly" failed and exited with 1 during 

@legalsylvain
Copy link
Contributor

Travis is totally obsolete. I guess that switching to github action could solve the problem, updating technical files in the root folder (in a dedicated PR).
do you know how to do that ?

otherwise, you can ask to @carmenbianca I think.

Copy link

@robinkeunen robinkeunen left a comment

Choose a reason for hiding this comment

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

Small comments otherwise LGTM 👍

def _get_top_category(self):
self.ensure_one()
if self.parent_id:
return(self.parent_id._get_top_category())

Choose a reason for hiding this comment

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

Why the parentheses ?

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, don't know, it just came naturally ^^ I remove them

@@ -0,0 +1,3 @@
For all categories, compute their top categories.

Choose a reason for hiding this comment

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

Maybe add that this field is useful for reports and pivot views ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, done

@victor-champonnois
Copy link
Member Author

@robinkeunen thanks for the review !

@legalsylvain
Copy link
Contributor

Hi. could you solve travis issue, updating files in another PR via copier template ? (then rebasing).

thanks !

@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch 4 times, most recently from a02153c to 0f7aa53 Compare December 9, 2022 09:30
@victor-champonnois
Copy link
Member Author

Hi. could you solve travis issue, updating files in another PR via copier template ? (then rebasing).

thanks !

Done here, it still doesn't seem to work though. @carmenbianca do you have an idea why ?

@carmenbianca
Copy link
Member

@victor-champonnois In the meantime, the template broke again 😅

OCA/oca-addons-repo-template#181

Need to bump template again

@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch from 0f7aa53 to 571d527 Compare December 15, 2022 09:53
@victor-champonnois
Copy link
Member Author

victor-champonnois commented Dec 15, 2022

@carmenbianca updated the copier update branch and rebased on it !

@rousseldenis rousseldenis added this to the 12.0 milestone Dec 15, 2022
@rousseldenis
Copy link
Contributor

@victor-champonnois Easier to do a copier update PR as this one could last again some time. The copier PR could be merged fast. Do you take care of that ?

@rousseldenis
Copy link
Contributor

@victor-champonnois Easier to do a copier update PR as this one could last again some time. The copier PR could be merged fast. Do you take care of that ?

Ok, I see it. I'll do the merge

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Apr 16, 2023
@carmenbianca
Copy link
Member

Rebasing this.

@carmenbianca carmenbianca force-pushed the 12.0-add-product_top_category branch from 571d527 to 2148e0f Compare May 2, 2023 15:24
@github-actions github-actions bot removed the stale PR/Issue without recent activity, it'll be soon closed automatically. label May 7, 2023
@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch from 2148e0f to e8b44b6 Compare May 10, 2023 09:57
@victor-champonnois
Copy link
Member Author

@rousseldenis this is ready to be merged

@@ -38,6 +38,7 @@ repos:
rev: v3.4.1
hooks:
- id: flake8
language_version: python3
Copy link
Contributor

Choose a reason for hiding this comment

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

@victor-champonnois You should not modify manually.

Maybe could you propose this change to https://github.com/OCA/oca-addons-repo-template/blob/master/src/.pre-commit-config.yaml.jinja ?

Thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed the commit, it wasn't needed actually.

@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch from e8b44b6 to 94032a0 Compare May 11, 2023 07:55
@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch from 94032a0 to 5d1f6c0 Compare May 11, 2023 08:07
@remytms
Copy link

remytms commented Jul 12, 2023

@rousseldenis It seams that this PR is now ok to merge. :)

for categ in self:
categ.top_categ_id = categ._get_top_category()

top_categ_id = fields.Many2one('product.category',
Copy link
Contributor

Choose a reason for hiding this comment

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

@victor-champonnois Could you put fields on ... top :-) ? Thanks

Copy link
Member Author

Choose a reason for hiding this comment

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

done, thanks for the review :)

@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch 2 times, most recently from 04599f2 to 618f78d Compare July 20, 2023 07:58
@victor-champonnois victor-champonnois force-pushed the 12.0-add-product_top_category branch from 618f78d to c7bd592 Compare July 20, 2023 07:58
@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). 🤖

@rousseldenis
Copy link
Contributor

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 12.0-ocabot-merge-pr-1173-by-rousseldenis-bump-patch, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jul 20, 2023
Signed-off-by rousseldenis
@OCA-git-bot
Copy link
Contributor

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

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