Ir al contenido
Odoo Menú
  • Identificarse
  • Pruébalo gratis
  • Aplicaciones
    Finanzas
    • Contabilidad
    • Facturación
    • Gastos
    • Hoja de cálculo (BI)
    • Documentos
    • Firma electrónica
    Ventas
    • CRM
    • Ventas
    • TPV para tiendas
    • TPV para restaurantes
    • Suscripciones
    • Alquiler
    Sitios web
    • Creador de sitios web
    • Comercio electrónico
    • Blog
    • Foro
    • Chat en directo
    • eLearning
    Cadena de suministro
    • Inventario
    • Fabricación
    • PLM
    • Compra
    • Mantenimiento
    • Calidad
    Recursos Humanos
    • Empleados
    • Reclutamiento
    • Ausencias
    • Evaluación
    • Referencias
    • Flota
    Marketing
    • Marketing social
    • Marketing por correo electrónico
    • Marketing por SMS
    • Eventos
    • Automatización de marketing
    • Encuestas
    Servicios
    • Proyecto
    • Partes de horas
    • Servicio de campo
    • Servicio de asistencia
    • Planificación
    • Citas
    Productividad
    • Conversaciones
    • Aprobaciones
    • IoT
    • VoIP
    • Información
    • WhatsApp
    Aplicaciones de terceros Studio de Odoo Plataforma de Odoo Cloud
  • Industrias
    Comercio al por menor
    • Librería
    • Tienda de ropa
    • Tienda de muebles
    • Tienda de ultramarinos
    • Ferretería
    • Juguetería
    Food & Hospitality
    • Bar y taberna
    • Restaurante
    • Comida rápida
    • Guest House
    • Distribuidor de bebidas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudio de arquitectura
    • Construcción
    • Gestión inmobiliaria
    • Jardinería
    • Asociación de propietarios
    Consulting
    • Accounting Firm
    • Partner de Odoo
    • Agencia de marketing
    • Bufete de abogados
    • Adquisición de talentos
    • Auditorías y certificaciones
    Fabricación
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regalos de empresas
    Salud y bienestar
    • Club deportivo
    • Óptica
    • Gimnasio
    • Terapeutas
    • Farmacia
    • Peluquería
    Trades
    • Handyman
    • Hardware y asistencia informática
    • Solar Energy Systems
    • Zapatero
    • Servicios de limpieza
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agencia de protección del medio ambiente
    • Alquiler de paneles publicitarios
    • Estudio fotográfico
    • Alquiler de bicicletas
    • Distribuidor de software
    Browse all Industries
  • Comunidad
    Aprender
    • Tutoriales
    • Documentación
    • Certificaciones
    • Formación
    • Blog
    • Podcast
    Potenciar la educación
    • Programa de formación
    • Scale Up! El juego empresarial
    • Visita Odoo
    Obtener el software
    • Descargar
    • Comparar ediciones
    • Versiones
    Colaborar
    • GitHub
    • Foro
    • Eventos
    • Traducciones
    • Convertirse en partner
    • Services for Partners
    • Registrar tu empresa contable
    Obtener servicios
    • Encontrar un partner
    • Encontrar un asesor fiscal
    • Contacta con un experto
    • Servicios de implementación
    • Referencias de clientes
    • Ayuda
    • Actualizaciones
    GitHub YouTube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Solicitar una demostración
  • Precios
  • Ayuda

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

  • CRM
  • e-Commerce
  • Contabilidad
  • Inventario
  • PoS
  • Proyecto
  • MRP
All apps
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Debe estar registrado para interactuar con la comunidad.
Todas las publicaciones Personas Insignias
Etiquetas (Ver todo)
odoo accounting v14 pos v15
Acerca de este foro
Ayuda

How to add a column to Sales Order Lines?

Suscribirse

Reciba una notificación cuando haya actividad en esta publicación

Se marcó esta pregunta
salesviewinheritancev7quotation
2 Respuestas
14131 Vistas
Avatar
Anabela Damas

Hi, First of all I had a new parameter to the product. Then I need that new parameter in Sales Order Lines for each product in the sales order.

I've tried to add but I had some problems regarding to being inheriting a view from sales.order and adding a parameter from products.

I've done this:

<record id="view_order_form_inherit" model="ir.ui.view">
  <field name="name">sale.order.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="/form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="before">
         <field name="new_field_from_product"/> 
     </xpath>
  </field>
</record>

Thanks, sorry my English.

1
Avatar
Descartar
Avatar
AJ Schrafel Paper Corp
Mejor respuesta

First, The code you posted is trying to insert your new field into the view_ORDER_form, you need to insert it on the view_ORDER_LINE_form.

Second, the python code must also inherit and add the new field, if you are not doing that, there is no way your XML will work right.

Third, when you ask for help, please include the error message. Without the error message those trying to help you are flying blind.

0
Avatar
Descartar
Anabela Damas
Autor

I've changed the code to: <record id="view_order_line_form_inherit" model="ir.ui.view"> <field name="name">sale.order.line.form.inherit</field> <field name="model">sale.order.line</field> <field name="inherit_id" ref="sale.view_order_line_form2"/> <field name="arch" type="xml"> <xpath expr="/form/sheet/group/group/field[@name='price_unit']" position="before"> <field name="vi_adr"/> </xpath> </field> </record>

Anabela Damas
Autor

