Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
7765 Visualizzazioni

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
Abbandona
Autore

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.

Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
0
mar 15
3657
1
gen 16
5238
3
feb 23
22233
3
ago 16
10983
3
lug 16
7864