<?xml version="1.0"?>
<form string="Account Entry" js_class="account_move_form">
                    <header>
                        <!-- Post -->
                        <button name="action_post" string="Post" class="oe_highlight" type="object" groups="account.group_account_invoice" data-hotkey="q" context="{'validate_analytic': True, 'disable_abnormal_invoice_detection': False}" invisible="hide_post_button or move_type != 'entry'"/>
                        <button name="action_post" string="Confirm" class="oe_highlight" type="object" groups="account.group_account_invoice" data-hotkey="q" context="{'validate_analytic': True, 'disable_abnormal_invoice_detection': False}" invisible="hide_post_button or move_type == 'entry' or display_inactive_currency_warning"/>
                        <!-- Send (only invoices) -->
                        <button name="action_invoice_sent" type="object" string="Send" invisible="not display_send_button or not highlight_send_button" class="oe_highlight" data-hotkey="y"/>
                        <button name="action_invoice_sent" type="object" string="Send" invisible="not display_send_button or highlight_send_button" data-hotkey="y"/>
                        <button name="action_print_pdf" type="object" class="oe_highlight" invisible="state != 'posted' or is_being_sent or invoice_pdf_report_id or move_type == 'entry'" string="Print"/>
                        <button name="action_print_pdf" type="object" invisible="state != 'posted' or (not is_being_sent and not invoice_pdf_report_id)" string="Print"/>
                        <!-- Register Payment (only invoices / receipts) -->
                        <button name="action_register_payment" id="account_invoice_payment_btn" type="object" class="oe_highlight" invisible="(                                     state != 'posted'                                     or payment_state not in ('not_paid', 'partial', 'in_payment')                                     or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')                                     or invoice_has_outstanding                                 )" context="{'dont_redirect_to_payments': True, 'display_account_trust': True}" string="Pay" data-hotkey="g" groups="account.group_account_invoice"/>
                        <!-- Register Payment (only invoices / receipts, with outstanding payments) -->
                        <button name="action_register_payment" id="account_invoice_payment_secondary_btn" type="object" invisible="(                                     state != 'posted'                                     or payment_state not in ('not_paid', 'partial', 'in_payment')                                     or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')                                     or not invoice_has_outstanding                                 )" context="{'dont_redirect_to_payments': True, 'display_account_trust': True}" string="Pay" data-hotkey="g" groups="account.group_account_invoice"/>
                        <!-- Preview (only customer invoices) -->
                        <button name="preview_invoice" type="object" string="Preview" data-hotkey="o" title="Preview invoice" invisible="move_type not in ('out_invoice', 'out_refund') or state in ('draft', 'cancel')"/>
                        <!-- Reverse -->
                        <button name="294" string="Reverse Entry" type="action" groups="account.group_account_invoice" data-hotkey="z" invisible="move_type != 'entry' or state != 'posted' or payment_state == 'reversed'"/>
                        <button name="action_reverse" string="Credit Note" type="object" groups="account.group_account_invoice" invisible="move_type not in ('out_invoice', 'in_invoice') or state != 'posted'" data-hotkey="shift+n"/>
                        <!-- Cancel -->
                        <button name="button_cancel" string="Cancel Entry" type="object" groups="account.group_account_invoice" data-hotkey="x" invisible="not id or state != 'draft' or move_type != 'entry'"/>
                        <button name="button_cancel" string="Cancel" type="object" groups="account.group_account_invoice" data-hotkey="x" invisible="not id or state != 'draft' or move_type == 'entry'"/>
                        <button name="button_draft" string="Reset to Draft" type="object" groups="account.group_account_invoice" invisible="not show_reset_to_draft_button" data-hotkey="r"/>
                        <button name="button_hash" string="Lock" type="object" groups="account.group_account_invoice" invisible="not restrict_mode_hash_table or inalterable_hash or state != 'posted'"/>
                        <button string="Request Cancel" name="button_request_cancel" type="object" groups="account.group_account_invoice" invisible="state != 'posted' or show_reset_to_draft_button or not need_cancel_request" data-hotkey="w"/>
                        <!-- Review button -->
                        <button name="button_set_checked" class="btn btn-info" type="object" string="Reviewed" invisible="state != 'posted' or checked" groups="account.group_account_user"/>

                        <field name="state" widget="statusbar" statusbar_visible="draft,posted" groups="!account.group_account_secured"/>
                        <field name="state" widget="account_move_statusbar_secured" statusbar_visible="draft,posted" groups="account.group_account_secured"/>
                    </header>
                    <div class="alert alert-warning w-100 d-flex align-items-center gap-1" invisible="not duplicated_ref_ids" role="alert">
                        <span>Warning: this document might be a duplicate of</span>
                        <field name="duplicated_ref_ids" widget="x2many_buttons" string="Duplicated Documents" context="{'name_as_amount_total': True}"/>
                    </div>
                    <div class="alert alert-info" role="alert" invisible="not is_being_sent">
                        This invoice is being sent in the background.
                    </div>
                    <!-- Invoice outstanding credits -->
                    <div groups="account.group_account_invoice,account.group_account_readonly" class="alert alert-warning" role="alert" invisible="state != 'draft' or not tax_lock_date_message">
                        <field name="tax_lock_date_message" nolabel="1"/>
                    </div>
                    <div groups="account.group_account_invoice,account.group_account_readonly" class="alert alert-info" role="alert" invisible="move_type not in ('out_invoice', 'out_receipt') or not invoice_has_outstanding or payment_state not in ('not_paid', 'partial')">
                        You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding credits</a></bold> listed below for this customer.
                    </div>
                    <div groups="account.group_account_invoice,account.group_account_readonly" class="alert alert-info" role="alert" invisible="move_type not in ('in_invoice', 'in_receipt') or not invoice_has_outstanding or payment_state not in ('not_paid', 'partial')">
                        You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding debits</a></bold> listed below for this vendor.
                    </div>
                    <div groups="account.group_account_invoice,account.group_account_readonly" class="alert alert-info" role="alert" invisible="move_type != 'out_refund' or not invoice_has_outstanding or payment_state not in ('not_paid', 'partial')">
                        You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding debits</a></bold> listed below for this customer.
                    </div>
                    <div groups="account.group_account_invoice,account.group_account_readonly" class="alert alert-info" role="alert" invisible="move_type != 'in_refund' or not invoice_has_outstanding or payment_state not in ('not_paid', 'partial')">
                        You have <bold><a class="alert-link" href="#outstanding" role="button">outstanding credits</a></bold> listed below for this vendor.
                    </div>
                    <div class="alert alert-info" role="alert" invisible="state != 'draft' or auto_post != 'at_date'">
                        This move is configured to be posted automatically at the accounting date: <field name="date" readonly="1"/>.
                    </div>
                    <div class="alert alert-info" role="alert" invisible="state != 'draft' or auto_post == 'no' or auto_post == 'at_date'">
                         <field name="auto_post" readonly="1"/> auto-posting enabled. Next accounting date: <field name="date" readonly="1"/>.<span invisible="not auto_post_until"> The recurrence will end on <field name="auto_post_until" readonly="1"/> (included).</span>
                    </div>
                    <div groups="account.group_account_invoice,account.group_account_readonly" class="alert alert-warning" role="alert" invisible="partner_credit_warning == ''">
                        <field name="partner_credit_warning"/>
                    </div>
                    <!-- Currency consistency -->
                    <div class="alert alert-warning" role="alert" invisible="not display_inactive_currency_warning or move_type not in ('in_invoice', 'in_refund', 'in_receipt')">
                        In order to validate this bill, you must <button class="oe_link" type="object" name="action_activate_currency" style="padding: 0; vertical-align: baseline;">activate the currency of the bill</button>. The journal entries need to be computed by Odoo before being posted in your company's currency.
                    </div>
                    <div class="alert alert-warning" role="alert" invisible="not display_inactive_currency_warning or move_type not in ('out_invoice', 'out_refund', 'out_receipt')">
                        In order to validate this invoice, you must <button class="oe_link" type="object" name="action_activate_currency" style="padding: 0; vertical-align: baseline;">activate the currency of the invoice</button>. The journal entries need to be computed by Odoo before being posted in your company's currency.
                    </div>
                    <div class="alert alert-warning" role="alert" invisible="not abnormal_amount_warning">
                        <field name="abnormal_amount_warning"/>
                    </div>
                    <div class="alert alert-warning" role="alert" invisible="not abnormal_date_warning">
                        <field name="abnormal_date_warning"/>
                    </div>
                    <sheet>
                        <div name="button_box" class="oe_button_box">
                            <button name="action_open_business_doc" class="oe_stat_button" icon="fa-bars" type="object" invisible="move_type != 'entry' or not id or not origin_payment_id">
                                    <div class="o_stat_info">
                                        <span class="o_stat_text">1 Payment</span>
                                    </div>
                            </button>
                            <button name="open_payments" class="oe_stat_button" icon="fa-bars" type="object" invisible="not matched_payment_ids">
                                    <field name="payment_count" string="Payments" widget="statinfo"/>
                            </button>
                            <button name="open_reconcile_view" class="oe_stat_button" icon="fa-bars" type="object" invisible="move_type != 'entry' or not id or not has_reconciled_entries">
                                    <div class="o_stat_info">
                                        <span class="o_stat_text">Reconciled Items</span>
                                    </div>
                            </button>
                            <button name="open_created_caba_entries" class="oe_stat_button" icon="fa-usd" type="object" invisible="not tax_cash_basis_created_move_ids">
                                    <div class="o_stat_info">
                                        <span class="o_stat_text">Cash Basis Entries</span>
                                    </div>
                            </button>
                            <button name="open_adjusting_entries" class="oe_stat_button" icon="fa-bars" type="object" invisible="not adjusting_entries_move_ids">
                                    <field name="adjusting_entries_count" string="Adjusting Entries" widget="statinfo"/>
                            </button>
                            <button name="open_adjusting_entry_origin_moves" class="oe_stat_button" icon="fa-bars" type="object" invisible="not adjusting_entry_origin_move_ids">
                                    <div invisible="adjusting_entry_origin_moves_count != 1" class="o_stat_info">
                                        <span class="o_stat_text">
                                            <field name="adjusting_entry_origin_label"/>
                                        </span>
                                    </div>
                                    <field name="adjusting_entry_origin_moves_count" invisible="adjusting_entry_origin_moves_count == 1" string="Invoices" widget="statinfo"/>
                            </button>
                        </div>

                        <widget name="web_ribbon" title="Sent" bg_color="gray_ribbon" invisible="not is_move_sent or payment_state != 'not_paid' or move_type not in ('out_invoice', 'out_refund', 'out_receipt')"/>
                        <!-- Payment status for invoices / receipts -->
                        <widget name="web_ribbon" title="Sent" bg_color="text-bg-secondary" invisible="status_in_payment != 'sent' or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')"/>
                        <widget name="web_ribbon" title="Paid" invisible="payment_state != 'paid' or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')"/>
                        <widget name="web_ribbon" title="In Payment" invisible="payment_state != 'in_payment' or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')"/>
                        <widget name="web_ribbon" title="Partial" bg_color="text-bg-secondary" invisible="payment_state != 'partial' or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')"/>
                        <widget name="web_ribbon" title="Reversed" invisible="payment_state != 'reversed'"/>
                        <widget name="web_ribbon" title="Blocked" bg_color="text-bg-danger" invisible="payment_state != 'blocked' or move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')"/>
                         <widget name="web_ribbon" text="Invoicing App Legacy" bg_color="text-bg-info" invisible="payment_state != 'invoicing_legacy'" tooltip="This entry has been generated through the Invoicing app, before installing Accounting. It has been disabled by the 'Invoicing Switch Threshold Date' setting so that it does not impact your accounting."/>

                        <!-- Invisible fields -->
                        <field name="id" invisible="1"/>
                        <field name="state" invisible="1"/>
                        <field name="company_id" invisible="1"/>
                        <field name="journal_id" invisible="1"/>
                        <field name="show_name_warning" invisible="1"/>
                        <field name="posted_before" invisible="1"/>
                        <!--test-tags .test_01_account_tour -->
                        <field name="move_type" invisible="1" force_save="1"/>
                        <field name="payment_state" invisible="1" force_save="1"/>
                        <field name="invoice_filter_type_domain" invisible="1"/>
                        <field name="suitable_journal_ids" invisible="1"/>
                        <field name="currency_id" invisible="1" readonly="state in ['cancel', 'posted']"/>
                        <field name="company_currency_id" invisible="1"/>
                        <field name="commercial_partner_id" invisible="1"/>
                        <field name="bank_partner_id" invisible="1"/>
                        <field name="display_qr_code" invisible="1"/>
                        <field name="show_reset_to_draft_button" invisible="1"/>
                        <field name="expected_currency_rate" invisible="1"/>

                        <field name="invoice_has_outstanding" invisible="1"/>
                        <field name="is_move_sent" invisible="1"/>
                        <field name="invoice_pdf_report_id" invisible="1"/>
                        <field name="need_cancel_request" invisible="1"/>
                        <field name="has_reconciled_entries" invisible="1"/>
                        <field name="restrict_mode_hash_table" invisible="1"/>
                        <field name="inalterable_hash" invisible="1"/>
                        <field name="country_code" invisible="1"/>
                        <field name="display_inactive_currency_warning" invisible="1"/>
                        <field name="statement_line_id" invisible="1"/>
                        <field name="statement_id" invisible="1"/>
                        <field name="origin_payment_id" invisible="1"/>
                        <field name="tax_country_id" invisible="1"/>
                        <field name="tax_calculation_rounding_method" invisible="1"/>
                        <field name="tax_cash_basis_created_move_ids" invisible="1"/>
                        <field name="quick_edit_mode" invisible="1"/>
                        <field name="hide_post_button" invisible="1"/>
                        <field name="quick_encoding_vals" invisible="1"/>
                        <field name="show_delivery_date" invisible="1"/>
                        <field name="is_being_sent" invisible="1"/>
                        <field name="show_update_fpos" invisible="1"/>

                        <div class="oe_title">
                            <span class="o_form_label">
                                <field name="move_type" invisible="move_type == 'entry'" widget="receipt_selector" options="{'horizontal': true}" nolabel="1" readonly="state != 'draft'"/>
                            </span>

                            <div class="text-warning" invisible="not show_name_warning">The current highest number is <field class="oe_inline" name="highest_name"/>. You might want to put a higher number here.</div>

                            <h1>
                                <field name="name" invisible="not (name or name_placeholder or quick_edit_mode)" readonly="state != 'draft'" options="{'placeholder_field': 'name_placeholder'}"/>

                                <span invisible="name or name_placeholder or quick_edit_mode">Draft</span>
                            </h1>
                        </div>
                        <group>
                            <group id="header_left_group">

                                <label for="partner_id" string="Customer" style="font-weight:bold;" invisible="move_type not in ('out_invoice', 'out_refund', 'out_receipt')"/>
                                <label for="partner_id" string="Vendor" style="font-weight:bold;" invisible="move_type not in ('in_invoice', 'in_refund', 'in_receipt')"/>
                                <div class="o_col" invisible="move_type not in ('out_invoice', 'out_refund', 'out_receipt', 'in_invoice', 'in_refund', 'in_receipt')">
                                    <field name="partner_id" widget="res_partner_many2one" nolabel="1" context="{                                             'res_partner_search_mode': (context.get('default_move_type', 'entry') in ('out_invoice', 'out_refund', 'out_receipt') and 'customer') or (context.get('default_move_type', 'entry') in ('in_invoice', 'in_refund', 'in_receipt') and 'supplier') or False,                                             'show_address': 1, 'default_is_company': True, 'show_vat': True}" domain="[('company_id', 'in', (False, company_id))]" options="{&quot;no_quick_create&quot;: True}" default_focus="1" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')" placeholder="Search a name or Tax ID..." readonly="state != 'draft'"/>
                                    <button name="action_update_fpos_values" type="object" string="Update Taxes and Accounts" help="Recompute all taxes and accounts based on this fiscal position" class="btn-link mb-1 px-0" icon="fa-refresh" confirm="This will update all taxes and accounts based on the currently selected fiscal position." invisible="not show_update_fpos or state in ['cancel', 'posted']"/>
                                </div>

                                <field name="partner_shipping_id" groups="account.group_delivery_invoice_address" invisible="move_type not in ('out_invoice', 'out_refund', 'out_receipt')" readonly="state != 'draft'"/>
                                <field name="quick_edit_total_amount" class="w-50" invisible="move_type == 'entry' or not quick_edit_mode" readonly="state != 'draft'"/>
                                <label for="ref" string="Bill Reference" invisible="move_type not in ('in_invoice', 'in_receipt', 'in_refund')"/>
                                <field name="ref" default_focus="1" nolabel="1" invisible="move_type not in ('in_invoice', 'in_receipt', 'in_refund')"/>
                                <field name="ref" default_focus="1" invisible="move_type != 'entry'"/>
                                <field name="tax_cash_basis_origin_move_id" invisible="not tax_cash_basis_origin_move_id"/>
                                <label name="invoice_vendor_bill_id_label" for="invoice_vendor_bill_id" string="Auto-Complete" class="oe_edit_only" invisible="state != 'draft' or move_type != 'in_invoice'"/>
                                <field name="invoice_vendor_bill_id" nolabel="1" class="oe_edit_only" invisible="state != 'draft' or move_type != 'in_invoice'" domain="[('company_id', '=', company_id), ('partner_id','child_of', [partner_id]), ('move_type','=','in_invoice')]" placeholder="Select an old vendor bill" options="{'no_create': True}" context="{'show_total_amount': True}"/>
                            </group>
                            <group id="header_right_group">
                                <label for="invoice_date" string="Invoice Date" style="font-weight:bold;" invisible="move_type not in ('out_invoice', 'out_refund', 'out_receipt')"/>
                                <field name="invoice_date" nolabel="1" options="{'warn_future': true}" invisible="move_type not in ('out_invoice', 'out_refund', 'out_receipt')" readonly="state != 'draft'" placeholder="Today"/>

                                <label for="invoice_date" string="Bill Date" style="font-weight:bold;" invisible="move_type not in ('in_invoice', 'in_refund', 'in_receipt')"/>
                                <field name="invoice_date" nolabel="1" options="{'warn_future': true}" invisible="move_type not in ('in_invoice', 'in_refund', 'in_receipt')" readonly="state != 'draft'" placeholder="Today"/>

                                <field name="date" string="Accounting Date" invisible="move_type in ('out_invoice', 'out_refund', 'out_receipt') and not quick_edit_mode and not (state == 'posted' and date != invoice_date)" readonly="state != 'draft'"/>
                                <field name="payment_reference" invisible="move_type not in ('in_invoice', 'in_refund', 'in_receipt')" readonly="inalterable_hash != False" placeholder="Use Bill Reference"/>
                                <field name="partner_bank_id" context="{'default_partner_id': bank_partner_id, 'display_account_trust': True}" domain="[('partner_id', '=', bank_partner_id)]" invisible="move_type not in ('in_invoice', 'in_refund', 'in_receipt')" readonly="is_move_sent and state != 'draft'"/>

                                <!-- Invoice payment terms (only invoices) + due date (only invoices / receipts) -->
                                <div class="o_td_label" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')">
                                    <label for="invoice_date_due" string="Due Date" invisible="invoice_payment_term_id"/>
                                    <label for="invoice_payment_term_id" string="Payment terms" invisible="not invoice_payment_term_id"/>
                                </div>
                                <div class="d-flex" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')" name="due_date">
                                    <field name="invoice_date_due" force_save="1" placeholder="Date" invisible="invoice_payment_term_id"/>
                                    <span class="o_form_label mx-3 oe_edit_only text-center" style="width: 6ch;" invisible="state != 'draft' or invoice_payment_term_id">or</span>
                                    <field name="invoice_payment_term_id" context="{'example_date': invoice_date, 'example_amount': tax_totals['total_amount_currency']}" placeholder="Payment Terms" options="{'no_quick_create':True}" readonly="state in ['cancel', 'posted']"/>
                                </div>
                                <field name="delivery_date" invisible="not show_delivery_date" readonly="state != 'draft'"/>
                                <label for="journal_id" groups="account.group_account_readonly"/>
                                <label for="currency_id" groups="!account.group_account_readonly,base.group_multi_currency"/>
                                <div name="journal_div" class="d-flex" groups="account.group_account_readonly,base.group_multi_currency">
                                    <field name="journal_id" groups="account.group_account_readonly" options="{'no_create': True, 'no_open': True}" readonly="posted_before and name not in (False, '', '/')"/>
                                    <div name="in_and_refresh_button_div" groups="base.group_multi_currency" class="d-flex flex-column mx-3 text-center" style="width: 6ch;" invisible="move_type == 'entry'">
                                        <div>in</div>
                                        <div class="d-flex flex-column justify-content-center flex-grow-1" invisible="state != 'draft' or invoice_currency_rate == expected_currency_rate">
                                            <button type="object" name="refresh_invoice_currency_rate" icon="fa-refresh" title="Refresh currency rate to the invoice date" class="btn btn-link p-0"/>
                                        </div>
                                    </div>
                                    <div name="currency_div" groups="base.group_multi_currency" class="w-100" invisible="move_type == 'entry'">
                                        <div class="d-flex gap-1">
                                            <field name="currency_id" readonly="state != 'draft'" class="oe_inline" options="{'no_create': True}" context="{'search_default_active': 1, 'search_default_inactive': 1}"/>
                                            <widget name="account_pick_currency_date" invisible="state != 'draft' or currency_id == company_currency_id"/>
                                        </div>
                                        <div name="currency_conversion_div" class="d-flex gap-1 text-muted" invisible="currency_id == company_currency_id">
                                            <span>1</span>
                                            <field name="company_currency_id" readonly="True" options="{'no_open': True}" class="w-auto"/>
                                            <span>=</span>
                                            <field name="invoice_currency_rate" digits="[12,6]" readonly="state != 'draft'"/>
                                            <field name="currency_id" readonly="True" options="{'no_open': True}" class="w-auto"/>
                                        </div>
                                    </div>
                                </div>
                            </group>
                        </group>
                        <notebook>
                            <page id="invoice_tab" name="invoice_tab" string="Invoice Lines" invisible="move_type == 'entry'">
                                <field name="invoice_line_ids" widget="product_label_section_and_note_field_o2m" mode="list,kanban" context="{                                            'default_move_type': context.get('default_move_type'),                                            'journal_id': journal_id,                                            'default_partner_id': commercial_partner_id,                                            'default_currency_id': currency_id or company_currency_id,                                            'default_display_type': 'product',                                            'quick_encoding_vals': quick_encoding_vals,                                        }" readonly="state != 'draft'">
                                    <list name="journal_items" editable="bottom" string="Journal Items" default_order="sequence, id">
                                        <control>
                                            <create name="add_line_control" string="Add a line"/>
                                            <create name="add_section_control" string="Add a section" context="{'default_display_type': 'line_section'}"/>
                                            <create name="add_note_control" string="Add a note" context="{'default_display_type': 'line_note'}"/>
                                            <button name="action_add_from_catalog" string="Catalog" type="object" class="btn-link" context="{'order_id': parent.id}"/>
                                        </control>

                                        <!-- Displayed fields -->
                                        <field name="sequence" widget="handle"/>
                                        <field name="product_id" optional="conditional" widget="product_label_section_and_note_field" domain="                                                     context.get('default_move_type') in ('out_invoice', 'out_refund', 'out_receipt')                                                     and [('sale_ok', '=', True)]                                                     or [('purchase_ok', '=', True)]                                                "/>
                                        <field name="name" widget="section_and_note_text" optional="show"/>
                                        <field name="account_id" context="{                                                     'partner_id': partner_id,                                                     'move_type': parent.move_type,                                                     'search_default_type_asset_fixed': 'in_' in parent.move_type,                                                     'search_default_type_expense': 'in_' in parent.move_type,                                                     'search_default_incomeacc': 'out_' in parent.move_type,                                                     'preferred_account_type': 'out_' in parent.move_type and 'income' or 'in_' in parent.move_type and 'expense',                                                }" groups="account.group_account_readonly" options="{'no_quick_create': True}" domain="[('company_ids', 'parent_of', company_id), ('account_type', 'not in', ('asset_receivable', 'liability_payable', 'off_balance'))]" required="display_type not in ('line_note', 'line_section')"/>
                                        <field name="analytic_distribution" widget="analytic_distribution" string="Analytic" groups="analytic.group_analytic_accounting" optional="show" options="{'product_field': 'product_id', 'account_field': 'account_id', 'amount_field': 'price_subtotal'}" business_domain_compute="parent.move_type in ['out_invoice', 'out_refund', 'out_receipt'] and 'invoice' or parent.move_type in ['in_invoice', 'in_refund', 'in_receipt'] and 'bill' or 'general'"/>
                                        <field name="quantity" optional="show"/>
                                        <field name="product_uom_id" groups="uom.group_uom" optional="show" width="92px" options="{'no_create': True, 'quantity_field': 'quantity'}" widget="many2one_uom"/>
                                        <!-- /l10n_in_edi.test_edi_json -->
                                        <!-- required for @api.onchange('product_id') -->
                                        <field name="product_uom_id" column_invisible="True"/>
                                        <field name="price_unit" string="Price"/>
                                        <field name="discount" width="50px" string="Disc.%" optional="hide"/>
                                        <field name="tax_ids" widget="many2many_tax_tags" domain="[('type_tax_use', '=?', parent.invoice_filter_type_domain), ('company_id', 'parent_of', parent.company_id), ('country_id', '=', parent.tax_country_id)]" context="{                                                     'append_fields': not parent.invoice_filter_type_domain and ['type_tax_use'],                                                     'active_test': True,                                                     'dynamic_fiscal_position_id': parent.fiscal_position_id,                                                }" options="{'no_create': True}" optional="show"/>
                                        <field name="deductible_amount" column_invisible="parent.move_type not in ['in_invoice', 'in_refund']" string="Professional %" optional="hide"/>
                                        <field name="price_subtotal" column_invisible="parent.move_type not in ['in_invoice', 'in_refund', 'in_receipt'] and parent.company_price_include == 'tax_included'" string="Amount"/>
                                        <field name="price_total" column_invisible="parent.move_type in ['in_invoice', 'in_refund', 'in_receipt'] or parent.company_price_include == 'tax_excluded'" string="Amount"/>
                                        <!-- Others fields -->
                                        <field name="partner_id" column_invisible="True"/>
                                        <field name="currency_id" column_invisible="True"/>
                                        <field name="company_id" column_invisible="True"/>
                                        <field name="company_currency_id" column_invisible="True"/>
                                        <field name="display_type" force_save="1" column_invisible="True"/>
                                    </list>
                                    <kanban class="o_kanban_mobile">
                                        <!-- Displayed fields -->
                                        <templates>
                                            <t t-name="card">
                                                <div t-attf-class="ps-0 pe-0 {{ record.display_type.raw_value ? 'o_is_' + record.display_type.raw_value : '' }}">
                                                    <t t-if="!['line_note', 'line_section'].includes(record.display_type.raw_value)">
                                                        <div class="row g-0">
                                                            <div class="col-2 pe-3">
                                                                <field name="product_id" widget="image" options="{'preview_image': 'image_128'}" class="w-100"/>
                                                            </div>
                                                            <div class="col-10">
                                                                <div class="row">
                                                                    <div class="col">
                                                                        <field class="fw-bold" name="product_id"/>
                                                                    </div>
                                                                    <div class="col-auto fw-bold float-end text-end">
                                                                        <field name="price_subtotal" t-if="['in_invoice', 'in_refund', 'in_receipt'].includes(record.move_type.raw_value)" string="Amount"/>
                                                                        <field name="price_total" t-if="!['in_invoice', 'in_refund', 'in_receipt'].includes(record.move_type.raw_value)" string="Amount"/>
                                                                    </div>
                                                                </div>
                                                                <div class="text-muted">
                                                                    Quantity:
                                                                    <field name="quantity"/>
                                                                    <field name="product_uom_id" groups="uom.group_uom" widget="many2one_uom"/>
                                                                </div>
                                                                <div class="text-muted">
                                                                    Unit Price:
                                                                    <field name="price_unit"/>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </t>
                                                    <t t-if="record.display_type.raw_value === 'line_section' || record.display_type.raw_value === 'line_note'">
                                                        <field name="name"/>
                                                    </t>
                                                </div>
                                            </t>
                                        </templates>

                                        <!-- Others fields -->
                                        <field name="tax_calculation_rounding_method"/>
                                        <field name="currency_id"/>
                                        <field name="company_currency_id"/>
                                        <field name="display_type" force_save="1"/>
                                        <field name="move_type"/>
                                    </kanban>

                                    <!-- Form view to cover mobile use -->
                                    <form>
                                        <sheet>
                                            <field name="tax_calculation_rounding_method" invisible="1"/>
                                            <field name="display_type" invisible="1"/>
                                            <field name="company_id" invisible="1"/>
                                            <field name="partner_id" invisible="1"/>
                                            <group>
                                                <field name="product_id" widget="many2one_barcode"/>
                                                <label for="name" string="Description" invisible="display_type in ('line_note', 'line_section')"/>
                                                <label for="name" string="Section" invisible="display_type != 'line_section'"/>
                                                <label for="name" string="Note" invisible="display_type != 'line_note'"/>
                                                <field name="name" widget="text" nolabel="1"/>
                                                <field name="quantity"/>
                                                <field name="product_uom_id" groups="uom.group_uom" widget="many2one_uom"/>
                                                <field name="price_unit"/>
                                                <field name="discount" string="Disc.%"/>
                                            </group>
                                            <group>
                                                <field name="account_id" domain="[('company_ids', 'parent_of', company_id)]" options="{'no_create': True}" context="{'partner_id': partner_id, 'move_type': parent.move_type}"/>
                                                <field name="tax_ids" widget="many2many_tax_tags"/>
                                                <field name="analytic_distribution" widget="analytic_distribution" groups="analytic.group_analytic_accounting"/>
                                            </group>
                                            <group>
                                                <field name="price_subtotal" invisible="parent.move_type not in ['in_invoice', 'in_refund', 'in_receipt'] and parent.company_price_include == 'tax_included'" string="Amount"/>
                                                <field name="price_total" invisible="parent.move_type in ['in_invoice', 'in_refund', 'in_receipt'] or parent.company_price_include == 'tax_excluded'" string="Amount"/>
                                            </group>
                                        </sheet>
                                    </form>
                                </field>
                                <group col="12" class="oe_invoice_lines_tab overflow-hidden">
                                    <group colspan="8">
                                        <field name="narration" placeholder="Terms and Conditions" nolabel="1"/>
                                    </group>
                                    <!-- Totals (only invoices / receipts) -->
                                    <group colspan="4">
                                        <group class="oe_subtotal_footer" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt') or payment_state == 'invoicing_legacy'">

                                            <field name="tax_totals" widget="account-tax-totals-field" nolabel="1" colspan="2" readonly="state != 'draft' or (move_type not in ('in_invoice', 'in_refund', 'in_receipt') and not quick_edit_mode)"/>

                                            <field name="invoice_payments_widget" colspan="2" nolabel="1" widget="payment"/>
                                            <field name="amount_residual" class="oe_subtotal_footer_separator"/>
                                        </group>
                                        <group class="oe_subtotal_footer px-4" invisible="state != 'posted' or not invoice_has_outstanding" groups="account.group_account_invoice,account.group_account_readonly">
                                            <field name="invoice_outstanding_credits_debits_widget" class="oe_invoice_outstanding_credits_debits py-3" colspan="2" nolabel="1" widget="payment"/>
                                        </group>
                                    </group>
                                </group>
                            </page>
                            <page id="aml_tab" string="Journal Items" groups="account.group_account_readonly" name="aml_tab">
                                <field name="journal_line_ids" mode="list,kanban" context="{                                            'default_move_type': context.get('default_move_type'),                                            'line_ids': line_ids,                                            'journal_id': journal_id,                                            'default_partner_id': commercial_partner_id,                                            'default_currency_id': currency_id or company_currency_id,                                            'kanban_view_ref': 'account.account_move_line_view_kanban_mobile',                                        }" invisible="payment_state == 'invoicing_legacy' and move_type != 'entry'" readonly="state != 'draft'">
                                    <list editable="bottom" string="Journal Items" default_order="sequence, id">
                                        <!-- Displayed fields -->
                                        <field name="account_id" required="1" domain="[('company_ids', 'parent_of', company_id)]"/>
                                        <field name="partner_id" optional="show" domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]" column_invisible="parent.move_type != 'entry'"/>
                                        <field name="name" widget="section_and_note_text" optional="show"/>
                                        <field name="analytic_distribution" widget="analytic_distribution" groups="analytic.group_analytic_accounting" optional="show" options="{'account_field': 'account_id'}" business_domain_compute="parent.move_type in ['out_invoice', 'out_refund', 'out_receipt'] and 'invoice' or parent.move_type in ['in_invoice', 'in_refund', 'in_receipt'] and 'bill' or 'general'"/>
                                        <field name="date_maturity" optional="hide" column_invisible="context.get('view_no_maturity')"/>
                                        <field name="amount_currency" groups="base.group_multi_currency" optional="hide"/>
                                        <field name="currency_id" options="{'no_create': True}" optional="hide" groups="base.group_multi_currency" column_invisible="parent.move_type != 'entry'"/>
                                        <field name="tax_ids" widget="autosave_many2many_tax_tags" optional="hide" domain="[('type_tax_use', '=?', parent.invoice_filter_type_domain), ('company_id', 'parent_of', parent.company_id)]" context="{                                                     'append_fields': not parent.invoice_filter_type_domain and ['type_tax_use'],                                                     'active_test': True                                                }" options="{'no_create': True}" force_save="1" readonly="tax_line_id or (parent.move_type in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt') and account_type in ('asset_receivable', 'liability_payable'))"/>
                                        <field name="debit" sum="Total Debit" invisible="display_type in ('line_section', 'line_note')" readonly="parent.move_type in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt') and display_type in ('product')"/>
                                        <field name="credit" sum="Total Credit" invisible="display_type in ('line_section', 'line_note')" readonly="parent.move_type in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt') and display_type in ('product')"/>
                                        <field name="balance" column_invisible="True"/>
                                        <field name="discount_date" string="Discount Date" optional="hide"/>
                                        <field name="discount_amount_currency" string="Discount Amount" optional="hide"/>

                                        <field name="tax_tag_ids" widget="many2many_tags" string="Tax Grids" optional="show" options="{'no_create': True}" domain="[                                                     ('applicability', '=', 'taxes'),                                                     '|', ('country_id', '=', parent.tax_country_id),                                                     ('country_id', '=', False),                                                 ]"/>

                                        <field name="tax_tag_invert" readonly="1" optional="hide" groups="base.group_no_one"/>

                                        <!-- Buttons -->
                                        <button name="action_automatic_entry" type="object" icon="fa-calendar" string="Cut-Off" aria-label="Change Period" class="float-end" column_invisible="parent.move_type == 'entry' or parent.state != 'posted'" invisible="account_internal_group not in ('income', 'expense')" context="{'default_action': 'change_period'}"/>

                                        <!-- Others fields -->
                                        <field name="tax_line_id" column_invisible="True"/>
                                        <field name="company_currency_id" column_invisible="True"/>
                                        <field name="display_type" force_save="1" column_invisible="True"/>
                                        <field name="company_id" column_invisible="True"/>
                                        <field name="sequence" column_invisible="True"/>
                                        <field name="id" column_invisible="True"/>
                                        <field name="account_internal_group" column_invisible="True"/>
                                        <field name="account_type" column_invisible="True"/>
                                    </list>
                                    <!-- Form view to cover mobile use -->
                                    <form>
                                      <group>
                                        <field name="account_id" domain="[('company_ids', 'parent_of', company_id)]"/>
                                        <field name="partner_id" domain="['|', ('parent_id', '=', False), ('is_company', '=', True)]"/>
                                        <field name="name"/>
                                        <field name="analytic_distribution" widget="analytic_distribution" groups="analytic.group_analytic_accounting"/>
                                        <field name="amount_currency" groups="base.group_multi_currency"/>
                                        <field name="company_currency_id" invisible="1"/>
                                        <field name="company_id" invisible="1"/>
                                        <field name="currency_id" options="{'no_create': True}" groups="base.group_multi_currency"/>
                                        <field name="debit" sum="Total Debit"/>
                                        <field name="credit" sum="Total Credit"/>
                                        <field name="balance" invisible="1"/>
                                        <field name="tax_ids" string="Taxes Applied" widget="autosave_many2many_tax_tags" options="{'no_create': True}" domain="[('type_tax_use', '=?', parent.invoice_filter_type_domain), ('company_id', 'parent_of', parent.company_id)]" context="{                                                     'append_fields': not parent.invoice_filter_type_domain and ['type_tax_use'],                                                     'active_test': True,                                                }"/>
                                        <field name="date_maturity" required="0" invisible="context.get('view_no_maturity', False)"/>
                                      </group>
                                    </form>
                                </field>
                                <div class="alert alert-info text-center mb-0" role="alert" invisible="payment_state != 'invoicing_legacy' or move_type == 'entry'">
                                    <span>This entry has been generated through the Invoicing app, before installing Accounting. Its balance has been imported separately.</span>
                                </div>
                            </page>
                            <page id="other_tab" string="Other Info" name="other_info" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')">
                                <group id="other_tab_group">
                                    <group string="Invoice" name="sale_info_group" invisible="move_type not in ('out_invoice', 'out_refund')">
                                        <label for="ref" string="Customer Reference"/>
                                        <field name="ref" nolabel="1"/>
                                        <field name="user_id" invisible="1" force_save="1"/>
                                        <field name="invoice_user_id" domain="[('share', '=', False)]" widget="many2one_avatar_user"/>
                                        <field name="invoice_origin" string="Source Document" force_save="1" invisible="1"/>
                                        <field name="partner_bank_id" context="{'default_partner_id': bank_partner_id, 'display_account_trust': True}" domain="[('partner_id.ref_company_ids', 'parent_of', company_id)]" readonly="is_move_sent and state != 'draft'"/>
                                        <field name="payment_reference" invisible="move_type not in ('out_invoice', 'out_refund')" readonly="inalterable_hash" placeholder="Standard communication"/>
                                        <field name="qr_code_method" invisible="not display_qr_code"/>
                                        <field name="delivery_date" readonly="state != 'draft'"/>
                                    </group>
                                    <group string="Accounting" name="accounting_info_group" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')">
                                        <field name="company_id" groups="base.group_multi_company"/>
                                        <field name="invoice_incoterm_id"/>
                                        <field name="incoterm_location"/>
                                        <field name="fiscal_position_id" readonly="state in ['cancel', 'posted']"/>
                                        <field name="secured" groups="account.group_account_secured,base.group_no_one"/>
                                        <field name="preferred_payment_method_line_id" string="Payment Method" domain="[('payment_type', '=', 'inbound'), ('company_id', '=', company_id)]" invisible="move_type in ('in_invoice', 'in_refund')"/>
                                        <field name="preferred_payment_method_line_id" string="Payment Method" domain="[('payment_type', '=', 'outbound'), ('company_id', '=', company_id)]" invisible="move_type in ('out_invoice', 'out_refund')"/>
                                        <field name="invoice_cash_rounding_id" groups="account.group_cash_rounding" readonly="state != 'draft'"/>
                                        <field name="invoice_source_email" widget="email" invisible="move_type not in ('in_invoice', 'in_refund') or not invoice_source_email"/>
                                        <field name="auto_post" readonly="state != 'draft'"/>
                                        <field name="auto_post_until" invisible="auto_post in ('no', 'at_date')" readonly="state != 'draft'"/>
                                    </group>
                                </group>
                            </page>
                            <page id="other_tab_entry" string="Other Info" name="other_info" invisible="move_type != 'entry'">
                                <group id="other_tab_entry_group">
                                    <group name="misc_group">
                                        <field name="auto_post" invisible="move_type != 'entry'" readonly="state != 'draft'"/>
                                        <field name="reversed_entry_id" invisible="move_type != 'entry' or not reversed_entry_id"/>
                                        <field name="auto_post_until" invisible="auto_post in ('no', 'at_date')" readonly="state != 'draft'"/>
                                    </group>
                                    <group>
                                        <field name="fiscal_position_id" readonly="state in ['cancel', 'posted']"/>
                                        <field name="company_id" groups="base.group_multi_company" required="1"/>
                                    </group>
                                </group>
                                <!-- Internal note -->
                                <field name="narration" placeholder="Add an internal note..." nolabel="1" height="50"/>
                            </page>
                        </notebook>
                    </sheet>
                    <!-- Attachment preview -->
                    <div class="o_attachment_preview" invisible="move_type not in ('out_invoice', 'out_refund', 'in_invoice', 'in_refund') or state != 'draft'"/>
                    <!-- Chatter -->
                    <chatter reload_on_attachment="True"/>
                </form>
            