In the second point you said that I've to inherit and and the new field, class product_product(osv.osv): _inherit = "product.product" _name = "product.product" _columns = { 'vi_adr': fields.boolean('ADR', help="Check this box if the product needs ADR (Accord europeen relatif au transport international des marchandises Dangereuses par Route)"), } product_product() Is this that you mean or is to add the new field in the sale.order.line?

Anabela Damas
Autor

And the error that I've with the new code is: Can't find field 'vi_adr' in the following view parts composing the view of object model 'sale.order.line': * sale.order.line.form.inherit Either you wrongly customized this view, or some modules bringing those views are not compatible with your current data model openerp.addons.base.ir.ir_ui_view: Can't render view mutante.view_order_line_form_inherit for model: sale.order.line

AJ Schrafel Paper Corp

you must upload your code, then stop and start your server to get openERP to recognize the new fields you added in your python file.

Anabela Damas
Autor

I'm stoping and starting the server by doing this : ./openerp-server -c install/openerp-server.conf --update=mynewmodule, but the error that I've mentioned is always there..

AJ Schrafel Paper Corp

that is wrong, you must FIRST stop the server. ./openerp-server stop SECOND run the command to confirm the server has stopped - ps aux | grep openerp THIRD kill any other running processes FINALLY start the server again ./openerp-server start capitals are for readability because you cannot put new lines in the comments.

Anabela Damas
Autor

I've this error doing like you told me to: ./openerp-server start No handlers could be found for logger "openerp.addons.google_docs.google_docs" Traceback (most recent call last): File "./openerp-server", line 5, in <module> openerp.cli.main() File "/opt/openerp-7.0/openerp/cli/__init__.py", line 51, in main __import__(m) File "/opt/openerp-7.0/openerp/modules/module.py", line 133, in load_module mod = imp.load_module('openerp.addons.' + module_part, f, path, descr)

Anabela Damas
Autor

File "/opt/openerp-7.0/openerp/addons/base_action_rule/__init__.py", line 23, in <module> import test_models File "/opt/openerp-7.0/openerp/addons/base_action_rule/test_models.py", line 1, in <module> from osv import osv, fields

Anabela Damas
Autor

I've put this working but the error is still here: " Can't find field 'vi_adr' ..."

AJ Schrafel Paper Corp

you must add the attribute to class sale_order_line(osv.osv): if you want to record that information in an order line. If you have a product that is or is not ADR it would be much easier for you to just create 2 different products. I do not know what ADR is, so i cannot adivse you.

Anabela Damas
Autor

So if I had a field to products and if I want that field to appear in the sale_order_line I have to add this field to the class sale_order_line(osv.osv)? ADR - "Accord europeen relatif au transport international des marchandises Dangereuses par Route" Thanks

AJ Schrafel Paper Corp

Yes, but it would probably be easier for you to create a product ADR, and add that to orders that require ADR. Or create 2 product entries - one with ADR and one without, for each of your products. That would remove the need for you to do any custom coding.

Jhon Felipe Urrego Mejia

Hi, please share all module, tnks

Avatar
Abdullah
Mejor respuesta

Here is .py

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

secondary_uom_qty = fields.Float(
string="Secondary Qty", digits="Product Unit of Measure"
)

Here is your XML


Sale Order Secondary Unit
sale.order



expr="//field[@name='order_line']/form//field[@name='price_subtotal']"
position="after"
>
name="secondary_uom_qty"
class="oe_inline oe_no_button"
attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}"
/>

I hope this will give you a good idea about how to do it. Just inherit sale.order.line in py and specify your field and in xml while specifying model you will write sale.order as both views are linked together.

Thanks

0
Avatar
Descartar
¿Le interesa esta conversación? ¡Participe en ella!

Cree una cuenta para poder utilizar funciones exclusivas e interactuar con la comunidad.

Inscribirse
Publicaciones relacionadas Respuestas Vistas Actividad
Sales quotation in V10 Resuelto
sales view quotation
Avatar
Avatar
1
jun 19
2765
odoo16 sale order inheritance
sales view inheritance saas odoo16features
Avatar
Avatar
Avatar
2
mar 23
3055
Sales quotation Resuelto
sales quotation
Avatar
Avatar
2
mar 24
8541
View inheritance Resuelto
view inheritance
Avatar
Avatar
1
mar 20
4309
How to auto refresh view? Resuelto
view v7
Avatar
Avatar
Avatar
Avatar
Avatar
12
dic 23
45324
Comunidad
  • Tutoriales
  • Documentación
  • Foro
Código abierto
  • Descargar
  • GitHub
  • Runbot
  • Traducciones
Servicios
  • Alojamiento Odoo.sh
  • Ayuda
  • Actualizar
  • Desarrollos personalizados
  • Educación
  • Encontrar un asesor fiscal
  • Encontrar un partner
  • Convertirse en partner
Sobre nosotros
  • Nuestra empresa
  • Activos de marca
  • Contacta con nosotros
  • Puestos de trabajo
  • Eventos
  • Podcast
  • Blog
  • Clientes
  • Información legal • Privacidad
  • Seguridad
الْعَرَبيّة 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 es un conjunto de aplicaciones de código abierto que cubren todas las necesidades de tu empresa: CRM, comercio electrónico, contabilidad, inventario, punto de venta, gestión de proyectos, etc.

La propuesta única de valor de Odoo es ser muy fácil de usar y totalmente integrado.

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