I need to store some computation field value in Database.
In account_invoice, I have days_since_invoice compute field.
days_since_invoice = fields.Float(string='Days Since Invoice', compute='_compute_days_since_invoice',
readonly=True, store=True)
@api.one
def _compute_days_since_invoice(self):
today_date = dt.datetime.now().strftime('%Y-%m-%d')
self.days_since_invoice = days_diff(self.date_invoice, today_date)
I used store=True in days_since_invoice field for storing values in database.
If I use store=True, computation function is not working. So in db wrong values are stored.
If i not use store=True, computation function is working properly.
I need to store this field value in db for reporting purpose. Because i am looping the invoices for generating report. It takes lot of time to generate. And also proxy error comes while generating report. If this compute field value in db means, I use query to generate the report.
so Any body give some idea to store compute field value in database.