Skip to Content
Menu
This question has been flagged
2 Replies
1520 Views

I want to extend my order.lines form view in my sales module.


Currently I have, my order.lines form and to the right is an empty space where the record history was going. I want to take advantage of that space and extend my order.lines form.

Avatar
Discard
Best Answer

1. Extend the Order Lines Form View Layout

Odoo’s form views use groups and notebook tabs to structure content. To extend the view:

📌 Steps:

  1. Inherit the sale.order.line form view to modify its layout.
  2. Use a two-column structure to occupy the empty space.
  3. Add new fields or sections to use the available area.

📌 Example XML Code (Extend the Order Line Form View):

xml

CopyEdit

<?xml version="1.0" encoding="utf-8"?> <odoo> <record id="view_order_line_form_extended" model="ir.ui.view"> <field name="name">sale.order.line.form.extended</field> <field name="model">sale.order.line</field> <field name="inherit_id" ref="sale.view_order_line_form"/> <field name="arch" type="xml"> <!-- Extend the main form layout --> <xpath expr="//sheet/group" position="attributes"> <attribute name="colspan">2</attribute> </xpath> <!-- Add extra fields or sections to the right --> <xpath expr="//sheet/group" position="after"> <group colspan="2"> <group> <field name="custom_field_1"/> <field name="custom_field_2"/> </group> <group> <field name="custom_notes" widget="text"/> </group> </group> </xpath> </field> </record> </odoo>

2. Add New Fields to Use the Extra Space

To fully utilize the extended area, define custom fields in your Python model (sale.order.line):

📌 Example Python Code (Adding New Fields):

python

CopyEdit

from odoo import models, fields class SaleOrderLine(models.Model): _inherit = 'sale.order.line' custom_field_1 = fields.Char(string="Custom Info") custom_field_2 = fields.Float(string="Extra Price") custom_notes = fields.Text(string="Additional Notes")

3. Restart Odoo & Update the Module

After adding the XML and Python changes:

  1. Restart the Odoo service:

    bash

    CopyEdit

    odoo-bin -u your_module_name --stop-after-init

  2. Clear browser cache and refresh the Sales Order form view.

Avatar
Discard
Best Answer

Solution for Editing the Web Sale View in Odoo

If you want to edit the view of the Odoo eCommerce (Web Sale) module, follow these steps:

1. Enable Developer Mode

  • Go to Settings > General Settings
  • Scroll down and activate Developer Mode

2. Locate the View in Website Builder

  • Navigate to Website > Customize
  • Select HTML/CSS/JS Editor (if using Website Builder)
  • Modify the QWeb templates

3. Modify the View from Backend (XML Templates)

  • Go to Settings > Technical > User Interface > Views
  • Search for views like:
    • website_sale.product (for product page)
    • website_sale.cart (for the cart page)
    • website_sale.checkout (for checkout page)
  • Edit the XML code to customize the UI

4. Use a Custom Module (For Advanced Customization)

If you need deeper customization, create a custom module to override the view.

Avatar
Discard
Related Posts Replies Views Activity
2
Jul 25
1826
1
May 25
1258
1
May 25
1374
2
May 25
1881
2
Feb 25
10224