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

[17.0][ADD] base_import_pdf_by_template_account: New module #1056

Open
wants to merge 5 commits into
base: 17.0
Choose a base branch
from

Conversation

victoralmau
Copy link
Member

@victoralmau victoralmau commented Oct 24, 2024

New module

Locked by:

Please @pilarvargas-tecnativa can you review it?

@Tecnativa TT50003

@victoralmau
Copy link
Member Author

Ping @pedrobaeza What do you think about this approach?

@pedrobaeza pedrobaeza added this to the 17.0 milestone Oct 25, 2024
@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch 5 times, most recently from 5f1ae25 to 873ec82 Compare October 30, 2024 16:26
@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch 3 times, most recently from 3e23634 to b98e98b Compare December 2, 2024 11:34
@victoralmau victoralmau marked this pull request as ready for review December 2, 2024 12:35
@victoralmau
Copy link
Member Author

It's ready to review.

@pilarvargas-tecnativa
Copy link

Remove WIP tag from PR title

/>
<field name="column">3</field>
<field name="value_type">fixed</field>
<!--<field name="fixed_value_text">{"cls.env.ref('base_import_pdf_by_template_account.analytic_account_tecnativa').id": 100.0}</field>!-->

Choose a reason for hiding this comment

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

It is not necessary?

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, it is necessary but it is commented because it is not possible to do that directly. If you know the way to do it, it will be welcome! (this is currently set correctly in tests).

@victoralmau victoralmau changed the title [17.0][WIP] base_import_pdf_by_template_account: New module [17.0][ADD] base_import_pdf_by_template_account: New module Dec 2, 2024
@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch from b98e98b to f7b7e33 Compare December 2, 2024 14:36
@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch 2 times, most recently from ce86bdf to a59260d Compare December 3, 2024 09:27
@pedrobaeza
Copy link
Member

Better to not use demo data on tests, as already stated in other PRs.

@victoralmau
Copy link
Member Author

victoralmau commented Dec 3, 2024

So in all tests we create everything related to a template again? I do not agree that this is useful in the OCA modules (I am not sure it is an “official” guideline either.).

@pedrobaeza
Copy link
Member

You have to test the specific gestures of this module, not an entire template, and yes, what's needed for that tests should be in the test itself.

@victoralmau
Copy link
Member Author

victoralmau commented Dec 3, 2024

Sorry, but how is the _import_base_import_pdf_by_template() method supposed to be tested without a full template (that template already existed in test_base_import_pdf_by_template so that user installing the module can test it). The template is also useful for testing analytic distributions.

As a personal reflection, i think that all this "bureaucracy" is not good and will only demotivate some contributors.

@pedrobaeza
Copy link
Member

This is not bureaucracy. It's doing tests the best way. I already stated the reasons to not use demo data in other PR. Do you remember?

I'm not saying here to not use templates. What I'm saying is that you don't need a whole template, just the minimal data to test the features. And all of that definitions inside the test class, not as demo data.

@victoralmau
Copy link
Member Author

This is not bureaucracy. It's doing tests the best way. I already stated the reasons to not use demo data in other PR. Do you remember?

Yes, and I explained then that I disagreed on the arguments. I explained earlier that you moved the demo data from test_base_import_pdf_by_template (and the tests) to base_import_pdf_by_template_account but never mind, I'll make the change so you don't block the PR. I'll get on it.

@pedrobaeza
Copy link
Member

Yes, and I explained then that I disagreed on the arguments

You said that you don't agree, and then I'll explain the reasons, but you didn't counter-argument my explanations to say why it's better to use demo data. Odoo itself has moved to be demo-data independent because of these reasons.

@victoralmau
Copy link
Member Author

It was not worth counter-argument, just like now, it is simply better to make the changes you suggest and that's it.

@pedrobaeza
Copy link
Member

OK, we have debated about this internally. Just for others reading this, there's a guideline about this:

https://github.com/OCA/odoo-community.org/blob/master/website/Contribution/CONTRIBUTING.rst#616avoid-relying-on-demo-data

Let's change it for avoiding problems in the future.

@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch 2 times, most recently from dad9ea1 to b89a01f Compare December 3, 2024 12:59
@victoralmau
Copy link
Member Author

Extra commit added (and many lines) to define data in tests (without using demo data). Do you want that change also made to base_import_pdf_by_template and test_base_import_pdf_by_template?

@pedrobaeza
Copy link
Member

Do you really need the supplierinfo for all the products?
Do you really need so many products?

When I talked about doing the minimal template in tests, I was referring to that, to have the minimal test unit, not a PDF template with lots of lines that are the same (but with another product).

I don't want to bother you more in this one, but it's for you to take that into consideration. Always design the tests with the minimum use case, not a one with a lot of things repeated, but that are not adding real value to the test, just boilerplate creating more data, but testing the same feature.

@victoralmau
Copy link
Member Author

Do you really need the supplierinfo for all the products? Do you really need so many products?

When I talked about doing the minimal template in tests, I was referring to that, to have the minimal test unit, not a PDF template with lots of lines that are the same (but with another product).

This is importing an existing .pdf file created specifically for that template (it was created some time ago), you can create another one specifically for the tests, but it would not make sense (or at least not to me), precisely for this reason I did not see sense to make this change.

@pedrobaeza
Copy link
Member

Well, even if using this not so ideal template, I think you can create just one product with full data, and another "fake one" that you put as fallback in case the product is not found for the rest of the lines. Or is there any exception in that case?

@victoralmau
Copy link
Member Author

The test was intended to validate a multi-line use case with different quantities, prices, etc, but if you want we can change it... (I don't understand that these comments appear on unrelated things, i.e. the test already existed and was validated).

@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch 2 times, most recently from 04ea251 to c5b7a46 Compare December 4, 2024 07:43
@victoralmau victoralmau force-pushed the 17.0-add-base_import_pdf_by_template_account branch from c5b7a46 to 4569fb1 Compare December 4, 2024 08:33
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.

3 participants