Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

Create a new invoice sequence

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
pythoninvoicexmlsequence
3 Replies
8361 Tampilan
Avatar
Mostafa Mohamed Abdel Monaem

Hi there i'm creating a module to make 2 kinds of invoice with 2 different sequence ...first one with tax and the other with out 

i create a Boolean field to check the kind of invoice and when i press Validate i got that error 


ValueError: "invoice_validate() takes at least 4 arguments (4 given)" while evaluating
u'invoice_validate()'


here is my module code 

the .py file 

from openerp import models, fields, api

class invoice_edits(models.Model):

_inherit = 'account.invoice'
state_bool = fields.Boolean(string='Active Tax', default=True)



def invoice_validate(self, cr, uid, vals, context=None):
if context is None:
context = {}
if vals.get('state_bool') == True:
vals['number'] = self.pool.get('ir.sequence').get(cr, uid, 'sequence_sale_tax') or '/'
if vals.get('state_bool') == False:
vals['number'] = self.pool.get('ir.sequence').get(cr, uid, 'sequence_sale_without_tax') or '/'
res = super(invoice_edits, self).invoice_validate(cr, uid, vals, context=context)
return res



invoice_edits()

and here is my view xml file 



<openerp>
<data>

<record model="ir.ui.view" id="net2do_invoice_edits_form_inherit">

<field name="name">account.invoice.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<data>
<xpath expr="//field[@name='account_id']" position="after">
<field name="state_bool" attrs="{'readonly': [('state', '=', 'open')]}"/>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

and here is my sequence file 



<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">

<record id="sequence_sale_tax" model="ir.sequence">
<field name="name">Account Tax</field>
<field eval="1" name="padding"/>
<field name="prefix">SAJ/%(year)s/</field>
</record>

<record id="sequence_sale_without_tax" model="ir.sequence">
<field name="name">Account Default Sales Journal</field>
<field eval="1" name="padding"/>
<field name="prefix">JAS/%(year)s/</field>
</record>
</data>
</openerp>

may i have some help please ?

0
Avatar
Buang
Avatar
Estudios, Procesos y Sistemas
Jawaban Terbai

Try this

This code works for us :)

def invoice_validate(self, cr, uid, ids, context=None):
    for invoice in self.browse(cr, uid, ids, context=context):
        try:
            if not invoice.custom_field:
                raise openerp.exceptions.Warning("Custom error")
        except ValueError:
            raise openerp.exceptions.Warning("Custom")
    super(account_invoice,self).invoice_validate(cr, uid, ids, context=context)

0
Avatar
Buang
Avatar
Bole
Jawaban Terbai

1. You declared different class, invoice_edits, so calling super to invoice_validate makes no sense.. 
declare account_invoice class ( and _inherit = 'account.invoice') 

2. overriding invoice_validate method does nothing, since the original method only writes state=open and has nothing to do with selecting sequence for invoice...

Maybe the easiest way to achieve what you want.. is to define 2 different journals, and assign different number sequences to each journal... that way, you can easily add more sequences/journals, and define the sequence simply by selecting appropriate journal before validating invoice... no coding needed at all for it.. or, if you want you can code come check on selected journal.. 

0
Avatar
Buang
Avatar
Sander Kruger
Jawaban Terbai

The invoice_validate function of account.invoice takes only 1 arguments (self). This function is called from account_invoice_workflow.xml with only 1 argument.

You override the function with a different signature, just like the purchase and portal_sale modules do. But I think you also need to rework the workflow XML document.

0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
How to Customize Reporting > Invoices Analysis > Dashboard in odoo v8?
python invoice xml dashboard
Avatar
0
Okt 15
4295
How to change Invoice sequence via xml in Odoo 15 or newer?
invoice sequence
Avatar
0
Sep 24
2089
Odoo 17.1 - How to never reset invoice number
invoice sequence
Avatar
Avatar
2
Mar 24
3993
2 sequence combing for multiple company Diselesaikan
purchase python xml sequence v14
Avatar
Avatar
Avatar
2
Okt 23
3811
How to select manually a sequence for an invoice? Diselesaikan
invoice sequence
Avatar
Avatar
2
Feb 23
4620
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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