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

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
Discard
Author

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.

Best Answer

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
Discard
Related Posts Replies Views Activity
0
Mar 15
2755
1
Jan 16
4099
3
Feb 23
20637
3
Aug 16
9909
3
Jul 16
6690