Hi all
I'm trying to add a button near the sale order line in odoo 16
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
Hi all
I'm trying to add a button near the sale order line in odoo 16
Hi,
are you trying to add button in sale order line[for each line]? if yes, try this code
<record id="view_order_form" model="ir.ui.view">
<field name="name">order.view.form.inherit</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@name='order_lines']//tree" position="inside">
<button string="test" name="method_name" type="object" class="oe_highlight"/>
</xpath>
</field>
</record>
In Odoo 16, you can add a button near the sale order line by creating a new widget and adding it to the sale order line form view. Here's an example of how this can be done:
odoo.define('module_name', function (require) { "use strict"; var core = require('web.core'); var FormView = require('web.FormView'); var FormField = require('web.form_common'); var MyButton = FormField.FieldChar.extend({ template: 'MyButton', events: { 'click button': '_onButtonClick', }, start: function() { this._super(); this.$el.prepend(''); }, _onButtonClick: function() { console.log('Button clicked'); // add your functionality here }, }); core.form_widget_registry.add('my_button', MyButton); });
Sale Order Line Form sale.order.line
This is just a basic example, you can customize it according to your need. You can use the position attribute in the xpath to specify where the button should be placed.
You'll need to restart the Odoo server and upgrade your custom module after making these changes to see the button on the Sale Order Line form view.
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
3
aug. 25
|
2722 | ||
|
1
mei 25
|
2688 | ||
|
1
apr. 25
|
3675 | ||
|
1
apr. 25
|
4528 | ||
|
1
apr. 25
|
1988 |