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

many2one tree view custom search design issue : any advice ?

By
Alkivi SAS
on 2/5/14, 6:11 PM 1,908 views

Hi there,

new to openerp, I'm developping my first module :) So far, basic views and object declaration are ok. Let's move to more advanced stuff.

I have an object A with a column like

'account_move_line_id': fields.many2one('account.move.line', 'Account Move Line'),

I've got a form that look like

<!-- Transaction Form View -->
<record model="ir.ui.view" id="view_linxo_transaction_form">
<field name="name">linxo.transaction.form</field>
<field name="model">linxo.transaction</field>
<field name="type">form</field>
<field name="arch" type="xml">
    <form string="Transaction Info">
        <group colspan="4" col="2">
            <field name="date" readonly="1"/>
            <field name="label" readonly="1"/>
            <field name="notes" readonly="1"/>
            <field name="amount" readonly="1"/>
            <field name="account_move_line_id" widget="many2one_list" domain="[('journal_id','=',journal_id),'|', ('debit','=', abs(amount)), ('credit','=', abs(amount))]"/>
            <field name="journal_id" readonly="1"/>
            <button name="search_account_move_line" string="Search account moves" type="workflow" attrs="{'invisible':[('account_move_line_id','!=',False)]}"/>
        </group>
    </form>
</field>

</record>

The goal is to perform a search for account.move.line, using criteria such as :

  • account.move.line amount close to object A amount
  • account.move.line amount around object A date

The user will then pick from that list the correct account.move.line to associated to object A.

I'm struggling with the road to take :

  • Custom widget and precise search (something like the default widget search more option)
  • Dynamically update domain to perform correct search in basic widget
  • Create a popup view not related to any model, perform search and take return of the popup to fix account_move_line_id (my favorite, but dont know where to start)

Any pointers would be appreciated :)

So far, I've added an field.function called candidates which return me the list of available candidates. Now all I need is an action from the wanted candidate to mark object A as treated ...

Alkivi SAS
on 2/6/14, 10:06 AM

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

0 follower(s)

Stats

Asked: 2/5/14, 6:11 PM
Seen: 1908 times
Last updated: 3/16/15, 8:10 AM