Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Real Estate
    • Real Estate Agency
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consulting
    • Accounting Firm
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Solar Energy Systems
    • Shoe Maker
    • Serveis de neteja
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Take the value in res.company (company_registry) in Odoo 15

Subscriure's

Get notified when there's activity on this post

This question has been flagged
res.partnercompanyres.company
2 Respostes
2604 Vistes
Avatar
Aprilia Zahratunnisa

I want to take the values that have been filled in in res.company and display them in res.partner (Customes - Sales). so I added a new field. and want to display the company_registry according to the one in res.company. but I'm always wrong. Please help me...


from odoo import models, fields, api
class ResPartner(models.Model):    _inherit = 'res.partner'
    company_registry = fields.Char(string='Company Registry', compute='_compute_company_registry', store=True)
    @api.depends('company_id')    def _compute_company_registry(self):        for partner in self:            # Get the company_registry from the related company            partner.company_registry = partner.company_id.company_registry if partner.company_id else False
    @api.onchange('company_id')    def _onchange_company_id(self):        for partner in self:            if partner.is_company and partner.company_id:                partner.company_registry = partner.company_id.company_registry            else:                partner.company_registry = False
    @api.model    def create(self, vals):        # If a company is set, get its company_registry        if vals.get('is_company') and vals.get('company_id'):            company = self.env['res.company'].browse(vals['company_id'])            vals['company_registry'] = company.company_registry if company else False
        return super(ResPartner, self).create(vals)
    def write(self, vals):        # If the company_id is changed, update the company_registry        if 'company_id' in vals:            company = self.env['res.company'].browse(vals['company_id'])            if company:                vals['company_registry'] = company.company_registry            else:                vals['company_registry'] = False
        return super(ResPartner, self).write(vals)


0
Avatar
Descartar
Avatar
Aprilia Zahratunnisa
Autor Best Answer

the code runs. but the flow is if you make a quotation in Sales with a customer according to the one in the company, then the sequence format is 'company_registry-sequence'. When I save the quotation, the company_registry doesn't appear instead it has ''00-00001'. In Companies, I have filled in the company_registry.

0
Avatar
Descartar
Avatar
Niyas Raphy (Walnut Software Solutions)
Best Answer

Hi,
The code seems to be fine, what it does is, if you add a contact/customer and set the company for the contact, the company_registry field will be filled by the company_registry inside the company

Is it not working like this ?

Thanks

0
Avatar
Descartar
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Registrar-se
Related Posts Respostes Vistes Activitat
How can i detect partner created from company Solved
res.partner res.company
Avatar
Avatar
1
de nov. 22
5278
Odoo13 How to add properly a constraint to an existing field in res.partner?
vat res.partner res.company
Avatar
Avatar
3
d’abr. 20
11588
How to delete a company, remove it from the database?
res.partner company delete base
Avatar
Avatar
1
de maig 21
10548
How to add data to res.partner fields for multiple companies via API
res.partner res.user res.company company_id
Avatar
0
de des. 20
6391
How to Select my company bak accounts on partner? Solved
invoice res.partner bank company
Avatar
Avatar
2
de jul. 20
4108
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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