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

[10.0] product_combination_exclude #255

Closed
wants to merge 4 commits into from

Conversation

gdgellatly
Copy link
Contributor

Hi,

This is a work in progress. Its another one of those fairly powerful, dense modules which does some cool things but needs some good documentation. I'm just creating a PR for now for feedback particularly on some of the nested loops, and an RFC I'm about to raise but you are welcome to test on runbot.

The premise is that sometimes combination of attributes are not all available and so we want to exclude those on 1, many or all product templates. This allows you to quickly create an exclusion matrix, hand edit if desired and it will prevent those variants from being created, unlink existing ones if it can, or merely deactivate existing ones.

The module is complete aside from above mentioned concerns over cyclomatic complexity - IOW it works, just not sure how efficiently yet.

Still needs docs and tests.

@gdgellatly gdgellatly force-pushed the 10.0-product-attribute-exclusion branch 4 times, most recently from 5b72760 to 89ebc2e Compare April 23, 2017 23:12
@gdgellatly
Copy link
Contributor Author

gdgellatly commented Apr 23, 2017

I need some help here. I have a circular xml_id reference. Technically it shouldn't be an issue but it cause travis to fail. I just copied it from the product demo files so maybe it isn't needed but could someone just take a quick look.

The issue is creating attribute lines which require a template, then adding the attribute line to the template in order to create the variants. I'm pretty sure if I don't do it that way I'll need to manually create every variant combination of products.

@gdgellatly gdgellatly force-pushed the 10.0-product-attribute-exclusion branch 5 times, most recently from 52ba7c9 to 55504aa Compare April 24, 2017 01:57
@gdgellatly gdgellatly force-pushed the 10.0-product-attribute-exclusion branch from 55504aa to 0898e13 Compare April 24, 2017 02:04
@gdgellatly gdgellatly changed the title [WIP] product_combination_exclude [10.0] product_combination_exclude Apr 26, 2017
@lasley
Copy link

lasley commented May 12, 2017

Hi @gdgellatly - Is this ready for review?

@gdgellatly
Copy link
Contributor Author

@lasley yes it is now

Copy link

@lasley lasley left a comment

Choose a reason for hiding this comment

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

Thanks @gdgellatly

:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/135/10.0

.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
Copy link

Choose a reason for hiding this comment

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

Remove this line

assign them globally or just to selected templates, generate the list of exclusions and then even
manually fine tune them if you choose before updating the associated products.

Installation
Copy link

Choose a reason for hiding this comment

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

Can remove this header if there's nothing of note


