Odoo Help

0

How to Offer Sales Commissions for Website Sales

By
Cyrus Waithaka
on 10/27/15, 2:43 PM 486 views

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?


About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 10/27/15, 2:43 PM
Seen: 486 times
Last updated: 10/27/15, 2:43 PM