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

The operation cannot be completed: another model requires the record being deleted. If possible, archive it instead. Model: product.enquiry (product.enquiry), Constraint: product_enquiry_product_id_fkey

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
constraintsconstrainterrorv14
5 Odpowiedzi
48980 Widoki
Awatar
Selva KD

I am getting this following error

The operation cannot be completed: another model requires the record being deleted. If possible, archive it instead. Model: product.enquiry (product.enquiry), Constraint: product_enquiry_product_id_fkey

# Product Enquiry Model
class ProductEnquiryModel(models.Model):
    _name = "product.enquiry"

    def name_get(self):
        result = []
        for enquiry in self:
            result.append((enquiry.user_id.id, enquiry.user_id.farmer_name))
            
        return result

    product_id = fields.Many2one("retailer.products", string = "Product ID")
    member_id = fields.Char(string = "Member ID", required=True)
    enquired_at = fields.Datetime('Enquired At', readonly=True)
    retailer_id = fields.Many2one("res.partner.retailer", string = "Retailer")


# Retailer Products Model
class RetailerProductsModel(models.Model):
    _name = "retailer.products"
    
    def name_get(self):
        result = []
        for product in self:
            result.append((product.product_id.id, product.product_id.name))
            
        return result

    @api.onchange('product_id')
    def getProductInfo(self):
        if self.product_id:
            self.category_id = self.product_id.categ_id
            self.sub_category_id = self.product_id.sub_category_id
            self.selling_price = self.product_id.list_price
            self.name = self.product_id.name
    
    @api.model
    def create(self, vals):
        if 'is_offer' in vals and vals['is_offer'] == True:
            offers = self.env['product.offers'].create({
                'name': vals['offer_type'],
                'value': vals['value'],
                'offer_type': vals['offer_type'],
            })
            vals['offer_id'] = offers.id
            
        result = super(RetailerProductsModel, self).create(vals)
        return result

    name = fields.Char("Product Name")
    retailer_id = fields.Many2one("res.partner.retailer", string = "Retailer")
    product_id = fields.Many2one("product.template", string = "Product", ondelete='cascade', )
    is_offer = fields.Boolean(string = "Offer")
    offer_id = fields.Many2one("product.offers", string = "Offer")
    selling_price = fields.Float("Price")
    min_qty = fields.Integer("Minimum Quantity")
    max_qty = fields.Integer("MaximumQuantity")
    category_id = fields.Many2one("product.category", string = "Product Category", required=True)
    sub_category_id = fields.Many2one("product.sub.category", string="Product Sub Category")
    offer_type = fields.Selection([
        ('flat_discount', 'Flat Discount'),
        ('percentage', 'Percentage'),
        ],
        'Offer Type')
    value = fields.Float(string="Value")
    retailer_product_multilingual_ids = fields.One2many('product.master.multilingual', 'retailer_product_multilingual_id', string='Data for Multilingual')

    

0
Awatar
Odrzuć
Awatar
Md. Sajib Ali
Najlepsza odpowiedź

here is the example :



0
Awatar
Odrzuć
Awatar
Estain Makaudze
Najlepsza odpowiedź

Not Related to This Question but l had same problem too

In my case it was caused by calling a Many2one field and passing a value id which is not available in the Many2one table on create function, ie

self.env['claims_payments.model'].create({
'product_id':6,
'claim_pay_qoute':repaires_qoutes,
})

Therefore look around if you not passing a value which is not in a database you are referring to.

0
Awatar
Odrzuć
Awatar
David Bacter
Najlepsza odpowiedź

Hi Selva KD ,

Have you solved this issue?

The problem that I had was because I didn't update the module before using the fields.


0
Awatar
Odrzuć
Awatar
Begineer
Najlepsza odpowiedź

Hi,

You are creating the model "product.offers" in your create function,

I hope the error is because , data for  some mandatory field or fileds in model product.offers  is not being passed in def create function

Check  for the required=True fields in model product.offers  and check whether you have passed the data in your create function.

Hope it helps

Thanks

0
Awatar
Odrzuć
Awatar
Mai Pham
Najlepsza odpowiedź

The error already told the cause: There are some records which has fields linked to the record you are trying to delete. Just find them and unlink, or as Odoo suggest, you archive it instead of delete the record.

-9
Awatar
Odrzuć
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ść
Is there any way to identify from an api.constrain if the change comes from the UI? (Odoo 14)
constraints v14
Awatar
Awatar
1
lip 23
2567
Odoo14 alternative for Automated Translations through Gengo API module
v14
Awatar
Awatar
Awatar
Awatar
3
wrz 25
3501
Odoo Community v14 Slow on High-End Servers, Fast on i5/i7 PCs
v14
Awatar
0
sie 25
972
How to Managing Birthdate and Age in Odoo
v14
Awatar
Awatar
1
sie 25
3297
Update Initial Stock of Product using XMLRPC API [Odoo14] Rozwiązane
v14
Awatar
Awatar
Awatar
2
lip 25
8902
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