[ADD] commission_simple, commission_simple_agent, sale_agent

3 modules backported from v16
This commit is contained in:
Alexis de Lattre
2025-03-15 07:27:11 +01:00
parent ed1a6641ce
commit 6e54d026a6
44 changed files with 2384 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
# Copyright 2024-2025 Akretion France (https://www.akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountMove(models.Model):
_inherit = 'account.move'
invoice_agent_id = fields.Many2one(
'res.partner', domain=[('agent', '=', True)], string="Agent",
ondelete='restrict', tracking=True,
compute='_compute_invoice_agent_id', store=True, readonly=False)
@api.depends('partner_id', 'move_type')
def _compute_invoice_agent_id(self):
for move in self:
if move.is_sale_document() and move.partner_id:
move.invoice_agent_id = move.partner_id.commercial_partner_id.agent_id.id or False
else:
move.invoice_agent_id = False