Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

Adding custom field to sales order product lines?

Odebírat

Get notified when there's activity on this post

This question has been flagged
fieldsfieldsale.order.line
10 Odpovědi
18135 Zobrazení
Avatar
Clemens Kroell

hi,

i try to add a custom text field "detail" to the product lines in a sales order. i created a new module and added the following code:

__init__.py

import sales_order_detail_field

sales_order_detail_field.py

from openerp.osv import fields, osv

class sales_order_detail_field(osv.Model):
        _name = 'sale.order'
        _inherit = 'sale.order.line'
        _columns = {
                'detail': fields.text('Detail'),
        }

sales_order_detail_field(

sales_order_detail_field.xml

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
   <record model="ir.ui.view" id="detail_field_in_view">
    <field name="name">New Sale Order field detail</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/notebook/page[@string='Order Line']//field[@name='product_uom_qty' ]" position="before">
        <field name="detail" />
    </xpath>
    </field>
</record>
    </data>
</openerp>

but when i reload my openerp window, i jus tget the following error

raise except_orm('ValidateError', '\n'.join(error_msgs))
except_orm: ('ValidateError', u'Fehler w\xe4hrend der Pr\xfcfung des Feldes field(s) arch: Invalid XML for View Architecture!')

any advice what's wrong here? maybe the xml?

0
Avatar
Zrušit
Avatar
Atul Kumar jain
Nejlepší odpověď

you can try this hope it will solve your problem

<record id="view_res_sale_line_form1" model="ir.ui.view">
    <field name="name">sale.order.line.form.inherit</field>
    <field name="model">sale.order</field>
    <field name="type">form</field>
    <field name="priority" eval="8"/>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
        <data>
            <xpath expr="//field[@name='product_uom_qty']" position="after">
                <field name="detail"/>

            </xpath>
            <xpath expr="//tree/field[@name='product_uom_qty']" position="after">
                <field name="detail"/>
            </xpath>
        </data> 
    </field>
1
Avatar
Zrušit
Atul Kumar jain

this will add details field in form and tree both view

Avatar
Mehul Patel
Nejlepší odpověď

you can try this code in .xml file

<record id='view_sale_quotation_from' model='ir.ui.view'>

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

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

     <field name="type">form</field>

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

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

         <data>

             <xpath expr="//notebook/page/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_uom_qty']" position="before">

         <field name="detail"/>

             </xpath>

         </data>

       </field>

</record>

0
Avatar
Zrušit
Avatar
Krupesh Laiya
Nejlepší odpověď
0
Avatar
Zrušit
Avatar
muthunaveen
Nejlepší odpověď

Try the below once and let me know ur result

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
   <record model="ir.ui.view" id="detail_field_in_view">
    <field name="name">sale_order.line.form2</field>
    <field name="model">sale.order</field>
    <field name="inherit_id" ref="sale.view_order_form"/>
    <field name="arch" type="xml">
                                <field name="product_uom_qty" position="before">
                                           <field name="Detail"/>
                                </field>
                              </field>
                   </record>
    </data>
</openerp>
0
Avatar
Zrušit
Jhon Felipe Urrego Mejia

i test it and this error show me: " File "lxml.etree.pyx", line 3196, in lxml.etree.parse (src/lxml/lxml.etree.c:64039) File "parser.pxi", line 1571, in lxml.etree._parseDocument (src/lxml/lxml.etree.c:91476) File "parser.pxi", line 1601, in lxml.etree._parseFilelikeDocument (src/lxml/lxml.etree.c:91798) File "parser.pxi", line 1484, in lxml.etree._parseDocFromFilelike (src/lxml/lxml.etree.c:90682) File "parser.pxi", line 1047, in lxml.etree._BaseParser._parseDocFromFilelike (src/lxml/lxml.etree.c:87736) File "parser.pxi", line 565, in lxml.etree._ParserContext._handleParseResultD"

Jhon Felipe Urrego Mejia

Openerp7 obviously

charlesraj

Hi updated answer please try it

Avatar
Jagdish Panchal
Nejlepší odpověď

Hi

I have update code try this.

<record model="ir.ui.view" id="sale_detail_sale_order_line">
    <field name="name">sale.order.line.detail.view.form</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//field[@name='price_unit']" position="after">
            <field name="detail"/>
        </xpath>
    </field>
</record>

<record model="ir.ui.view" id="sale_detail_sale_order_line_form">
    <field name="name">sale.order.line.tree.detail.view.form</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']/tree//field[@name='price_unit']" position="after">
            <field name="detail"/>
        </xpath>
    </field>
</record>
0
Avatar
Zrušit
Jhon Felipe Urrego Mejia

Still error: "OpenERP Server Error Client Traceback (most recent call last): File "/opt/openerp/server/openerp/addons/web/http.py", line 204, in dispatch response["result"] = method(self, *self.params) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1132, in call_button action = self._call_kw(req, model, method, args, {}) File "/opt/openerp/server/openerp/addons/web/controllers/main.py", line 1120, in _call_kw return getattr(req.session.model(model), method)(args, **kwargs) File "/opt/openerp/server/openerp/addons/web/session.py", line 42, in prox"

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Adding custom field to sales order product lines?
fields field sale.order.line
Avatar
Avatar
1
bře 15
6474
Adding custom field to sales order product lines?
fields field sale.order.line
Avatar
Avatar
1
bře 15
3996
Adding custom field to sales order product lines?
fields field sale.order.line
Avatar
Avatar
1
bře 15
4191
Concatenate two fields in a third one Vyřešeno
fields field
Avatar
Avatar
Avatar
2
srp 24
3209
Link a field with a node in invoice
fields field node
Avatar
0
led 24
1705
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now