Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

How to generate error depending to fields ( Its URGENT PLZ)

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
pythonodooodoo10
7 Réponses
4543 Vues
Avatar
Boutaina AS

Hi community , its so urgent Plz

I had add a boolean field in 'product.product' named 'is_dmp'. so , i want that if I try to add an artcile who have this field false in purchase order , a warning message appear . 

so this what i did :

--------------------------------------------------------------------------------------------------------------------------

from odoo import api, models

from odoo import fields

from odoo.exceptions import UserError

class product_product(models.Model):

_name = 'product.product'

_inherit = 'product.product'

is_dmp = fields.Boolean(help='Est ce que cet articles doit avoir un certificat d enregistrement', string='Necessite un enregistrement')

dmp = fields.Char('Numéro de certificat')

# purchase_ok = fields.Boolean(compute='_check_dmp'),

class PurchaseOrderLineWar(models.Model):

_name = "product.product"

_inherit = "product.product"

@api.onchange('dmp')

def _check_dmp(self):

if self.is_dmp == False:

warning_mess = {

'title': _('Warnnnnning'),

'message' : _('Attention cet article ne necessite pas un certifact DMP'),

}

return {'warning': warning_mess}  

-----------------------------------------------------------------------------------------------------------------------


Plz any idea , i need help .

0
Avatar
Ignorer
Sudhir Arya (ERP Harbor Consulting Services)

Do you want to show warning when user selects a product in purchase order line?

Sudhir Arya (ERP Harbor Consulting Services)

Now its work , thank you 


Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Meilleure réponse

You have inherited wrong object in PurchaseOrderLineWar class.

I think you should inherit "purchase.order" or "purchase.order.line" object.

If you want to show a warning message when user selects a product in purchase order line, you should use following code:

class PurchaseOrderLine(models.Model):
    _inherit = 'purchase.order.line'

    @api.onchange('product_id')
    def change_product(self):
        if self.product_id and self.product_id.is_dmp:
            msg = {
                'title': 'Warning',
                'message': 'Your warning message.'
            }
            return {'warning': msg}

This way you can show a warning message when user selects product in purchase order line and product does not have is_dmp boolean if False.

Sudhir Arya
ERP Harbor Consulting Services
s:sudhir@erpharbor.com  w: http://www.erpharbor.com
5
Avatar
Ignorer
Boutaina AS
Auteur

Yes, exectly , I want to show warning when user selects a product that have is_dmp True in purchase order line?

Boutaina AS
Auteur

Im sorry i past a wrong code in my question hhh , i will edit it with the right one

Boutaina AS
Auteur

Hi community , its so urgent Plz

I had add a boolean field in 'product.product' named 'is_dmp'. so , i want that if I try to add an artcile who have this field false in purchase order , a warning message appear .

so this what i did :

--------------------------------------------------------------------------------------------------------------------------

from odoo import api, models

from odoo import fields

from odoo.exceptions import UserError

class product_product(models.Model):

_name = 'product.product'

_inherit = 'product.product'

is_dmp = fields.Boolean(help='Est ce que cet articles doit avoir un certificat d enregistrement', string='Necessite un enregistrement')

dmp = fields.Char('Numéro de certificat')

class PurchaseOrderLineWar(models.Model):

_name = 'purchase.order.line'

_inherit = 'purchase.order.line'

@api.onchange('order_line.product_id')

def _check_dmp(self):

print 'HHHHHHHHHHHHHHHHHHHHHHHHHHHH'

for a in self.order_line:

if a.product_id.is_dmp == True:

raise UserError(_("Please Select Goods your mesage"))

-----------------------------------------------------------------------------------------------------------------------

Plz any idea , i need help .

Sudhir Arya (ERP Harbor Consulting Services)

Just try the code which is in my answer. It will work for you.

Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
When department is changed employee rule is not working without restarting server in odoo Résolu
python odoo odoo10
Avatar
Avatar
1
août 20
3507
How to set "email_to" in email template dynamically
python odoo odoo10
Avatar
Avatar
Avatar
5
déc. 19
12694
[Solved] Make One2many readonly when session is over Résolu
python odoo odoo10
Avatar
Avatar
Avatar
4
janv. 19
5180
[Solved]How to calculate the value of float field in one2many field Résolu
python odoo odoo10
Avatar
Avatar
1
janv. 19
8626
[SOLVED] Invisible Button After Clicked Résolu
python odoo odoo10
Avatar
Avatar
Avatar
2
janv. 19
11282
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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