Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
3474 Vistas

Why it is false, this is the code

from import,
import
from time, date, time
from odoo.addons.base import

class AccountInvoice (models.Model)
_inherit = 'account.invoice'

backorder_id fields.Many2one = ('stock .picking' 'Back Order of' required = True )
date_invoice = fields.Date ("Invoices:")


@ api.multi
def _write (self, vals):
res = super (AccountInvoice, self) ._ write (vals)
print ("Min_Date:", self. backorder_id.min_date )
print ('=============================')
print ("Invoice:" + self.date_invoice)
return res


This code returns False, i want to get the date value of min_date but what I get is the boolean value False?

Thank u again

Avatar
Descartar
Autor Mejor respuesta

Hi Oliver, I'm still studying about Odoo and this is my task for for start but I still find hard the flow of Odoo :(  It is soo confusing , especially if I'm developing a module not from the scratch


I tried your code and it still returns False. Is it really returns a False value or it will return the actual value of the field I called using the many2one field?

Avatar
Descartar
Mejor respuesta

Has so much mistakes in your code.

Learn the coding before start developing.

Try this code and tell me what is happening.

from odoo import models, fields, api


class AccountInvoice(models.Model):
_inherit = 'account.invoice'

backorder_id = fields.Many2one('stock.picking', 'Back Order of', required=True)
date_invoice = fields.Date("Invoices:")

@api.multi
def _write(self, vals):
res = super(AccountInvoice, self)._write(vals)
print("Scheduled Date:", str(self.backorder_id.scheduled_date))
print("Min Date:", str(self.backorder_id.min_date))
print("Invoice:" + str(self.date_invoice))
return res


Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
2
oct 19
4029
0
jun 22
2157
4
feb 25
2282
2
feb 25
5774
1
dic 24
1364