我试图做一个很好的接待,其交易得到它的日期,但良好的接收保持日期,当我点击所有交易列表视图显示所有其他信息,但日期是空白;任何帮助PLZ
class goods_reception(models.Model):
_name = "rcs.goods_reception"
name = fields.Char(compute='compute_name')
reference = fields.Char(string="Reference Document")
warehouse = fields.Many2one("stock.warehouse", string="Prison", readonly="1")
supplier = fields.Many2one("res.partner", string="Supplier", required=True)
received_goods = fields.One2many("rcs.stock_transaction", "reception")
received_by = fields.Many2one("res.users", readonly=True)
date = fields.Date(required=True)
state = fields.Selection([
('pending', "Pending"),
('received', "Received"),
], default='pending', readonly=True)
@api.one
def compute_name(self):
#check
self.name = "Reception No:"+str(self.id)+", Supplier:"+self.supplier.name+", Date:"+self.date
@api.model
def create(self, vals):
vals['received_by'] = self.env.user.id
vals['warehouse'] = self.env.user.warehouse.id
return super(goods_reception, self).create(vals)
@api.one
def action_pending(self):
self.state = 'pending'