تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
5361 أدوات العرض

I have a computed field named 'balance' which has store=True, computed from credit-debit formula, and I can update this from customer's payment or invoice moves with using @api.depends. The question is this -> When balance is $100.00, I try receiving payment, let's say $30.00. Credit-debit now equals $70.00, but balance isn't changed. When to receive $20.00 more, the formula equals $50.00, but balance is changed to $70.00, which is the previous value of the formula.

So, how to sync triggered actions and computed fields? Thanks in advance...

payment_ids = fields.One2many('account.payment', 'partner_id', string="Payments", readonly=True, copy=False)

@api.one
@api.depends('invoice_ids','payment_ids')
def _balancecalc(self):
    for record in self:
        record.balance = record.credit - record.debit

balance = fields.Float(string="Balance", compute="_balancecalc", store=True)
الصورة الرمزية
إهمال
الكاتب

Ok, I found a field, move_name in account.payments. As far as I see, move_name field used after payment registeration. My model inherited from res.partner. How can I check from my class that whether if move_name field is updated? Thanks in advance.

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
يونيو 25
15187
2
مايو 25
760
3
أبريل 25
5293
Compute Fields تم الحل
2
يوليو 24
2173
1
يناير 24
1679