-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Better assignment of main category #237
Open
gfcapalbo
wants to merge
4
commits into
OCA:8.0
Choose a base branch
from
gfcapalbo:8.0-issue_2954_category_random_overwrite_prevent
base: 8.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Better assignment of main category #237
gfcapalbo
wants to merge
4
commits into
OCA:8.0
from
gfcapalbo:8.0-issue_2954_category_random_overwrite_prevent
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hbrunn
requested changes
Sep 29, 2016
if main_categ_id: | ||
if self.backend_record.categ_id.id not in category_ids): | ||
result['categ_id'] = main_categ_id | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would you need this? This branch causes the value to be overwritten with itself
# skip main cat assignment if the current main category is already in | ||
# categ_ids | ||
if main_categ_id: | ||
if self.backend_record.categ_id.id not in category_ids): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
python syntax error
current category in odoo is one of the categories fetched from magento.
gfcapalbo
force-pushed
the
8.0-issue_2954_category_random_overwrite_prevent
branch
from
September 29, 2016 14:43
1d9eadc
to
e6cf79f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When fetching categories from magento the connector returns a list of category ids.
To decide which one will be updated as categ_id (main category) the connector pops the last element of the categories and elects it as the main category of the product.
This randomness may cause unpredictable behaviour on update when using multiple categories in magento.
We had a client who wanted some products to be category: product_price/ 6 and product_price 5.
when updating products the connector would substitute some of the categories of some products and leave other intact. (depending on wich category happened to be the last in the magento category list.)
We are adding a little bit more logic to this decision. If the current main category of the odoo product exists already in the list of returned categories from magento, do not update the main category at all.