Skip to content

[10.0][FIX+IMP] contract: Improve usability and don't fail on wrong data - #130

Merged
lasley merged 2 commits into
OCA:10.0from
Tecnativa:10.0-contract-usability
Dec 7, 2017
Merged

[10.0][FIX+IMP] contract: Improve usability and don't fail on wrong data#130
lasley merged 2 commits into
OCA:10.0from
Tecnativa:10.0-contract-usability

Conversation

@pedrobaeza

@pedrobaeza pedrobaeza commented Dec 2, 2017

Copy link
Copy Markdown
Member
  • 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 pedrobaeza added this to the 10.0 milestone Dec 2, 2017
@pedrobaeza

pedrobaeza commented Dec 2, 2017

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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...

@NL66278 NL66278 left a comment

Copy link
Copy Markdown
Contributor

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!

@lasley lasley left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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

lasley commented Dec 2, 2017

Copy link
Copy Markdown
Contributor

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

@pedrobaeza

Copy link
Copy Markdown
Member Author

Done!

@pedrobaeza
pedrobaeza force-pushed the 10.0-contract-usability branch from cb5ddad to 8b6541a Compare December 3, 2017 04:05

@rafaelbn rafaelbn left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
Member Author

@rafaelbn coverage improved

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

@lasley lasley Dec 4, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@pedrobaeza
pedrobaeza force-pushed the 10.0-contract-usability branch from d954c73 to bb2730d Compare December 7, 2017 09:24
@lasley

lasley commented Dec 7, 2017

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
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
sbejaoui pushed a commit to acsone/contract that referenced this pull request Nov 4, 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
chrisonline pushed a commit to chrisonline/contract that referenced this pull request Mar 20, 2025
…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
tobiaszehntner pushed a commit to acsone/contract that referenced this pull request Apr 7, 2025
…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 Apr 28, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request May 16, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request May 22, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request May 22, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request May 23, 2025
…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 acsone/contract that referenced this pull request Jun 2, 2025
…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 acsone/contract that referenced this pull request Jun 3, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request Jun 11, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request Jun 12, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request Jun 12, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request Jun 12, 2025
…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
javierjcf pushed a commit to Comunitea/contract that referenced this pull request Jun 12, 2025
…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.

4 participants