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][FIX+IMP] contract: Improve usability and don't fail on wrong data #130

Merged
merged 2 commits into from
Dec 7, 2017

Conversation

pedrobaeza
Copy link
Member

@pedrobaeza pedrobaeza commented Dec 2, 2017

  • Cron create invoices masked for avoiding silent errors
  • New constraints for assuring data consistency
  • UI helps for entering consistent data
  • Spanish translation
  • Remove double company_id field on form

@Tecnativa

@pedrobaeza
Copy link
Member Author

pedrobaeza commented Dec 2, 2017

Let's see if this one is the definitive one for total satisfaction, hehe

@pedrobaeza pedrobaeza force-pushed the 10.0-contract-usability branch 2 times, most recently from ab22956 to fa862c5 Compare December 2, 2017 18:18
def _onchange_recurring_invoices(self):
if self.date_start and self.recurring_invoices:
@api.onchange('date_start')
def _onchange_date_start(self):
Copy link

Choose a reason for hiding this comment

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

Question, what is the reasoning for not testing on recurring_invoices?

Copy link
Member Author

Choose a reason for hiding this comment

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

With this, now you don't need to care about that field: the recurring_next_invoice will always be synchronized.

Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like we're also implicitly assuming that it's a recurring contract in the event of a start_date (IMO a great simplification). With that though, could we then just outright remove the recurring_next_invoice field?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry recurring_invoices field, not recurring_next_invoice

Copy link
Member Author

Choose a reason for hiding this comment

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

Previous code assumes the same: it took date_start when you mark recurring_invoices field. What you are talking about is to take today when marking recurring_invoices. It can be another thing to add indeed.

What I don't see correct is to remove recurring_invoices field, as it serves a lot for UI usability and user experience. Having that check, you clean the interface out of fields that aren't important if you don't use recurring invoicing. Note that in this PR, I have improved also the experience automarking by default the field when clicking on create when you are in the "Contracts" menu.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the elaboration Pedro. Does it make sense to actually store recurring_invoices, given that it is really just a functional field for triggering of specific workflows?

Just spitballing other upgrades here seeing as we have these nice improvements in similar areas. Not blocking

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I prefer to keep it right now, or we would need to change a lot of filters, context values...

Copy link

@NL66278 NL66278 left a comment

Choose a reason for hiding this comment

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

I have one question, but this seems a whole set of very welcome improvements to me!

Copy link
Contributor

@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 @pedrobaeza. Few minor verbiage changes, but otherwise solid. I do have the same question as @NL66278 though.

