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
    • eLearning
    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
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for 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

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
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

Problems of synchronisation between datas and BDD

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
databaseproblemloyaltyodoocoupon
1 Beantwoorden
4037 Weergaven
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
Annuleer
Avatar
Matthieu
Auteur Beste antwoord

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
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
clean purchase history
database odoo
Avatar
Avatar
1
mrt. 24
2548
How to hide loyalty point Balance on POS Odoo 16?
loyalty odoo
Avatar
0
mei 23
2228
How can I recover ownership? Opgelost
database odoo
Avatar
Avatar
1
feb. 23
2851
Odoo database failed Opgelost
database odoo
Avatar
Avatar
1
dec. 22
12807
Edit Company data Powered by Odoo Opgelost
database odoo
Avatar
Avatar
6
jun. 15
8774
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
  • Word een Partner
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 ภาษาไทย 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