İçereği Atla
Menü
Bu soru işaretlendi
3 Cevaplar
266 Görünümler

Hello,

We have a company that manufactures uPVC windows and doors.

When visiting a customer’s site, our team takes measurements (Height and Width) to determine the exact size of the glass panel required.

For example:

If the height = 5m and width = 7m, then the area = 35 m².

We would like Odoo to automatically calculate the area when we enter the Height and Width, instead of doing it manually.

What we want to achieve:

  • Add two fields on the sales order line: Height and Width (Done).
  • Have Odoo automatically compute Area = Height × Width.
  • Optionally, use this calculated area for pricing (e.g., product priced per m²).

Questions:

  1. Is there a standard way to achieve this ?
  2. Or do we need a customization?
  3. Can this value also be passed to Manufacturing (MRP) when creating a Manufacturing Order?

Any advice, examples, or existing modules that can help automate this process would be greatly appreciated.

Thank you in advance!

Avatar
Vazgeç
Üretici

Hello Lakhan

Thank you, can this be done by Studio?

Hello,
I don’t have much idea about Studio customization.

En İyi Yanıt

Hi,


You want Odoo to automatically calculate the area of glass panels on a sales order line when Height and Width are entered, and optionally use this for pricing and manufacturing. While you already have the Height and Width fields on the sales order line, there is no standard Odoo feature that computes the area automatically.


The solution is to add a computed field for Area on sale.order.line, which multiplies Height × Width. This field can be stored in the database (store=True) so it can be used for pricing or manufacturing. Additionally, you can create an onchange method to calculate the product price based on the area and the product’s unit price.


from odoo import models, fields, api


class SaleOrderLine(models.Model):

    _inherit = 'sale.order.line'


    height = fields.Float(string="Height (m)")

    width = fields.Float(string="Width (m)")

    area = fields.Float(string="Area (m²)", compute="_compute_area", store=True)


    @api.depends('height', 'width')

    def _compute_area(self):

        for line in self:

            line.area = line.height * line.width


        @api.onchange('area')

    def _onchange_area_price(self):

        for line in self:

            if line.product_id and line.area:

                line.price_unit = line.area * line.product_id.lst_price


To use the calculated area in Manufacturing Orders, you can extend the methods that prepare procurement or manufacturing values from the sales order line, ensuring the area is passed along to the MO. This allows BOMs and production calculations to reference the correct area for each product.


While some custom Odoo modules exist for made-to-measure products like windows, doors, or flooring, for a simple area calculation, a small customization as described is sufficient. This approach enables automatic area computation, optional pricing based on area, and integration with manufacturing workflows.


Hope it helps

Avatar
Vazgeç
En İyi Yanıt

It is possible to have spreadsheet with the calculations as a 'quote calculator' linked to a quotation template.

Sales > Configuration > Quotation template

Link and configure a spreadsheet to quote calculator dropdown.

https://www.odoo.com/documentation/19.0/applications/productivity/spreadsheet.html

Avatar
Vazgeç
En İyi Yanıt

Hello Zuhair,

You need to do the customization for this, like calculation of the your custom field at Sale Order Line level and store it into the Area field, also you can pass all the values when MO automatically created from SO. Also it’s also a good idea to check how Odoo manages the “m²” unit of measure, so everything stays consistent when calculating and pricing by area.

Hope it helps

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
0
Mar 15
3197
3
Eki 24
3389
Sales quotation Çözüldü
2
Mar 24
7285
1
Haz 23
3977
1
Şub 23
4602