for contract in self.filtered('recurring_invoices'):
if not contract.recurring_next_date:
raise ValidationError(
_("You must supply an invoicing next date for contract "
Copy link
Contributor

Choose a reason for hiding this comment

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

s/an invoicing next date/a next invoicing date/

for contract in self.filtered('recurring_invoices'):
if not contract.date_start:
raise ValidationError(
_("You must supply an start date for contract '%s'") %
Copy link
Contributor

Choose a reason for hiding this comment

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

s/an/a

@lasley
Copy link
Contributor

lasley commented Dec 2, 2017

Oh and I guess the most important part - Travis is 🔴

@pedrobaeza
Copy link
Member Author

Done!

Copy link
Member

@rafaelbn rafaelbn left a comment

Choose a reason for hiding this comment

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

Tested functionally in runbot 👍

Just check before merging if you want to improve codecov/patch — 89.65% of diff hit (target 94.61%)

@pedrobaeza
Copy link
Member Author

@rafaelbn coverage improved

@@ -267,7 +268,7 @@ def recurring_create_invoice(self):
ref_date = contract.recurring_next_date or fields.Date.today()
if (contract.date_start > ref_date or
contract.date_end and contract.date_end < ref_date):
if self.env.context.get('cron'):
if self.env.context.get('cron'): # pragma: no cover
Copy link
Contributor

@lasley lasley Dec 4, 2017

Choose a reason for hiding this comment

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

IMO this is cheating & should be removed. We should either take the coverage hit if we don't want to test it, or add the test (I'm good with either)

Copy link
Member Author

Choose a reason for hiding this comment

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

No, this is not cheating in this case. It's a case that doesn't modify anything and I don't want to be reported as a coverage failure.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is still logic here, that if untested should yield a lack of coverage. Whether it modifies anything or not, the logic is still in the program and still does something different from the other things.

I'm not arguing against the lack of testing for this, as I agree it's a minimal point and probably doesn't need it. I am arguing against the false coverage report though, because this is not covered and is a unique logic path that should be tested per TDD standards.

Copy link
Member Author

Choose a reason for hiding this comment

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

Dave, not for this case. There's no possibility of leading to that situation right now with current constraints, so it's only a safeguard for already installed DBs, but no sense of testing that specific case (forcing through SQL) or to report as not covered.

Copy link
Contributor

Choose a reason for hiding this comment

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

Untouchable code is still untested IMO. What's the harm in having it show what it is? Hiding the fact that the block of code wasn't executed during testing is just sweeping the fact it can't be touched under the rug. There's always going to be scenarios like this, which is why 100% test coverage is an unrealistic goal in the practical sense.

I won't block for it - but I really feel that pragma: no cover should align explicitly with the example case provided in Coverage.py docs, which is to exclude debug code. Any production code that's not actually tested should show as untested.

Copy link
Member Author

Choose a reason for hiding this comment

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

OK, I give up due to your insistence...

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
@lasley
Copy link
Contributor

lasley commented Dec 7, 2017

Thanks for removing the pragma Pedro! Runbot red is the full disk and unrelated to this, so I merge

@lasley lasley merged commit 18f5456 into OCA:10.0 Dec 7, 2017
pedrobaeza added a commit that referenced this pull request Dec 11, 2017
…ata (#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
@pedrobaeza pedrobaeza deleted the 10.0-contract-usability branch December 11, 2017 09:22
@pedrobaeza
Copy link
Member Author

Cherry-picked to v11 at 8d10f68

levkar pushed a commit to levkar/contract that referenced this pull request Feb 16, 2018
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
levkar pushed a commit to levkar/contract that referenced this pull request Feb 17, 2018
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
sbejaoui pushed a commit to sbejaoui/contract that referenced this pull request Oct 25, 2018
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
pedrobaeza added a commit to sbejaoui/contract that referenced this pull request Oct 27, 2018
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
sbejaoui pushed a commit to sbejaoui/contract that referenced this pull request Jan 24, 2019
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
sylvainvh pushed a commit to sylvainvh/contract that referenced this pull request May 27, 2019
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
devCbssolutionsRo pushed a commit to devCbssolutionsRo/contract that referenced this pull request Dec 19, 2019
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
sylvainvh pushed a commit to sylvainvh/contract that referenced this pull request Apr 20, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
AaronHForgeFlow pushed a commit to ForgeFlow/contract that referenced this pull request Apr 24, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
pedrobaeza added a commit to Tecnativa/contract that referenced this pull request Jul 14, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
murtuzasaleh pushed a commit to SerpentConsultingServices/contract that referenced this pull request Sep 30, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
ozono pushed a commit to ozono/contract that referenced this pull request Nov 7, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
ozono pushed a commit to ozono/contract that referenced this pull request Nov 14, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
dnplkndll pushed a commit to Kencove/contract that referenced this pull request Dec 6, 2020
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
ozono pushed a commit to ozono/contract that referenced this pull request Apr 2, 2021
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
Freni-OSI pushed a commit to ursais/contract that referenced this pull request Apr 7, 2021
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
jcdrubay pushed a commit to jcdrubay/contract that referenced this pull request Oct 28, 2021
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
rousseldenis pushed a commit to acsone/contract that referenced this pull request Nov 7, 2021
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
olgamarcocb pushed a commit to tegin/contract that referenced this pull request Nov 16, 2021
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
rousseldenis pushed a commit to acsone/contract that referenced this pull request Jan 26, 2022
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
ntsirintanis pushed a commit to sunflowerit/contract that referenced this pull request Jun 21, 2022
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
ntsirintanis pushed a commit to sunflowerit/contract that referenced this pull request Jun 22, 2022
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
wpichler pushed a commit to wpichler/contract that referenced this pull request Oct 24, 2022
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
vibhascs pushed a commit to vibhascs/contract that referenced this pull request Jan 12, 2023
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
baguenth pushed a commit to AmetrasIntelligence/contract that referenced this pull request Jan 12, 2023
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
baguenth pushed a commit to AmetrasIntelligence/contract that referenced this pull request Jan 12, 2023
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
pedrobaeza added a commit to wpichler/contract that referenced this pull request Mar 15, 2023
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
OCA-git-bot pushed a commit to vibhascs/contract that referenced this pull request Mar 21, 2023
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
JesusValdez96 pushed a commit to vauxoo-dev/contract that referenced this pull request May 28, 2023
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
peluko00 pushed a commit to APSL/contract that referenced this pull request Feb 15, 2024
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
jaydeep32 pushed a commit to archeti-org/contract that referenced this pull request Feb 15, 2024
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
CRogos pushed a commit to c4a8-odoo/module-oca-contract that referenced this pull request Mar 23, 2024
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
CRogos pushed a commit to c4a8-odoo/module-oca-contract that referenced this pull request Mar 23, 2024
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
CRogos pushed a commit to c4a8-odoo/module-oca-contract that referenced this pull request Mar 23, 2024
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form
Boxnia pushed a commit to Ontinet-com/contract that referenced this pull request May 28, 2024
…ata (OCA#130)

* [FIX+IMP] contract: Improve usability and don't fail on wrong data

* Cron create invoices masked for avoiding silent errors
* New constraints for assuring data consistency
* UI helps for entering consistent data
* Spanish translation
* Remove double company_id field on form

* [FIX] contract_sale_generation: Adapt tests to upstream contract
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.

None yet

4 participants