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

disable the existing views buttons when inherit a account_move_views.xml

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
accountinginheritstatesodoo18
3 Replies
2636 Tampilan
Avatar
Kalana Piyumantha
 This is my model and form view, I want to inherit account_move_views.xml(accounting->customer->invoice form view) with these 3 buttons, But existing module buttons are there, i want to disable those existing buttons, and also new status 'waiting' status should be visible in draft, waiting and post status too, but except waiting status, these waiting status is not visible? i want to fix this too? how? how can i modify both files??

from odoo import models, fields, api, _
from odoo.exceptions import UserError


class AccountMove(models.Model):
_inherit = 'account.move'

state = fields.Selection(
selection=[
('draft', 'Draft'),
('waiting_approval', 'Waiting For Approval'),
('posted', 'Posted'),
('cancel', 'Cancelled'),
],
string='Status',
required=True,
readonly=True,
copy=False,
tracking=True,
default='draft',
)

def action_send_for_approval(self):
"""Send invoice for approval"""
for record in self:
if record.move_type not in ('out_invoice', 'out_refund'):
raise UserError(_("Only customer invoices can be sent for approval."))
if record.state != 'draft':
raise UserError(_("Only Draft Invoices can be sent for approval"))
record.state = 'waiting_approval'
return True

def action_approve_invoice(self):
"""Approve invoice and post it"""
# Check if user has permission to approve
if not self.env.user.has_group('account.group_account_manager'):
raise UserError(_('Only Accounting managers can Send this to approval Stage'))

for record in self:
if record.state != 'waiting_approval':
raise UserError(_('Only Invoices waiting for approval Can Be approved.'))

# Post the Invoice
# record.action_post()
record.state = 'posted'

if record.partner_id and record.partner_id.email:
record._send_approval_email()

return True

def _send_approval_email(self):
"""Send email notification to customer"""
template = self.env.ref('vkd_accounting_approval_process.email_template_invoice_approved',
raise_if_not_found=False)
if template:
template.send_mail(
self.id,
force_send=True,
email_layout_xmlid='mail.mail_notification_light'
)

def action_draft(self):
res = super().action_draft()
for record in self:
if record.state == 'waiting_approval':
record.state = 'draft'
return res

@api.model
def _get_mail_template(self):
return self.env.ref('vkd_accounting_approval_process.invoice_approval_email', raise_if_not_found=False),<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- _inherit_approval-->
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form.inherit.vkd_accounting_approval_process</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">

<xpath expr="//form/header" position="inside">

<button name="action_send_for_approval" string="Send For Approval" type="object" class="btn-primary"
invisible="state != 'draft'"/>
<button name="action_approve_invoice" string="Approve Invoice" type="object" class="btn-success"
groups="account.group_account_manager" invisible="state != 'waiting_approval'"/>
<button name="action_draft" string="Send to Draft" type="object" class="btn-secondary"
invisible="state != 'waiting_approval'"/>
</xpath>
</field>
<!-- Add approval information in form -->
</record>
</odoo>
0
Avatar
Buang
Avatar
D Enterprise
Jawaban Terbai

Hii,
Updated XML:
<?xml version="1.0" encoding="UTF-8"?>