{
'name': 'Product Combination Exclude',
'summary': """
Copy link

Choose a reason for hiding this comment

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

This is adding a bunch of whitespace. Best to just start and end your strings:

    "summary": "My first line. "
               "and another line"
      

<!-- Copyright 2017 Graeme Gellatly
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>
Copy link

Choose a reason for hiding this comment

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

<odoo noupdate="1"> and can remove the data tag

<!-- Copyright 2017 Graeme Gellatly
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>
Copy link

Choose a reason for hiding this comment

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

<odoo noupdate="1"> and can remove the data tag

variants_to_deactivate.append(variant.id)
pass
if variants_to_deactivate:
product_obj.write(variants_to_deactivate, {'active': False})
Copy link

Choose a reason for hiding this comment

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

variants_to_deactivate.write(...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as above

License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>
<data>
Copy link

Choose a reason for hiding this comment

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

Can remove data tag

<odoo>
<data>

<record model="ir.model.access" id="product_attribute_exclude_access">
Copy link

Choose a reason for hiding this comment

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

Any reason that you're not just doing this in CSV? It's much easier and is the standard for the ir.model.access rules - https://github.com/OCA/maintainer-tools/blob/master/template/module/security/ir.model.access.csv

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because thats the way mrbob works and I prefer using tools that make things fast to do

License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->

<odoo>
<data>
Copy link

Choose a reason for hiding this comment

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

No data tag

<odoo>
<data>

<record model="ir.model.access" id="product_attribute_exclude_matrix_access">
Copy link

Choose a reason for hiding this comment

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

This should be in CSV

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as above

@gdgellatly
Copy link
Contributor Author

I'm just going to put this in my own repo. Sorry but it just gets too hard. Wait a month or two for a single review and get asked for unneeded commas.

@gdgellatly gdgellatly closed this May 16, 2017
@pedrobaeza
Copy link
Member

@gdgellatly Really you retire with some minor comments? OK, go on your own way if you want, but I think you overreacted for some minor suggestions that are interesting and you should listen to for improving your "community" code.

Anyway, if you don't want to do that changes after the rationale for the change, OK, but don't close the PR.

@gdgellatly
Copy link
Contributor Author

@pedrobaeza I've been down this road before. Probably I've been responsible for others going down it as well and for that I am sorry. OCA does just get too hard nowadays, and if a new PSC is reviewing this hard. Maybe I take your point on some commas, and possibly I overreacted and should just put them in, but still you and I both know where these kinds of reviews end up. I want to stay consistent with upstream for maintainability and porting, PSC wants something OCA perfect. Better to close now and save time.

@pedrobaeza
Copy link
Member

@gdgellatly, PSC Dave (and also me) doesn't know about your intention to keep consistency with upstream (it would be interesting to put that on a comment in the method, so we don't need to ask anyway), but he is going to understand for sure and decline in his requests.

Please reconsider your position and open again the PR.

OCA method is not perfect, and it lacks reviewers, but you should also understand that if you don't review any other PRs, people shouldn't review your PR also.

OCA code guidelines and "correctness" is intended to improve your code and avoid any kind of problems derived from the accumulated experience of its contributors, so any suggested improvement will enrich also your code, although it means to work a bit more on your first PRs. Once you get used to these conventions, all your code (OCA published or not), will benefit from them.

My team has hundred of PRs in OCA, and we know that people doesn't review them: https://github.com/pulls?utf8=%E2%9C%93&q=involves%3ATecnativa+is%3Aopen. We are patient, make cross-reviews, fix comments when they are reviewed, and they get finally merged. Meanwhile, we have been using them thanks to our infrastructure (Docker) than can merge PRs directly (buildout can also do it).

@gdgellatly
Copy link
Contributor Author

@pedrobaeza exactly you get it. You can cross review, know all the rules, have your own trained people etc and still have hundred of outstanding PR's. A single guy like me has no hope.

@pedrobaeza
Copy link
Member

I don't think so. It's only a matter of balance of the time spent on OCA. The same as you spend some time reading documentation and so on, and maybe you program a couple of hours a week for this task, you should dedicate a couple of hours a week for OCA related stuff, reviewing, fixing comments, etc. This will enrich you and make you learn a lot, more even than other tasks.

I have now a team, but I have been on my own for 4 years, contributing also with hundred of modules, and I'm what I am now thanks to my involvement in OCA.

@gdgellatly
Copy link
Contributor Author

@pedrobaeza firstly don't get me wrong, you are a machine and what you do for OCA is amazing. I wish I could have done this in a couple of hours. The design alone was a day or more, and the coding about a week and I spend most of nearly every day writing code. To get it concise, reasonably elegant and testable was quite challenging given upstreams limitations.

However, what seems clear from your position is those that cannot dedicate the same resources or have the same levels of patience should not contribute. I've always maintained a 2:1 review ratio, better where I can.

I don't submit that many PR's, but given we had 40 or so modules from v7 surrounding variants and associated purchase, sale and mrp workflows to port I figured I'd open what I could and review back again where I could. This for me was a large commitment of time. But at this rate and with my deadlines and the style/pace of review that is conducted we are on a timeline of years not months. It just isn't a good fit given the situation, hence closing the open PR's.

So its not about this review in particular, its about the entire time. Telling me I need to invest in better infrastructure just so I can contribute to OCA is not helpful.

@pedrobaeza
Copy link
Member

What I talked about a couple of hours was the increment for contributing to OCA, and this tends to be 0 when you get used to the guidelines.

I think that is not fair to say that people can't contribute if they don't dedicate a lot of resources, but the same you learn to code in Python or to work with Odoo, there's a learning to do about collaborative processes, documenting correctly code for others to see it, follow guidelines and so on, and this is the pay needed when contributing to any open-source community (not only OCA).

I'm going to help you with your PRs for not being frustrated with the contribution, but please give us another chance 👼

@lasley
Copy link

lasley commented May 16, 2017

@gdgellatly - If you are going to take this stance, please close all of your PRs so that I do not continue to waste my time. I just wasted thirty minutes of my time for you to tell me no on things that are simply good practice. The changes I requested would have amounted to all of ten minutes of your's, and would have made your code practices better going forward. If you don't want to get better, that's fine, but please don't waste our time in the process.

@lasley
Copy link

lasley commented May 16, 2017

PS I'm going to submit a new PR to finish this sometime today, even though I don't need or want this module.

@gdgellatly
Copy link
Contributor Author

gdgellatly commented May 16, 2017

@lasley It was late, I was tired. I over reacted. This is technically complex, indeed in making the requested changes I found a very serious bug, I try very hard to make things match upstream. However it seems clear this is not the place for me. Believe it or not I do know why some of these things are bad, but it is so frustrating to go through 4 linters, wait a month to get human linting. (btw, that isn't directed at you, indeed any review is better than none and I do appreciate your time, and if linting is your preferred review then fine by me, the frustration is the lack of interest in anything variant related from a functional or technical perspective).

@gdgellatly
Copy link
Contributor Author

Ah I force pushed the changes and can't reopen

@gdgellatly
Copy link
Contributor Author

gdgellatly commented May 16, 2017 via email

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.

None yet

3 participants