Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing-
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Problems of synchronisation between datas and BDD

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
databaseproblemloyaltyodoocoupon
1 Antworten
4039 Ansichten
Avatar
Matthieu

Hi, I started a few weeks ago with odoo 9 and now, I'm building a module that inherit from point of sales : A loyalty module. One of the things I want to realize is a reduction coupon system (physical tickets with a code that is entered in the sale interface and recognized as a determined amount of reduction).

So, the class of coupons is :

class loyalty_coupon(osv.osv):
    _name = 'loyalty.coupon'
    _columns = {
        'name':                 fields.char('Name', size=32, select=1, required=True, help='An internal identification for this loyalty coupon'),
        'loyalty_program_id':   fields.many2one('loyalty.program', 'Loyalty Program', help='The Loyalty Program this coupon belongs to'),
        'reduction':       fields.float('Reduction', help='The amount of reduction of this coupon in EUR'),
        'date':                 fields.date('Date Limit', help='The date limit of the coupon'),
        'used':           fields.boolean('Used',        help='The state of the coupon, used or not used'),
        'commande':         fields.many2one('pos.order', 'Order', help="If used, it's the order this coupon belongs to"),
    }

    _defaults = {
        'used': False,
        'date': datetime.date.today(),
    }

But my problem is in the sale interface where I use this function :

var _super = models.Order;
models.Order = models.Order.extend({
...
    apply_coupon: function(coupon){
...
        for (var i = 0; i < this.pos.loyalty.coupons.length; i++) {
            if (coupon.reduction === this.pos.loyalty.coupons[i].reduction && coupon.name === this.pos.loyalty.coupons[i].name) {
                this.pos.loyalty.coupons[i].used = true;
            }
        }
...
     }
...
}

In the interface, the coupon "used" attribute is right passed to true where the coupon is used.

But, when I'm looking to views or the database or also when I refresh the page, the coupon is unused ('used' = false).

I did lots of research and I understood that I need to synchronize datas in the interface with real datas in the database. The problem is that I don't know how to do this.

Sorry for potentials mistakes in English and thank you in advance for your help !

Matthieu.

0
Avatar
Verwerfen
Avatar
Matthieu
Autor Beste Antwort

Ok I've seen that with openerp 7, we could use the function fetch to access database :

fetch: function(model, fields, domain, ctx){

return new instance.web.Model(model).query(fields).filter(domain).context(ctx).all()

},

But my js file start with :

odoo.define('pos_loyalty.pos_loyalty', function (require) {

"use strict";

As a consequence, instance is not defined and I can't use fetch.


Is there any equivalent for Odoo 9 ?

Maybe, this could be the solution I'm searching ?

0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
clean purchase history
database odoo
Avatar
Avatar
1
März 24
2549
How to hide loyalty point Balance on POS Odoo 16?
loyalty odoo
Avatar
0
Mai 23
2234
How can I recover ownership? Gelöst
database odoo
Avatar
Avatar
1
Feb. 23
2856
Odoo database failed Gelöst
database odoo
Avatar
Avatar
1
Dez. 22
12814
Edit Company data Powered by Odoo Gelöst
database odoo
Avatar
Avatar
6
Juni 15
8779
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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