码迷,mamicode.com
首页 > 其他好文 > 详细

odoo12动作里添加向导

时间:2019-08-27 23:30:00      阅读:321      评论:0      收藏:0      [点我收藏+]

标签:for   time   动作   transient   菜单   type   添加   base64   datetime   


在odoo12的 动作里添加向导


例子1:只会在tree视图里显示,不会在form里显示
 <act_window id="action_change_stage_ttest"
name="测试菜单"
src_model="sale.task"
res_model="test.project.shadow.wizard"
view_mode="tree,form"
view_type="form"
target="new"
key2="client_action_multi"
multi="True"
/>





例子2:会在form和tree视图里显示,

<record id="action_change_stage_ttest_inv" model="ir.actions.act_window">
<field name="name">测试任务</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">test.project.shadow.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<!-- TODO: check if we need this -->
<field name="binding_model_id" ref="sale.model_project_task" />
</record>



对应的向导
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import UserError
from odoo.tools.translate import _
import xlrd, base64, datetime
import psycopg2


class TESTProjectShadowWizard(models.TransientModel):
_name = ‘test.project.shadow.wizard‘
_description = u‘测试‘


date_plan = fields.Date(string=u‘计划日期‘)
date_done = fields.Date(string=u‘完成日期‘)
employee_id = fields.Many2one(‘hr.employee‘, string=u‘新人‘ ,track_visibility=‘onchange‘)


@api.multi
def btm_confirm(self):
pass




对应视图:
<record id="test_project_shadow_wizard_form" model="ir.ui.view">
<field name="name">test.project.shadow.wizard.form</field>
<field name="model">test.project.shadow.wizard</field>
<field name="arch" type="xml">
<form>
<group>
<group>
<field name="employee_id" />
<field name="date_plan" />
<field name="date_done" />
</group>
</group>
<footer>
<button name="btm_confirm" string="确认" type="object" class="oe_highlight"/>
or
<button special="cancel" string="取消" class="oe_link"/>
</footer>
</form>
</field>
</record>



 

例子2:会在form和tree视图里显示,


<record id="action_change_stage_test_inv" model="ir.actions.act_window">
<field name="name">测试任务</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">test.project.shadow.wizard</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<!-- TODO: check if we need this -->
<field name="binding_model_id" ref="sale.model_sale_task" />
</record>

odoo12动作里添加向导

标签:for   time   动作   transient   菜单   type   添加   base64   datetime   

原文地址:https://www.cnblogs.com/1314520xh/p/11421075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!