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

Problem with module in V7 and other in V8

S'inscrire

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

Cette question a été signalée
performancev8modulefieldsv7
3831 Vues
Avatar
Algode

I have a Module1 in V7, this is part of the code, when call a function of Module2 in V8:

#--Code in Module1 
class calc_hours_employees(models.Model): _name = 'calc.hours.employees' _description = 'Somes computes' employees_ids = fields.Many2many('hr.employee', 'hr_employee_calcs_rel', 'calcs_id', 'employee_id', 'Funcionarios')
   def compute_sheet(self, cr, uid, ids, context=None): emp_pool = self.pool.get('hr.employee') ext_pool = self.pool.get('hr.py.calc.hours') run_pool = self.pool.get('hr.py.calc.hours.run') ext_ids = [] if context is None: context = {} data = self.read(cr, uid, ids, context=context)[0] run_data = {} if context and context.get('active_id', False): run_data = run_pool.read(cr, uid, [context['active_id']], ['date_start', 'date_end'])[0] from_date = run_data.get('date_start', False) to_date = run_data.get('date_end', False)
        if not data['employees_ids']:     raise osv.except_osv(_("Warning!"), _("Select one, please"))
        for emp in emp_pool.browse(cr, uid, data['employees_ids'], context=context)
           ext_data = ext_pool.do_employee(cr, uid, [], 2, emp.id, from_date, to_date, emp.department_id, emp.id_inter, contract_id=False, context=context     
            res = {     
                'employee': emp.id,     
                'office': emp.department_id.name,     
                'matricu': emp.id_inter,     
                'date_from': from_date,      
                'date_to': to_date,     
                'calcs_run_ids': context.get('active_id', False),      
            }     ext_ids.append(ext_pool.create(cr, uid, res, context=context)
    return {'type': 'ir.actions.act_window_close'}

And this is a part of code that have the function do_employee():

#--Part of code in Module2  
class hr_py_calc_hours(models.Model): _name = 'hr.py.calc.hours'

employee = fields.Many2one('hr.employee', string='Employee', required=True)
hor_repo = fields.Float('Hor Repo', digits=(16,2), default=0.0)
#####have more fields but not is necesary for the example :)
....
    @api.multi
    @api.onchange('employee')
    def do_employee(self, type_calc=1, emp_id=False, from_date=False, to_date=False, emp_off=False, emp_matr=False, contract_id=False, context=None):     def _do_create(date1,turnid,ent,sal,work,rep,abse,ear,bef,att,ad30,ex50,ex100,hours_to_create):     hours_to_create += [((0,0,{'date_work':date1,'turno_id':turnid,'entrad':ent,'salida':sal,'times_worked':work,'repose':rep,'absence':abse,'early':ear, 'before':bef,'attestation':att,'adic_30':ad30,'ext_50':ex50,'ext_100':ex100}))]
....
        if not type_calc==1:     repo = self.get('hor_repo',0) ############ HERE ARE THE PROBLEM self.write({'hor_repo': repo + ocho}) else: self.hor_repo += ocho datew += timedelta(days=1)
.....

The function of Module2 need can execute from the onchange employee, and need can execute from the Module1. 

I need the value of hor_repo for increase this at one to somes computes, them i need take the value at the moment in the field an increase this. 

I see in many parts from google but all is only for V7 or only for V8. How can solve this problem ? 


Posd.: This module is similar to performance of the payslip, need can do only for a employee(as module hr.payslip) or for more that one in the same time(as module hr.payslip.run). 


Edit: Nothing ?





0
Avatar
Ignorer
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é
Can V7 and V8 code coexist in the same .py file? Résolu
v8 fields v7 api
Avatar
Avatar
1
mars 15
4791
Problem to write datas in field
v8 module field v7 write
Avatar
0
juin 15
3934
Loading wrong configuration file? Résolu
v8 v7
Avatar
Avatar
1
avr. 15
9357
"No handler found" - CRITICAL ? openerp.modules.module - How to downgrade/uninstall a module in command line?
module v7
Avatar
Avatar
1
mars 15
7810
new module doesn't show in module list? Résolu
module v7
Avatar
Avatar
Avatar
3
déc. 23
30762
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