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
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • 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
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • 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

vendor bills generation from the custom module

Subscriure's

Get notified when there's activity on this post

This question has been flagged
modulecustomvendorbilling
5 Respostes
7466 Vistes
Avatar
Dreamy

Hello Experts,    

I am trying to generate vendor bills from the custom module. but code is inserting/creating bills in the customer invoice.  Following is the code which i am using. Can you please guide where i am doing wrong.

@api.multi

    def create_invoices(self):

        self.state = 'create_invoices'

        inv_obj = self.env['account.invoice']

        inv_line_obj = self.env['account.invoice.line']

        vendor = self.vendor_id

        if not vendor.name:

            raise UserError(

                _(

                    'Please select a Vendor Name.'))

        company_id = self.env['res.users'].browse(1).company_id

        currency_value = company_id.currency_id.id

        self.ensure_one()

        ir_values = self.env['ir.values']

        journal_id = ir_values.get_default('cust.mod', 'invoice_journal_type')

        if not journal_id:

            journal_id = 1


        inv_data = {

            'name': vendor.name,

            'reference': self.name,

            'account_id': vendor.property_account_payable_id.id,

            'partner_id': vendor.id,

            'currency_id': currency_value,

            'journal_id': journal_id,

            'origin': self.name,

            'company_id': company_id.id,

        }

        inv_id = inv_obj.create(inv_data)

        for records in self.cust_line:

            if records.exp_id.product_id :

                expense_account = records.exp_id.product.property_account_expense_id.id

            if not expense_account:

                raise UserError(_('There is no expense account defined for this product: "%s".') %

                                (records.exp_id.product.name,))


            inv_line_data = {

                'name': records.exp_id.product.name,

                'account_id': expense_account,

                'price_unit': records.amount,

                'quantity': 1,

                'product_id': records.exp_id.product.product_id,

                'invoice_id': inv_id.id,

            }

            inv_line_obj.create(inv_line_data)

in xml using button code to generate vendor bill.

1
Avatar
Descartar
Avatar
Mitul Shingala
Best Answer

Hello, 

pass the type of the invoice while you create invoice.

see into below dictionary.

 inv_data = {
'type': 'in_invoice',
            'name': vendor.name,
            'reference': self.name,
            'account_id': vendor.property_account_payable_id.id,
            'partner_id': vendor.id,
            'currency_id': currency_value,
            'journal_id': journal_id,
            'origin': self.name,
            'company_id': company_id.id,
        }
1
Avatar
Descartar
Hashim Khalid

what if i want to add lines to invoice lines !!!!!!!!!

Mitul Shingala

into inv_data dictionary add the key and value like

{'invoice_line_ids': [(0, 0, inv_line_vals)]

Avatar
subbarao
Best Answer

you missed type field In Invoice Data .

'type': 'in_invoice'  means Vendor bill
'type': 'out_invoice' means Customer Invoice

By default it's  'out_invoice', so it's creating Customer Invoice

1
Avatar
Descartar
Avatar
yasir iqbal
Best Answer


 inv_data = {
'type': 'in_invoice',
            'name': vendor.name,
            'reference': self.name,
            'account_id': vendor.property_account_payable_id.id,
            'partner_id': vendor.id,
            'currency_id': currency_value,
            'journal_id': journal_id,
            'origin': self.name,
            'company_id': company_id.id,

create a vender bill from purchase order
please tell me the answer as soon as possible.?



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
Vendor Bill Print Customization
print custom vendor billing
Avatar
0
d’oct. 18
4374
Custom Module Not Populating in Apps List Solved
module custom
Avatar
Avatar
4
d’oct. 20
9954
Vendor invoicing with multiple currencies
currency vendor billing
Avatar
0
de maig 24
2122
For Odoo hosted version, how would I upload a custom module? Solved
module upload custom
Avatar
Avatar
Avatar
Avatar
3
de febr. 24
11555
importing custom module
module custom importing
Avatar
Avatar
1
de nov. 23
3868
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