Skip to Content
Odoo Меню
  • Увійти
  • Спробуйте це безкоштовно
  • Додатки
    Фінанси
    • Бухоблік
    • Виставлення рахунку
    • Витрати
    • Електронні таблиці (BI)
    • Документи
    • Підпис
    Продажі
    • CRM
    • Продажі
    • POS Магазин
    • POS Ресторан
    • Підписки
    • Оренда
    Веб-сайти
    • Конструктор веб-сайту
    • Електронна комерція
    • Блог
    • Форум
    • Живий чат
    • Електронне навчання
    Ланцюг поставок
    • Склад
    • Виробництво
    • PLM
    • Купівлі
    • Технічне обслуговування
    • Якість
    Кадри
    • Співробітники
    • Рекрутинг
    • Відпустки
    • Оцінювання
    • Рекомендації
    • Автотранспорт
    Маркетинг
    • Маркетинг соцмереж
    • Email-маркетинг
    • SMS-маркетинг
    • Події
    • Автом. маркетингу
    • Опитування
    Послуги
    • Проект
    • Табелі
    • Виїзне обслуговування
    • Служба підтримки
    • Планування
    • Призначення
    Продуктивність
    • Обговорення
    • Схвалення
    • IoT
    • IP-телефонія
    • База знань
    • WhatsApp
    Сторонні модулі Odoo Studio Платформа Odoo Cloud
  • Сфери
    Роздрібна торгівля
    • Книжковий магазин
    • Магазин одягу
    • Магазин меблів
    • Продуктовий магазин
    • Магазин будівельних матеріалів
    • Магазин іграшок
    Food & Hospitality
    • Бар та паб
    • Ресторан
    • Фастфуд
    • Guest House
    • Дистриб'ютор напоїв
    • Hotel
    Real Estate
    • Real Estate Agency
    • Архітектурна фірма
    • Будівництво
    • Управління нерухомістю
    • Садівництво
    • Асоціація власників нерухомості
    Consulting
    • Accounting Firm
    • Партнер Odoo
    • Marketing Agency
    • Юридична фірма
    • Придбання Талантів
    • Аудит та сертифікація
    Виробництво
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Корпоративні подарунки
    Здоров'я & Фітнес
    • Спортивний клуб
    • Оптика
    • Фітнес-центр
    • Практики здоров'я
    • Аптека
    • Салон краси
    Trades
    • Ремонтник
    • IT-обладнання та Підтримка
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Екологічна агенція
    • Оренда білбордів
    • Фотографія
    • Лізинг велосипедів
    • Реселлер програмного забезпечення
    Browse all Industries
  • Спільнота
    Навчання
    • Навчальний посібник
    • Документація
    • Сертифікації
    • Тренування
    • Блог
    • Подкаст
    Сприяйте Освіті
    • Програма навчання
    • Бізнес гра Scale Up!
    • Відвідайте Odoo
    Отримайте програмне забезпечення
    • Завантаження
    • Порівняйте версії
    • Релізи
    Співпрацюйте
    • Github
    • Форум
    • Події
    • Переклади
    • Стати партнером
    • Services for Partners
    • Зареєструйте вашу бухгалтерську фірму
    Отримайте послуги
    • Знайдіть партнера
    • Знайдіть бухгалтера
    • Зустріньтеся з консультантом
    • Послуги з впровадження
    • Референси клієнтів
    • Підтримка
    • Оновлення
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Отримати демо
  • Ціни
  • Допомога

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

  • CRM
  • e-Commerce
  • Бухоблік
  • Склад
  • PoS
  • Проект
  • MRP
All apps
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
All Posts Люди Значки
Мітки (View all)
odoo accounting v14 pos v15
Про цей форум
Допомога

How to add a column to Sales Order Lines?

Підписатися

Отримуйте сповіщення про активність щодо цієї публікації

Це запитання позначене
salesviewinheritancev7quotation
2 Відповіді
14126 Переглядів
Аватар
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
Аватар
Відмінити
Аватар
AJ Schrafel Paper Corp
Найкраща відповідь

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
Аватар
Відмінити
Anabela Damas
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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
Автор

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

Аватар
Abdullah
Найкраща відповідь

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
Аватар
Відмінити
Enjoying the discussion? Don't just read, join in!

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

Реєстрація
Related Posts Відповіді Переглядів Дія
Sales quotation in V10 Вирішено
sales view quotation
Аватар
Аватар
1
черв. 19
2764
odoo16 sale order inheritance
sales view inheritance saas odoo16features
Аватар
Аватар
Аватар
2
бер. 23
3050
Sales quotation Вирішено
sales quotation
Аватар
Аватар
2
бер. 24
8537
View inheritance Вирішено
view inheritance
Аватар
Аватар
1
бер. 20
4301
How to auto refresh view? Вирішено
view v7
Аватар
Аватар
Аватар
Аватар
Аватар
12
груд. 23
45318
Спільнота
  • Навчальний посібник
  • Документація
  • Форум
Open Source
  • Завантаження
  • Github
  • Runbot
  • Переклади
Послуги
  • Хостинг Odoo.sh
  • Підтримка
  • Оновлення
  • Кастомні доробки
  • Навчання
  • Знайдіть бухгалтера
  • Знайдіть партнера
  • Стати партнером
Про нас
  • Наша компанія
  • Торгові активи
  • Зв'яжіться з нами
  • Вакансії
  • Події
  • Подкаст
  • Блог
  • Клієнти
  • Юридичні документи • Конфіденційність
  • Безпека
الْعَرَبيّة 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 - це набір програм для роботи з відкритим кодом, які охоплюють всі ваші потреби компанії: CRM, електронна комерція, бухгалтерський облік, склад, точка продажу, управління проектами тощо.

Унікальна пропозиція Odoo - це одночасно дуже проста у використанні та повністю інтегрована.

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