Skip to Content
Menú
This question has been flagged
1 Respondre
140 Vistes

I sell Software and want to automatically add Maintenance to every Quotation based on a percentage of the yearly price, for the first year only.

I know I can create Quotation Templates with both lines and train Users to update the price, but is there way to automatically calculate and add it for them?

Avatar
Descartar
Best Answer

Yes.

An Automation Rule combined with the standard Warning feature can be used to notify Users and automatically calculate and add the Maintenance Service.


First, define the Software Service

We are tagging the Service and defining a Warning to notify Users about the Automation


Next, define the Maintenance Service

We are tagging the Service, defining a Sales Price (the percentage), defining that we want a Task created in the Maintenance Project to keep track of requests and time spent, and adding Internal Notes to explain the purpose of this Product.


Finally, create the Automation Rule:

We want to Execute Code when the Order Lines field is updated.


maintenance_product = env['product.product'].search([('product_tag_ids.name','=','Maintenance')],limit=1)
software_products = env['product.product'].search([('product_tag_ids.name','=','Software')])

if maintenance_product and software_products:

    software_product_sol = record.order_line.filtered(lambda sol: sol.product_id.id in software_products.ids)

    if len(software_product_sol) > 1:
        raise UserError("Only one Software Product can be added to each order!")

    product_ids_in_order = record.order_line.mapped('product_id.id')

    if software_product_sol and maintenance_product.id not in product_ids_in_order:
        env['sale.order.line'].create({
            'order_id': record.id,
            'product_id': maintenance_product.id,
            'price_unit': maintenance_product.list_price * software_product_sol.price_subtotal,
            'name': f'Maintenance\nFirst Year @ {maintenance_product.list_price*100:.2f}% of ${software_product_sol.price_unit:,.2f}'
        })


Results:


When we first add the Software Service to the Quotation, it comes over with the default Unit Price and we see the Warning.


When we update the yearly price, extend the term and save the Quotation, we see the Maintenance Service automatically added with the correct price.


Notes: 

  • this is a prototype, not a solution. More complex relationships between Products could also be achieved using Custom Fields. System Parameters can also be used to hardcode Rates or Product ID's.
  • Please discuss your specific needs with your Odoo Digital Advisor or Odoo Partner if you don't have the skills to understand or leverage the approach discussed here.


Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
d’ag. 19
6140
1
d’oct. 24
4682
1
de juny 24
2412
4
d’abr. 20
11081
1
de nov. 15
7354