跳至内容
菜单
此问题已终结

HELLO all I'm facing issue adding fields to the tree view of account move line


I tried many solutions none has worked


class AccountMoveLineInherit(models.Model):
_inherit = 'account.move.line'

charity_account_move_line_id = fields.Many2one('charity.account.move.line', readonly=True)
country_id = fields.Many2one('res.country', 'Country', related='charity_account_move_line_id.country_id', store=True)


xml


account.move.line.tree.inherit
account.move.line







and tried this as well

    account.view.move.form
    account.move
    
            
​/form//field[@name='name']" position="after">




形象
丢弃
最佳答案

Hi Ghassen,


If you want to add it to the 'Invoice Lines' tab try,



ir.ui.view" > 

    account.move.form.charity  

    account.move  

     

     

         

             

             

         

     



If you want to add it to the ' Journal Items' tab try,




ir.ui.view" > 

    account.move.form.charity  

    account.move  

     

     

         

             

             

         

     


Hope it helps, 

Kiran K

 ​


形象
丢弃

Hi Ghassen,

If you want to add it to the 'Invoice Lines' tab try,

<record id ="view_move_form_charity" model ="ir.ui.view" >
<field name ="name" > account.move.form.charity </field>
<field name ="model" > account.move </field >
<field name ="inherit_id" ref ="account.view_move_form" />
<field name ="arch" type ="xml" >
<xpath expr ="//field[@name='invoice_line_ids']//field[ @name='account_id']" position ="after" >
<field name ='charity_account_move_line_id ' />
<field name ='country_id' />
</xpath>
</field>
</record>
If you want to add it to the ' Journal Items' tab try,

<record id ="view_move_form_charity" model ="ir.ui.view" >
<field name ="name" > account.move.form.charity </field>
<field name ="model" > account.move </field >
<field name ="inherit_id" ref ="account.view_move_form" />
<field name ="arch" type ="xml" >
<xpath expr ="//field[@name='line_ids']//field[ @name='account_id']" position ="after" >
<field name ='charity_account_move_line_id ' />
<field name ='country_id' />
</xpath>
</field>
</record>

Hope it helps, 
Kiran K
 ​

最佳答案

Hello Ghassen,

Hope you are trying to add a new field in the Journal Items tree view (Accounting > Accounting > Journal Items   

Please see the code attached in the comments section

   

       

           

       

   

   
       
           
       
   
   

   

       

           

       

   








形象
丢弃

<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">view.move.line.tree.chaity</field>
<field name="model">account.move.line</field>
<field name="inherit_id" ref="account.view_move_line_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='name']" position='after'>
<field name="charity_account_move_line_id"/>
</xpath>
</field>
</record>

相关帖文 回复 查看 活动
2
3月 22
6250
0
6月 24
2141
1
7月 22
2887
3
1月 24
18460
1
5月 25
8844