Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
2 Replies
3479 Tampilan

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
Buang
Penulis Jawaban Terbai

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
Buang
Jawaban Terbai

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
Buang
Post Terkait Replies Tampilan Aktivitas
2
Okt 19
4035
0
Jun 22
2159
4
Feb 25
2290
2
Feb 25
5786
1
Des 24
1370