I have value error in my classname here, what should I do?
from odoo import models,fields,api
from docutils.nodes import field
class AccountInvoices(models.Model):
_inherits = {'stock.picking':'backorder_id','account.invoice':'refund_invoice_id'}
backorder_id = fields.Many2one('stock.picking','Back Order of')
refund_invoice_id = fields.Many2one('account.invoice',string="Invoice for which this invoice is the refund")
@api.depends('backorder_id','refund_invoice_id')
def _write(self, vals):
print(self.backorder_id.min_date)
print('=============================')
print(self.refund_invoice_id.date_invoice)
return super(AccountInvoice,self)._write(vals)
I create a new classname but it doesn't accept it, what will I do to call the two models, I'm trying to fetch the field min_date from stock.picking and field date_invoice from account_invoice,
I tried to use this:
from odoo import models,fields,api
from docutils.nodes import field
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
backorder_id = fields.Many2one('stock.picking','Back Order of')
date_invoice = fields.Date("This is invoices")
@api.depends('backorder_id')
def _write(self, vals):
print(self.backorder_id.min_date)
print('=============================')
print(self.date_invoice)
return super(AccountInvoice,self)._write(vals)
But the value of backorder_id.min_date is False when the actual value is 2019-08-01
Hi Sudhir
Sorry, I dunno when to use each of the decorator and I tried to use the code u gave to me but the self.backorder_id.min_date still returns the False value. Why it still return a bool value? Thank u for correcting me sir :) and thank u again in advance