Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
7685 Vistas

Hi,

I'm trying to translate this fields but I can't find documentation about Store parameter 


'total_deposit_amount': fields.function(

_get_total_deposit_amount_,

method=True,

type='float',

string='Total of deposit',

digits_compute=dp.get_precision('Deposit'),

store={ 'account.dp.iva.line.tax': ( lambda self, cr, uid, ids, c={}: ids, ['amount'], 15 ) },

fnct_inv=_set_total_dpt,

help="The total of the deposit"),


I have this

total_deposit_amount = fields.Float(compute="_get_total_deposit_amount_", inverse="_set_total_dpt", string='Total of deposit',

digits_compute=dp.get_precision('Deposit'),help="The total of the deposit")

Avatar
Descartar
Autor

Can you tell me how to translate de lambda expresion please

lambda expression is just an function without name. So, you can make any function and call it.

Mejor respuesta

Hi,

In new api you need to define @api.depends instead of the store parameter. Please have a look on the method of account.invoice to calculate all amounts.

@api.one

@api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount', 'currency_id', 'company_id')

def _compute_amount(self):

    . . . .

This is in new api. Inside @api.depends you need to give the fields name. Odoo will manage calling of the method when value of the given field is changed. In given example invoice_line_ids is field of "account.invoice.line" and tax_line_ids is field of "account.invoice.tax" model.

In your case you need to define you function like...

@api.one

@api.depends(<field_of_model'account.dp.iva.tax'>.amount)

def _get_total_deposit_amount_(self)

    . . . .


I hope you will convert correctly.


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
0
mar 15
3599
1
ene 16
5164
3
feb 23
22179
3
ago 16
10931
3
jul 16
7817