[18.0][FIX] contract: show smart buttons when partner has contracts#1416
[18.0][FIX] contract: show smart buttons when partner has contracts#1416shamnaskoyani wants to merge 1 commit into
Conversation
|
CI is red on a pre-existing flake unrelated to this PR. Summary from the failed run:
Could a maintainer please re-run the failed jobs? I don't have rerun permissions on OCA. |
| "There was an error and the view couldn't be opened.", | ||
| ) | ||
|
|
||
| def test_smart_button_visible_on_rank_zero_partner(self): |
There was a problem hiding this comment.
This tests is useless, so please remove it.
|
Thanks for the review @pedrobaeza — removed the test in fa54560. You're right, it was just asserting on the literal XML I had just written; the existing |
|
Please squash the commits into one. We don't want history that doesn't add value. |
The "Sale Contracts" and "Purchase Contracts" smart buttons on the partner form were hidden when customer_rank == 0 / supplier_rank == 0. Partners created outside the Sales/Purchase flows (e.g. via the Contacts module) keep these ranks at 0, so users could not reach linked contracts from the partner form even when they existed. Extend the invisible expression to also consider sale_contract_count and purchase_contract_count, which are already rendered by the statinfo widget on each button. A button is now shown whenever the partner has contracts of that type, regardless of rank. Closes OCA#1412
fa54560 to
ffee8f2
Compare
|
Done — squashed into a single commit (ffee8f2). Thanks @pedrobaeza. |
|
Reviewing the content, this avoids the direct creation of a contract for the partners. Isn't that what you was against in #1413 (comment), @carlosdauden ? |
Summary
Sale ContractsandPurchase Contractssmart buttons on the partner form were hidden whenevercustomer_rank == 0/supplier_rank == 0. Partners created outside the Sales / Purchase flows (e.g. via the Contacts module) keep those ranks at 0, so users could not reach existing contracts from the partner form.invisibleexpression on each button to also considersale_contract_count/purchase_contract_count(which are already rendered by thestatinfowidget on the button). A button now shows whenever the partner has contracts of that type, regardless of rank. No change in behaviour when the rank is non-zero.Test plan
contracton a clean 18.0 database.customer_rankandsupplier_rankstay at 0).Sale Contractssmart button is visible with count 1; thePurchase Contractsbutton stays hidden.test_smart_button_visible_on_rank_zero_partnerincontract/tests/test_contract.py.Module maturity
Closes #1412