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

[16.0] [ADD] sale_commission_margin: Deduct commission from margin #591

Open
wants to merge 1 commit into
base: 16.0
Choose a base branch
from

Conversation

luisDIXMIT
Copy link

@luisDIXMIT luisDIXMIT commented Jan 27, 2025

This addon allows commissions to be deducted from the margin.

Because precomputed fields must depend on other precomputed fields, some computed fields in the commission module have been established as precomputed.

Issue #153

@OCA-git-bot
Copy link
Contributor

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

@luisDIXMIT luisDIXMIT force-pushed the 16.0-add-sale_commission_margin branch from cd26f5f to 20753b2 Compare January 27, 2025 09:29
@pedrobaeza pedrobaeza added this to the 16.0 milestone Jan 27, 2025
@etobella
Copy link
Member

etobella commented Feb 4, 2025

@OCA/crm-sales-marketing-maintainers

@luisDIXMIT luisDIXMIT force-pushed the 16.0-add-sale_commission_margin branch from 20753b2 to 2fa6b43 Compare February 5, 2025 16:21
@luisDIXMIT luisDIXMIT changed the title [16.0] [ADD] sale_commission_margin: Decuct commission from margin [16.0] [ADD] sale_commission_margin: Deduct commission from margin Feb 5, 2025
@luisDIXMIT luisDIXMIT force-pushed the 16.0-add-sale_commission_margin branch from 2fa6b43 to 8bed888 Compare February 6, 2025 10:03
@@ -4,6 +4,8 @@
<field name="name">sale.agent.order.inherit.form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="priority" eval="15" />
<field name="mode">primary</field>
Copy link
Member

Choose a reason for hiding this comment

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

Why primary?

You should add the change directly in your module

Copy link
Author

Choose a reason for hiding this comment

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

Because in that case, it has no effect. I looked into the Odoo documentation and supposed it is due to the following:

View matching
if a view is requested by (model, type), the view with the right model and type, mode=primary and the lowest priority is matched.

when a view is requested by id, if its mode is not primary its closest parent with mode primary is matched.

Copy link
Member

Choose a reason for hiding this comment

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

This is not correct. Please don't change it.

Copy link
Author

Choose a reason for hiding this comment

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

Due to your suggestions and after several attempts with different approaches, I think the cleanest solution to show the commission total before the margin, without completely changing the view logic and while keeping it within my module, is to use the position attribute to move the field to a different node. WDY?

Copy link
Author

Choose a reason for hiding this comment

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

I have also squashed all commits into one because it is all about my module.

@luisDIXMIT luisDIXMIT force-pushed the 16.0-add-sale_commission_margin branch from 8bed888 to 2e62d68 Compare February 6, 2025 14:56
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.

4 participants