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

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 :

  • amount between this and that
  • date close to that

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 :)

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

"How would you do that" is not a good title - it forces people to open your question before they know if they can help.

Tác giả

Good point, going to try to rephrase the question.

Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 3 15
3493
1
thg 2 25
1010
1
thg 10 23
4064
0
thg 5 22
2731
0
thg 4 15
4962