Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 未选择良好接收日期的交易_Python_Date_Openerp - Fatal编程技术网

Python 未选择良好接收日期的交易

Python 未选择良好接收日期的交易,python,date,openerp,Python,Date,Openerp,我试图让一个好的接待,其交易得到它的日期,但良好的接待持有的日期,当我点击所有交易的列表视图显示所有其他信息,但日期是空的;有什么帮助吗 class goods_reception(models.Model): _name = "rcs.goods_reception" name = fields.Char(compute='compute_name') reference = fields.Char(string="Reference Doc

我试图让一个好的接待,其交易得到它的日期,但良好的接待持有的日期,当我点击所有交易的列表视图显示所有其他信息,但日期是空的;有什么帮助吗

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'

当你试图保存商品接收时,它不是要求你设置日期吗?因为它是一个必填字段。找到它后,我用创建日期替换了日期,它工作了