I am trying to extend the sale_commission module to support website sales. On the sale.order.line model, there is a one2many field with a function to get default commissions based on the order customer.
@api.model
def _default_commissions(self):
res = self.env['sale.commission'].get_default_commissions()
return [(0, 0, x) for x in res]
commissions = fields.One2many(
string="Agents & commissions",
comodel_name='sale.order.line.commission', inverse_name='sale_line',
copy=True, default=_default_commissions)
This works fine when I create an order on the backend. However, the commissions are not set when the order is created from the website. Any ideas how I can call the default function when the order line is created from the website?