Skip to Content
Menu
This question has been flagged
1 Reply
2562 Views

I'm trying to modify the layout of the tree view for one2many field in account.move but nothing is happening.  I need to change the credit label in line_ids of account.move to be as follows: company currency description + 'Credit' (ex: if company currency=USD then I need the credit label in account.move form to be USD Credit).  I have overwritten the fields_view_get in account.move.line but still nothing is happening.  any idea how to solve the problem?

This is my code,

    @api.model

    def fields_view_get(self, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):


        res = super(AccountMove,self).fields_view_get(view_id=view_id, view_type=view_type,toolbar=toolbar, submenu=submenu)

        doc = etree.XML(res['arch'])

        for field in res['fields']:

                if field in ['line_ids']:

                     for node in doc.xpath(("//field[@name='line_ids']/tree//field[@name='credit']" )):

                            node.set('string', ('%s Credit' % (self.env.user.company_id.currency_id.name)))

        res['arch'] = etree.tostring(doc)

        return res


Avatar
Discard
Author Best Answer

Solved by changing default view tree in context of line_ids in account.move.form view

Avatar
Discard