I can change unit price when drafting an invoice, and I'd like to add a form field to set the cost price as well. How may I accomplish that?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
2828
Views
Hello Mr Niyas,
I hope you don't mind me emailing you, but my Odoo forum karma is not enough to comment on your answer.On Wed, Feb 14, 2018 at 7:14 AM Niyas Raphy <niyasraphyk@gmail.com> wrote:
Hi,
To add a new field you can inherit the form and add a new field using xpath.
In Python :
First of all you have to inherit the model and add the field to corresponding model
from odoo import models, fields
class NameForClass(models.Model):
_inherit = "model_name"
new_field_name = fields.Char(string="Cost")
In XML:
<record id="give_an_id_for_record" model="ir.ui.view">
<field name="name">a_name_here</field>
<field name="model">model_name</field>
<field name="inherit_id" ref="external_id_of_original_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name_of_existing_field']" position="after">
<field name="new_field_name"/>
</xpath>
</field>
</record>
Have a look at this video too : Additional field to existing view in odoo 10
Thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
0
Nov 24
|
133 | ||
|
0
Mar 23
|
863 | ||
|
1
Mar 23
|
1830 | ||
|
3
Dec 22
|
2929 | ||
|
2
Jul 22
|
6008 |