-
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] sale_commission_partial_settlement: Migration to 16.0
- Loading branch information
Showing
8 changed files
with
90 additions
and
44 deletions.
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
21 changes: 19 additions & 2 deletions
21
sale_commission_partial_settlement/models/account_partial_reconcile.py
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,7 +1,24 @@ | ||
from odoo import fields, models | ||
from odoo import api, fields, models | ||
|
||
|
||
class AccountPartialReconcile(models.Model): | ||
_inherit = "account.partial.reconcile" | ||
|
||
partial_commission_settled = fields.Boolean() | ||
account_invoice_line_agent_partial_ids = fields.One2many( | ||
"account.invoice.line.agent.partial", "account_partial_reconcile_id" | ||
) | ||
partial_commission_settled = fields.Boolean( | ||
compute="_compute_partial_commission_settled", store=True | ||
) | ||
|
||
@api.depends( | ||
"account_invoice_line_agent_partial_ids", | ||
"account_invoice_line_agent_partial_ids.agent_line.settlement_id.state", | ||
) | ||
def _compute_partial_commission_settled(self): | ||
for rec in self: | ||
rec.partial_commission_settled = bool( | ||
rec.account_invoice_line_agent_partial_ids.filtered( | ||
lambda x: x.mapped("agent_line.settlement_id")[:1].state != "cancel" | ||
) | ||
) |
9 changes: 9 additions & 0 deletions
9
sale_commission_partial_settlement/models/commission_settlement.py
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from odoo import models | ||
|
||
|
||
class CommissionSettlement(models.Model): | ||
_inherit = "commission.settlement" | ||
|
||
def unlink(self): | ||
self.mapped("line_ids.agent_line_partial_ids").unlink() | ||
return super().unlink() |
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