Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
7769 Zobrazení

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
Zrušit
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.

Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
0
bře 15
3657
1
led 16
5239
3
úno 23
22233
3
srp 16
10983
3
čvc 16
7864