Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
2 Odpowiedzi
3483 Widoki

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

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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?

Awatar
Odrzuć
Najlepsza odpowiedź

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


Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
2
paź 19
4035
0
cze 22
2160
4
lut 25
2291
2
lut 25
5787
1
gru 24
1370