-
-
Notifications
You must be signed in to change notification settings - Fork 344
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] commission: multi-currency support #405
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,15 +78,20 @@ def action_invoice(self): | |
def _get_invoice_partner(self): | ||
return self[0].agent_id | ||
|
||
def _get_invoice_currency(self): | ||
return self[0].currency_id | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this method needed? |
||
|
||
def _prepare_invoice(self, journal, product, date=False): | ||
move_form = Form( | ||
self.env["account.move"].with_context(default_move_type="in_invoice") | ||
) | ||
if date: | ||
move_form.invoice_date = date | ||
partner = self._get_invoice_partner() | ||
currency = self._get_invoice_currency() | ||
move_form.partner_id = partner | ||
move_form.journal_id = journal | ||
move_form.currency_id = currency | ||
for settlement in self: | ||
with move_form.invoice_line_ids.new() as line_form: | ||
line_form.product_id = product | ||
|
@@ -118,7 +123,7 @@ def _prepare_invoice(self, journal, product, date=False): | |
return vals | ||
|
||
def _get_invoice_grouping_keys(self): | ||
return ["company_id", "agent_id"] | ||
return ["company_id", "currency_id", "agent_id"] | ||
|
||
def make_invoices(self, journal, product, date=False, grouped=False): | ||
invoice_vals_list = [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
* Oihane Crucelaegui <[email protected]> | ||
* Nicola Malcontenti <[email protected]> | ||
* Aitor Bouzas <[email protected]> | ||
* Alexei Rivera <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,16 +14,19 @@ class CommissionMakeSettle(models.TransientModel): | |
ondelete={"sale_invoice": "cascade"}, | ||
) | ||
|
||
def _get_account_settle_domain(self, agent, date_to_agent): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is outside the scope of the PR. I'm not against it. Just that is should be done apart. |
||
return [ | ||
("invoice_date", "<", date_to_agent), | ||
("agent_id", "=", agent.id), | ||
("settled", "=", False), | ||
] | ||
|
||
def _get_agent_lines(self, agent, date_to_agent): | ||
"""Filter sales invoice agent lines for this type of settlement.""" | ||
if self.settlement_type != "sale_invoice": | ||
return super()._get_agent_lines(agent, date_to_agent) | ||
return self.env["account.invoice.line.agent"].search( | ||
[ | ||
("invoice_date", "<", date_to_agent), | ||
("agent_id", "=", agent.id), | ||
("settled", "=", False), | ||
], | ||
self._get_account_settle_domain(agent, date_to_agent), | ||
order="invoice_date", | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,9 @@ Commissions | |
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/commission-15-0/commission-15-0-commission | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/165/15.0 | ||
:alt: Try me on Runbot | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/commission&target_branch=15.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
|
@@ -109,8 +109,6 @@ Known issues / Roadmap | |
====================== | ||
|
||
* Make it totally multi-company aware. | ||
* Be multi-currency aware for settlements. | ||
* Allow to calculate and pay in other currency different from company one. | ||
* Set agent popup window with a kanban view with richer information and | ||
mobile friendly. | ||
|
||
|
@@ -144,6 +142,7 @@ Contributors | |
* Oihane Crucelaegui <[email protected]> | ||
* Nicola Malcontenti <[email protected]> | ||
* Aitor Bouzas <[email protected]> | ||
* Alexei Rivera <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
* Oihane Crucelaegui <[email protected]> | ||
* Nicola Malcontenti <[email protected]> | ||
* Aitor Bouzas <[email protected]> | ||
* Alexei Rivera <[email protected]> | ||
|
||
* `Tecnativa <https://www.tecnativa.com>`__: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
* Make it totally multi-company aware. | ||
* Be multi-currency aware for settlements. | ||
* Allow to calculate and pay in other currency different from company one. | ||
* Set agent popup window with a kanban view with richer information and | ||
mobile friendly. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be fatal on module upgrade, needing to store it for all the existing lines. Why do you need this?