Web 从网站前端Odoo 11.0生成与任务相关的新时间表

Web 从网站前端Odoo 11.0生成与任务相关的新时间表,web,frontend,odoo,odoo-11,Web,Frontend,Odoo,Odoo 11,我正在制作一个模块,让用户阅读并添加任务时间表,还有一些其他功能(如使用的材料…费用等) 这里是我需要存储到db中的输入字段的视图 <div class='row' style="margin: 5px;"> <div class="col-md-12 col-sm-12" style="margin-top: 15px;"> <button class="btn btn-default" onc

我正在制作一个模块,让用户阅读并添加任务时间表,还有一些其他功能(如使用的材料…费用等)

这里是我需要存储到db中的输入字段的视图

       <div class='row' style="margin: 5px;">
            <div class="col-md-12 col-sm-12" style="margin-top: 15px;">
                <button class="btn btn-default" onclick="openTab('TimeSheet')">TimeSheet</button>
                <button class="btn btn-default" onclick="openTab('Materials')">Materials</button>
                <button class="btn btn-default" onclick="openTab('Expenses')">Expenses</button>
                <button type="submit" class="btn btn-default">Signature</button>
            </div>

            <div id="TimeSheet" class="col-md-12 tabs" style="display:none">
                <h2>Add new TimeSheet</h2>
                <form action="/my/taskReport/add/">
                    <div class="form-group">
                        <input type="hidden" name="task_id" t-attf-value="{{ task.id }}"
                               class="o_website_from_input form-control"/>

                        <label class="control-label" for="data">Data:</label>
                        <input type="date" name="date" class="o_website_from_input form-control"/>
                        <br/>
                        <label class="control-label" for="employee">Employee:</label>
                        <input type="text" name="partner_id" class="o_website_from_input form-control"
                               t-att-value="user.name"/>
                        <br/>
                        <label class="control-label" for="description">Description:</label>
                        <textarea type="text" name="description" class="o_website_from_input form-control"/>
                        <br/>
                        <label class="control-label" for="duration">Duration:</label>
                        <input type="time" name="unit_amount" class="o_website_from_input form-control"
                               value="00:00"/>
                        <br/>
                    </div>
                    <button type="submit" class="btn btn-default">Submit</button>
                </form>
            </div>
问题是无法存储时间表。
有人能帮忙吗?

这个问题与post.get()使用的参数有关


通过使用int()强制转换partner_id,我不会得到错误,因为post.get('partner_id')返回的字符串的值不是id的整数

是否确实要为模型
项目任务创建记录?我不记得那个模型上的单位金额、分辨率模型和分辨率id之类的字段。它是odoo 11。。。。我认为还有其他一些模型继承了project.task。无论如何,我发现了问题,我会回答我的问题!谢谢
@http.route(['/my/taskReport/add/'],
            type='http',
            auth="user",
            methods=['POST', 'GET'],
            csrf=False,
            website=True)
def project_task_report_add_timesheet(self, task_id, **post):

    timesheet_value = {
        'date': post.get('date'),
        'partner_id': post.get('partner_id'),
        'description': post.get('description'),
        'unit_amount': post.get('unit_amount'),
        'res_model': 'project.task',
        'res_id': task_id,
    }
    timesheet_id = request.env['project.task'].sudo().create(timesheet_value)

    return werkzeug.utils.redirect('/my/tasksReport/')
@http.route(['/my/taskReport/add/'],
            type='http',
            auth="user",
            methods=['POST', 'GET'],
            csrf=False,
            website=True)
def project_task_report_add_timesheet(self, task_id, **post):

    timesheet_value = {
        'date': post.get('date'),
        'partner_id': int(post.get('partner_id')),
        'description': post.get('description'),
        'unit_amount': post.get('unit_amount'),
        'res_model': 'project.task',
        'res_id': task_id,
    }
    timesheet_id = request.env['project.task'].sudo().create(timesheet_value)

    return werkzeug.utils.redirect('/my/tasksReport/')