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

In saleorder,when clicking Add a product how to  generate a form in odoo12 community

I want to open another form when the Add product is clicked..

How to implement it..

Please help..

Avatar
Discard
Best Answer

Hello,

Follow below step. this will help you.

go to menu Setting -> Users -> Open user form view. Checked the checkbox(give access rights to user) of "Manage Product Packaging".  so it will open the form view into sales order line while clicking on Add a Product.

Avatar
Discard

If they are not using the feature of product packaging no need to enable it right?

Best Answer

Hi,

If you want to open the form when clicking the add an item in the sale order line tree, remove the editable="bottom"




Once you remove the editable bottom form view defined for the sale order line will get opened. You can see the form view here,



UPDT: To add new fields to the form view, see below codes:


In python:

class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'

test = fields.Char(string='Test')


In XML,

<record id="sale_order_view_inherit" model="ir.ui.view">
<field name="name">sale.order.view</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="after">
<field name="test"/>
</xpath>
</field>
</record>

Thanks

Avatar
Discard

Using editable bottom to top it means when click on Add a product it will give new line to add from top of tree, not opened the form.

Yes, you are right, the solution is to remove the editable="bottom" from the tree attributes

Author

<record id="view_form_editable_list" model="ir.ui.view">

<field name="name">sale.order.form.editable.list</field>

<field name="model">sale.order</field>

<field name="inherit_id" ref="sale.view_order_form"/>

<field name="arch" type="xml">

<xpath expr="//tree" position="attributes">

<attribute name="editable" />

</xpath>

</field>

</record>

I got it..

without activating manage product packaging