Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • E-learning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Artificiële Intelligentie
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Horeca & Hospitality
    • Bar en café
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van mede-eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brouwerij
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Diensten
    • Klusjesman
    • IT-hardware & ondersteuning
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Alle bedrijfstakken bekijkenInauguration Odoo Lyon
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijsprogramma
    • Scale Up! Business Game
    • Odoo bezoeken
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Partner worden
    • Diensten voor partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

Problem with prototype inheritance model

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
inheritancemrp12.
4469 Weergaven
Avatar
thanhps

Hi,

I am trying to create a Manufacturing Calculation view to calculate the quantities of necessary materials (and equivalent materials in case of lacking the main materials) to produce a product.

Note: This view is only for calculating and doesn't make any stock move.

My solution is to make a copy of Manufacturing Order view. And here is my choices
Solution 1:

Create a new view which inherited from Manufacturing Order view. 

Then use the same model 'mrp.production' as the parent view for calculating. 

However, if I add my logic for calculating in my new view, it changes the logic of the parent view also 

=> It's not my choice

Solution 2:

Create a new view with new model named 'mrp.production.cal', which is prototype inheritance model of 'mrp.production' model. Then I can add my calculation logic to the new model.

However, when I try to create and click 'Save' button. And I don't really know the reason. 

The error shows as below

Odoo Server Error - Validation Error

×The operation cannot be completed, probably due to the following:
- deletion: you may be trying to delete a record while other records still reference it
- creation/update: a mandatory field is not correctly set

[object with reference: Production Order - mrp.production]


Here is my source code for solution 2:

class MrpProductionCalculation(models.Model):
_inherit = 'mrp.production'
_name = 'mrp.production.cal'

Am I doing the right way?

Thanks for any help!

UPDATE:
The details error is
odoo.sql_db: bad query: b'INSERT INTO "stock_move" ("id", "create_uid", "create_date", "write_uid", "write_date", "additional", "company_id", "date", "date_expected", "group_id", "is_done", "location_dest_id", "location_id", "name", "origin", "picking_type_id", "priority", "procure_method", "product_id", "product_uom", "product_uom_qty", "production_id", "propagate", "scrapped", "sequence", "state", "to_refund", "warehouse_id") VALUES (nextval(\'stock_move_id_seq\'), 2, (now() at time zone \'UTC\'), 2, (now() at time zone \'UTC\'), false, 1, \'2019-06-12 04:04:58\', \'2019-06-12 04:04:58\', 23, false, 12, 7, \'WH/MO/00023\', \'WH/MO/00023\', 18, \'1\', \'make_to_stock\', 28, 1, \'10.000\', 13, false, false, 10, \'draft\', false, 1) RETURNING id'
ERROR: insert or update on table "stock_move" violates foreign key constraint "stock_move_production_id_fkey"
DETAIL: Key (production_id)=(13) is not present in table "mrp_production".
​

0
Avatar
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Gerelateerde posts Antwoorden Weergaven Activiteit
MRP for Job Shop Fabricator
mrp
Avatar
Avatar
1
mrt. 26
1359
Odoo 17 Bom can't import with Produit / ID externe
mrp
Avatar
Avatar
Avatar
2
aug. 25
3149
Can't inherit base.view_partner_form of res.partner
inheritance
Avatar
Avatar
Avatar
Avatar
Avatar
4
feb. 25
5897
Include in inherit from JS class
inheritance
Avatar
Avatar
1
aug. 24
4072
How to Override a method in parent class in JS Opgelost
inheritance
Avatar
Avatar
2
nov. 24
5719
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Partner worden
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo is een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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