Skip to Content
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Zatwierdzenia
    • IoT
    • VoIP
    • Baza wiedzy
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc

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

  • CRM
  • e-Commerce
  • Księgowość
  • Zapasy
  • PoS
  • Projekt
  • MRP
All apps
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

Pass value from custom field from stock.move.line to stock.quant in Odoo 15?

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
stock_pickingprogrammingstock.quantv15stock.move.line
1 Odpowiedz
5461 Widoki
Awatar
Duvan Zavaleta

Hello, I'm trying to pass the value from a custom field I added in stock.move.line to stock.quant when the picking order gets validated but I can't find the function that allows this.


I have the same field already added in the tree view of the model stock.quant.


Thanks in advance.

0
Awatar
Odrzuć
Awatar
MUHAMMAD Imran
Najlepsza odpowiedź

In Odoo 15, you can pass a value from a custom field in the stock.move.line model to the stock.quant model by using the create() method of the stock.quant model and setting the value of the custom field as an argument.


Here's an example of how you might do this:


Copy code

# Import the necessary models

from odoo import models, fields


class StockMoveLine(models.Model):

    _inherit = 'stock.move.line'


    # Add a custom field

    custom_field = fields.Char(string='Custom Field')


class StockQuant(models.Model):

    _inherit = 'stock.quant'


    # Add a field to receive the value of the custom field

    custom_field_value = fields.Char(string='Custom Field Value')


    def create(self, vals):

        # Set the value of the custom field

        vals['custom_field_value'] = vals['custom_field']

        return super(StockQuant, self).create(vals)

In this example, we have added a custom field custom_field to the stock.move.line model and a field custom_field_value to the stock.quant model to receive the value of the custom field. We have also overridden the create() method of the stock.quant model to set the value of custom_field_value to the value of custom_field when creating a new stock.quant record.


I hope this helps! Let me know if you have any other questions

0
Awatar
Odrzuć
Duvan Zavaleta
Autor

Thank you for your answer, I tried like you said but it shows an error like this

File "/odoo15/custom/addons/module_stock_custom/models/stock_quant.py", line 15, in create
vals['custom_field_value'] = vals['custom_field']
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/odoo15/odoo15-server/odoo/http.py", line 643, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/odoo15/odoo15-server/odoo/http.py", line 301, in _handle_exception
raise exception.with_traceback(None) from new_cause
KeyError: 'custom_field'

You know why it happens? And it's different if I try to pass the value of a field many2one instead of a char? Thanks in advance

MUHAMMAD Imran

custom_field_value.name

Pass value like that

Duvan Zavaleta
Autor

Thank you for your answes, I also tried like that but it shows the same error

Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Access Sales order ID from package
stock_picking stock.quant
Awatar
0
lis 23
1641
Customizing Sequence Code Generation and Delivery Slip Behavior in stock.picking Module
community stock_picking v15
Awatar
Awatar
Awatar
Awatar
3
mar 24
5179
Odoo Server Error generating Picking Operations
reporting stock_picking v15
Awatar
0
lis 21
2840
How to fix "It is not possible to unreserve more products of 'Product Name' than you have in stock? Rozwiązane
stock_picking reservation unreserve v15
Awatar
Awatar
2
gru 24
8239
stock picking It is not possible to unreserve more products of ... than you have in stock in odoo 15 Rozwiązane
error stock_picking bug v15
Awatar
Awatar
Awatar
Awatar
Awatar
7
gru 24
10520
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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