Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7707 มุมมอง

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")

อวตาร
ละทิ้ง
ผู้เขียน

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.

คำตอบที่ดีที่สุด

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.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 15
3604
1
ม.ค. 16
5180
3
ก.พ. 23
22186
3
ส.ค. 16
10943
3
ก.ค. 16
7820