<odoo>

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

        <field name="name">account.move.form.inherit.vkd_accounting_approval_process</field>

        <field name="model">account.move</field>

        <field name="inherit_id" ref="account.view_move_form"/>

        <field name="arch" type="xml">


            <!-- Override the statusbar to include 'waiting_approval' -->

            <xpath expr="//field[@name='state']" position="attributes">

                <attribute name="widget">statusbar</attribute>

                <attribute name="statusbar_visible">draft,waiting_approval,posted</attribute>

                <attribute name="readonly">1</attribute>

            </xpath>


            <!-- Remove default buttons -->

            <xpath expr="//form/header/button[@name='action_post']" position="attributes">

                <attribute name="invisible">1</attribute>

            </xpath>

            <xpath expr="//form/header/button[@name='button_draft']" position="attributes">

                <attribute name="invisible">1</attribute>

            </xpath>

            <xpath expr="//form/header/button[@name='button_cancel']" position="attributes">

                <attribute name="invisible">1</attribute>

            </xpath>


            <!-- Add custom buttons -->

            <xpath expr="//form/header" position="inside">

                <button name="action_send_for_approval"

                        string="Send for Approval"

                        type="object"

                        class="btn-primary"

                        attrs="{'invisible': [('state', '!=', 'draft')]}"/>

               

                <button name="action_approve_invoice"

                        string="Approve Invoice"

                        type="object"

                        class="btn-success"

                        groups="account.group_account_manager"

                        attrs="{'invisible': [('state', '!=', 'waiting_approval')]}"/>

               

                <button name="action_draft"

                        string="Send to Draft"

                        type="object"

                        class="btn-secondary"

                        attrs="{'invisible': [('state', '!=', 'waiting_approval')]}"/>

            </xpath>


        </field>

    </record>

</odoo>

 i hope it is use full

0
Avatar
Buang
Avatar
Kalana Piyumantha
Penulis Jawaban Terbai
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- _inherit_approval-->
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form.inherit.vkd_accounting_approval_process</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_post']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//form/header" position="inside">
<button name="action_send_for_approval" string="Send For Approval" type="object" class="btn-primary"
invisible="state != 'draft'"/>
<button name="action_approve_invoice" string="Approve Invoice" type="object" class="btn-success"
groups="account.group_account_manager" invisible="state != 'waiting_approval'"/>
<button name="action_draft" string="Send to Draft" type="object" class="btn-secondary"
invisible="state != 'waiting_approval'"/>
</xpath>
</field>
</record>

</odoo> Updated view, this part is also i have, please look at my code, Nothing happen, same issue( I am a beginner)
0
Avatar
Buang
Cybrosys Techno Solutions Pvt.Ltd

Try the following code.

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<!-- _inherit_approval-->
<record id="view_move_form" model="ir.ui.view">
<field name="name">account.move.form.inherit.vkd_accounting_approval_process</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='action_post']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//button[@name='action_post']" position="after">
<button name="action_send_for_approval" string="Send For Approval" type="object" class="btn-primary"
invisible="state != 'draft'"/>
<button name="action_approve_invoice" string="Approve Invoice" type="object" class="btn-success"
groups="account.group_account_manager" invisible="state != 'waiting_approval'"/>
<button name="action_draft" string="Send to Draft" type="object" class="btn-secondary"
invisible="state != 'waiting_approval'"/>
</xpath>
</field>
</record>
</odoo>

Please ensure that the path of the file is correctly added in the manifest file.

Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,


1- To disable the existing button in 'account.move', try the following.

<record id="view_move_view_form" model="ir.ui.view">
<field name="name">account.move.view.form.inherit</field>
<field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//button[@name='button_name']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>


2- To add 'waiting' state.

class AccountMove(models.Model):
"""The model account move is inherited for adding new state"""
_inherit = 'account.move'

state = fields.Selection(
selection_add=[
('draft', 'Draft'),
('waiting', 'Waiting'),
('posted', 'Posted')
],
default='draft',
)

Upgrade the module after making the changes.


Hope it helps

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
Issue with the "Pay" Button Visibility After Full Invoice Payment in Odoo
accounting odoo18
Avatar
Avatar
Avatar
2
Agu 25
2362
Inherit the menu item or action act window in odoo 18
menuitem inherit odoo18
Avatar
Avatar
1
Nov 25
236
Issue with CybroSys Modules Showing as Uninstallable in Odoo 18
accounting Cybrosys odoo18
Avatar
Avatar
1
Mar 25
2788
Field create_asset is not specified, but when doing so, it says the field is invalid
accounting localization schema odoo18
Avatar
Avatar
1
Jun 25
1597
How to add a new column in the General ledger?
accounting reporting generalledger odoo18
Avatar
0
Jun 25
136
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