Odoo Help

0

Set cost price for products added to draft invoice

By
Kito Midtah
on 2/13/18, 11:18 AM 286 views

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?    

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.

Can you be more specific about which model I need to import in order to expose the cost entry in the data field? Is there any documentation that records all these? And, which file must I edit for the invoice?

On Wed, Feb 14, 2018 at 7:14 AM Niyas Raphy <niyasraphyk@gmail.com> wrote:

A new answer on Set cost price for products added to draft invoice has been posted. Click here to access the post :

See post

--
Niyas Raphy


Sent by Odoo S.A. using Odoo.

Kito Midtah
on 2/17/18, 2:41 AM
2

Niyas Raphy

--Niyas Raphy--
11481
| 5 6 9
Calicut, India
--Niyas Raphy--

Odoo Techno Functionalist

Feel free to contact :  niyasraphyk@gmail.com

Niyas Raphy
On 2/13/18, 10:14 PM

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

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 2/13/18, 11:18 AM
Seen: 286 times
Last updated: 2/18/18, 1:54 AM