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

[15.0][IMP] sale_commission: print partial and document total in report #572

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

toita86
Copy link

@toita86 toita86 commented Oct 23, 2024

FWP of #570 the implementation is a little bit different due to other modules dependance on the position of certain elements in the report.

@OCA-git-bot
Copy link
Contributor

Hi @pedrobaeza,
some modules you are maintaining are being modified, check this out!

@toita86 toita86 force-pushed the 15.0-FWP-IMP-sale_commission-toita86 branch from 1397de2 to e199c3b Compare October 23, 2024 12:33
@toita86 toita86 changed the title [IMP] sale_commission: print partial and document total in report [15.0][IMP] sale_commission: print partial and document total in report Oct 23, 2024
@toita86 toita86 marked this pull request as draft October 23, 2024 12:34
@toita86 toita86 force-pushed the 15.0-FWP-IMP-sale_commission-toita86 branch 9 times, most recently from f9d052e to 888a8b4 Compare October 23, 2024 14:40
@toita86
Copy link
Author

toita86 commented Oct 23, 2024

Hi @aleuffre, while FW you feature to adapt it to v15.0 I needed to change the position of the div that contains the total.

but now looks like this:
image

Do you have any suggestion that could make it more similar to you implementation?

@toita86 toita86 marked this pull request as ready for review October 23, 2024 14:55
@aleuffre
Copy link

Hi @aleuffre, while FW you feature to adapt it to v15.0 I needed to change the position of the div that contains the total.

but now looks like this:
Do you have any suggestion that could make it more similar to you implementation?

I took heavy inspiration from a similar section in the Sales Order report. As you can see, what I did was put the total outside the table and tfoot element, because the tfoot like the thead is printed again on every page, which is something we wanted to avoid.

So yes, I would try to put the total in a div, outside the table itself

@toita86 toita86 force-pushed the 15.0-FWP-IMP-sale_commission-toita86 branch from 888a8b4 to 41fa94e Compare October 25, 2024 13:02
@toita86
Copy link
Author

toita86 commented Oct 25, 2024

So yes, I would try to put the total in a div, outside the table itself

At first i didn't wanted to move it outside because the module account_commission used the tfoot on to add some spaces

<xpath expr="//table/tfoot/tr/td" position="before">

by removing the xpath element added in account_commission and moving the div outside everything looks fine in IMO.
Now this is the output
image

Comment on lines +20 to +28
<t t-if="show_doc_total">
<div class="text-right">
<strong>Global commission amount:</strong>
<span
t-esc="sum(docs.mapped('total'))"
t-options="{'widget': 'monetary', 'display_currency': docs[0].currency_id}"
/>
</div>
</t>

Choose a reason for hiding this comment

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

issue: Since this is the total for all pages being printed, I don't think it should be printed inside the foreach (line 95), as you only want this printed once, not once for every commission.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for your observation. While it's true that the total is printed inside the for each loop, it actually maintains the same behavior as in the 14.0.

Copy link

@aleuffre aleuffre left a comment

Choose a reason for hiding this comment

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

Code review, LGTM

Copy link
Contributor

@francesco-ooops francesco-ooops left a comment

Choose a reason for hiding this comment

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

LGTM

@pedrobaeza merge?

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza pedrobaeza added this to the 15.0 milestone Oct 29, 2024
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

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

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 15.0-ocabot-merge-pr-572-by-pedrobaeza-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 3a9d6a6 into OCA:15.0 Oct 29, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 2ef3624. Thanks a lot for contributing to OCA. ❤️

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.

5 participants