Skip to Content
Menu
This question has been flagged
2 Replies
2781 Views

Hi,

I want to add a related field on amount_untaxed from account_invoice but in the same table but with different name

in this case I'm getting zero

 the python:

_inherit = 'account.invoice'

_columns = {

'amount_untaxed_employee': fields.related('id','amount_untaxed',type='float', size=64, relation="account.invoice", string="Subtotal", store=True)

the xml:

 

<record model="ir.ui.view" id="cc_invoice_tree">

<field name="name">Tree Invoice</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_tree" />

<field name="arch" type="xml">

<field name="amount_untaxed" position="after">

<field name="amount_untaxed_employee"/>

</field>

</field>

</record>




Avatar
Discard
Best Answer

read this below code and this code is helpful for you
class ware_pack_type(osv.Model):
    _inherit = 'stock.picking.out'
    _columns = {
        'sale_id': fields.many2one('sale.order', 'sale order'),
        'ware_pack_type': fields.related('sale_id', 'sale_pack_type', type='selection', selection=PACKAGE_TYPE_SELECTION, readonly=True, store=True, string='Packaging Type'),
    }
Avatar
Discard
Best Answer

Try like this:

_inherit = 'account.invoice'

_columns = {

'amount_untaxed_employee': fields.related('amount_untaxed',type='float', string="Subtotal", store=True)

}


Avatar
Discard