Odoo Help

Welcome!

This community 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.

0

How to Offer Sales Commissions for Website Sales

By
Cyrus Waithaka
on 10/27/15, 2:43 PM 263 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?


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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