跳至内容
菜单
此问题已终结
2 回复
3524 查看

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

形象
丢弃
编写者 最佳答案

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?

形象
丢弃
最佳答案

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


形象
丢弃
相关帖文 回复 查看 活动
2
10月 19
4072
0
6月 22
2224
4
2月 25
2443
2
2月 25
5899
1
12月 24
1450