Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2123 Lượt xem

Hi

I have created a new smart button in Customer Invoice form and also in Vendor Bills for getting the corresponding payment for the particular customer and supplier respectively


customer_code.xml
<record id="customer_invoice_order_form_extend_period" model="ir.ui.view">

        <field name="name">customer.invoice.form.extend</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_form"/>
        <field name="arch" type="xml">

                <xpath expr="//form//sheet//div" position="before">
                    <div class="oe_button_box" name="button_box">
                        <button class="oe_stat_button" name="button_customer_payments"
                            string="Payments" type="object" icon="fa-bars"/>
                    </div>
                </xpath>

        </field>

</record>

customer_code.py

        def button_customer_payments(self):

                return {

                    'name': _('Payments'),

                    'view_type': 'form',

                    'view_mode': 'form','tree',

                    'res_model': 'account.payment',

                    'view_id': False,

                    'type': 'ir.actions.act_window',

                    'domain': [ ],

                }


supplier_code.xml
<record id="customer_invoice_order_form_extend_period" model="ir.ui.view">

        <field name="name">customer.invoice.form.extend</field>
        <field name="model">account.invoice</field>
        <field name="inherit_id" ref="account.invoice_supplier_form"/>
        <field name="arch" type="xml">

                <xpath expr="//form//sheet//div" position="before">
                    <div class="oe_button_box" name="button_box">
                        <button class="oe_stat_button" name="button_supplier_payments"
                            string="Payments" type="object" icon="fa-bars"/>
                    </div>
                </xpath>

        </field>

</record>


By this code, I get all the customer payments without filtration with the empty domain.

Please help me to get the corresponding payment in both customer invoice and vendor bills

    

Ảnh đại diện
Huỷ bỏ