Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Does any here knows how to make 2 view in PAY INVOICE?

By
Alcaline
on 10/27/14, 4:38 AM 1,208 views

I want to displayed the  *Or Number, P.R Number, Cheque Number while paying in SALES and C.V. number  and Cheque Number while paying at PURCHASE.. how will i going to do that? Please anyone help me.

0
Alcaline
On 10/27/14, 8:26 PM

Here is my code:

 


<!--    ***************************SALE VIEW******************************************    -->
        <record id="account_voucher_receipt_dialog_form_view_inherit_sale" model="ir.ui.view">
            <field name="name">account.voucher.payment.form</field>
            <field name="model">account.voucher</field>
            <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form" />
            <field name="priority" eval="30"/>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//field[@name='reference']" position="after">
                        <field name="or_num" invisible="context.get('line_type', False)" string="O.R. Number" placeholder="e.g. OR003/10"/>
                        <field name="cheque_num" invisible="context.get('line_type', False)" string="Checque Number" placeholder="e.g. Checque003/10"/>
                        <field name="pr_num" invisible="context.get('line_type', False)" string="P.R. Number" placeholder="e.g. PR003/10"/>
                        <field name="cv_num" invisible="context.get('line_type', False)" string="C.V.Number" placeholder="e.g. CV003/10"/>
                        <field name="sale_bo" invisible="False"/>
                        <field name="purchase_bo" invisible="False"/>
                        
                    </xpath>
                </data>
            </field>
        </record>
<!--        -->
<!--    ***************************PURCHASE VIEW******************************************            -->
        <record id="account_voucher_receipt_dialog_form_view_inherit_purchase" model="ir.ui.view">
            <field name="name">account.voucher.payment.form</field>
            <field name="model">account.voucher</field>
            <field name="inherit_id" ref="account_voucher.view_vendor_receipt_dialog_form" />
            <field name="priority" eval="30"/>
            <field name="arch" type="xml">
                <data>
                    <xpath expr="//field[@name='reference']" position="after">
<!--                        <field name="or_num" invisible="context.get('line_type', False)" string="O.R. Number" placeholder="e.g. OR003/10"/>-->
<!--                        <field name="cheque_num" invisible="context.get('line_type', False)" string="Checque Number" placeholder="e.g. Checque003/10"/>-->
<!--                        <field name="pr_num" invisible="context.get('line_type', False)" string="P.R. Number" placeholder="e.g. PR003/10"/>-->
                        <field name="cv_num" invisible="context.get('line_type', False)" string="C.V.Number" placeholder="e.g. CV003/10"/>
                        <field name="purchase_bo" invisible="True"/>
                        
                    </xpath>
                </data>
            </field>
        </record>
<!--        -->
<!--    ***************************SALE******************************************    -->
         <record id="action_vendor_receipt_sale" model="ir.actions.act_window">
            <field name="name">Customer Payments</field>
            <field name="res_model">account.voucher</field>
            <field name="view_type">form</field>
            <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
            <field name="context">{'type':'receipt','default_sale_bo':'1'}</field>
            <field name="search_view_id" ref="account_voucher.view_voucher_filter_customer_pay"/>
            <field name="view_id" eval="False"/>
            <field name="target">current</field>
            <field name="form_view_id" ref="account_voucher_receipt_dialog_form_view_inherit_sale" />
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to register a new payment.
              </p><p>
                Enter the customer and the payment method and then, either
                create manually a payment record or OpenERP will propose to you
                automatically the reconciliation of this payment with the open
                invoices or sales receipts.
              </p>
            </field>
        </record>
        
<!--    ***************************PURCHASE******************************************    -->
         <record id="action_vendor_receipt_purchase" model="ir.actions.act_window">
            <field name="name">Customer Payments</field>
            <field name="res_model">account.voucher</field>
            <field name="view_type">form</field>
            <field name="domain">[('journal_id.type', 'in', ['bank', 'cash']), ('type','=','receipt')]</field>
            <field name="context">{'type':'receipt', 'purchase_bo','=','1'}</field>
            <field name="search_view_id" ref="account_voucher.view_voucher_filter_customer_pay"/>
            <field name="view_id" eval="False"/>
            <field name="target">current</field>
<!--            <field name="form_view_id" ref="account_voucher_receipt_dialog_form_view_inherit_sale" />-->
            <field name="form_view_id" ref="account_voucher_receipt_dialog_form_view_inherit_purchase" />
            <field name="help" type="html">
              <p class="oe_view_nocontent_create">
                Click to register a new payment.
              </p><p>
                Enter the customer and the payment method and then, either
                create manually a payment record or OpenERP will propose to you
                automatically the reconciliation of this payment with the open
                invoices or sales receipts.
              </p>
            </field>
        </record>

 

0

Ben Bernard

--Ben Bernard--
1083
| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 10/27/14, 11:09 AM

I think, you should make 2 different view, each for sale and purchase invoice. And provide two action to trigger each view. Because hidding things from the same object for to difference purpose is not a good practice.

Btw, if you insist want to control visibility of some field you can use customer / supplier boolead field in res.partner model.

Some inconsistent data I see is that you need purchase data for customer.

An even better suggestion. Thnx ben!

Ludo - Neobis
on 10/27/14, 11:53 AM

hi, Ben i did that but it didn't work i don't know why. I'll post my codes.

Alcaline
on 10/27/14, 8:26 PM
0

Ludo - Neobis

--Ludo - Neobis--
2387
| 2 2 5
Hoogvliet, Netherlands
--Ludo - Neobis--

Developer

Ludo - Neobis
On 10/27/14, 4:51 AM

Do you have any field on that form (or object) that indicates which payment it is (sale or purchase)? If so, you could use the "attrs" property on those fields and make them invisible in the case of sale or purchase.

Do note however, the fields cannot be mandatory if they are invisible, so if you want that to happen you need to also provide "required" in your attrs-statement.

Hope this helps!

i don't have fields. Can you teach how to add that?

Alcaline
on 10/27/14, 5:03 AM

If there is no field indicating which payment type this is, then perhaps take a step back. In the original invoice to be paid, there must be an indication (the field named "type" should be good). When clicking the button, you might consider overriding the method that follows, allowing you to save that value in context. Perhaps the invoice)id is already sent in this screen? Try using that to identify which payment type this is and hide the fields based on that value.

Ludo - Neobis
on 10/27/14, 5:50 AM

Thanks Ludo:)

Alcaline
on 10/27/14, 8:25 PM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 10/27/14, 4:38 AM
Seen: 1208 times
Last updated: 3/16/15, 8:10 AM