[ADD] commission_simple, commission_simple_agent, sale_agent
3 modules backported from v16
This commit is contained in:
22
sale_agent/models/account_move.py
Normal file
22
sale_agent/models/account_move.py
Normal 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
|
||||
Reference in New Issue
Block a user