• odoo看板笔记


    案例0001
    odoo中看板使用
    #其中一定要many2one阶段字段名称 stage_id  <kanban default_group_by="stage_id">    否则 挂件widget="state_selection"会报错
    ''' <field name="kanban_state" widget="state_selection"/>
    '''
    看板默认分组当无此类型当值时也默认出现在看板里
    #对于odoo12来说  group_expand=''   对于selection类型
    state = fields.Selection([('a', "A"), ('b', "B"),('c', "C"), ('d', "D")], group_expand='_expand_states')
    
    def _expand_states(self, states, domain, order):
        # return all possible states, in order
        return [key for key, val in type(self).state.selection]
    
    
    
    
    
    案例0002
    #对于odoo12来说  group_expand=''   对于many2one类型
    stage_id = fields.Many2one('crm.stage', string='Stage', ondelete='restrict', track_visibility='onchange', index=True,
                               domain="['|', ('team_id', '=', False), ('team_id', '=', team_id)]",
                               group_expand='_read_group_stage_ids', default=lambda self: self._default_stage_id())
    kanban_state = fields.Selection([
    ('normal', 'Grey'),
    ('done', 'Green'),
    ('blocked', 'Red')], string='Kanban State',
    copy=False, default='normal', required=True)

    @api.multi
    def write(self, vals):
    now = fields.Datetime.now()
    if 'stage_id' in vals:
    # reset kanban state when changing stage
    if 'kanban_state' not in vals:
    vals['kanban_state'] = 'normal'
    result = super(Task, self).write(vals)
    return result
     



    @api.model
    def _read_group_stage_ids(self, stages, domain, order): """ Read group customization in order to display all the stages in the kanban view, even if they are empty """ stage_ids = stages._search([], order=order, access_rights_uid=SUPERUSER_ID) return stages.browse(stage_ids)
    <record id="accountant_income_expenditure_kanban_view" model="ir.ui.view">
                <field name="name">Accountant Expenditure Kanban</field>
                <field name="model">accountant.income.expenditure</field>
                <field name="arch" type="xml">
                    <kanban default_group_by="stage_id">
                        <field name="id"/>
                        <field name="image_small"/>
                        <field name="name"/>
                        <templates>
                            <t t-name="kanban-box">
                                <div class="oe_kanban_global_click">
                                    <div class="o_kanban_image">
                                        <img t-att-src="kanban_image('accountant.income.expenditure', 'image_medium', record.id.raw_value)" alt="事件"/>
                                    </div>
                                    <div class="oe_kanban_details">
                                        <strong class="o_kanban_record_title">
                                            <field name="name"/></strong>
                                        <div class="o_kanban_tags_section">
                                            <field name="in_out_put" />
                                        </div>
                                        <ul>
                                            <li><strong>金额: <field name="amount"></field></strong></li>
                                        </ul>
                                        <div name="tags"/>
                                        <div>
                                            <field name="leave_property" widget="priority"/>
    <field name="kanban_state" widget="state_selection"/> </div> </div> </div> </t> </templates> </kanban> </field> </record>
  • 相关阅读:
    Centos7下编译CDH版本hadoop源码支持Snappy压缩
    Sqoop异常:Please set $ACCUMULO_HOME to the root of your Accumulo installation.
    Sqoop入门
    Sqoop异常:Exception in thread "main" java.lang.NoClassDefFoundError: org/json/JSONObject
    Mac下配置多个SSH KEY访问远程Git服务
    ANDROID_MARS学习笔记_S02重置版_001_HanderLooperMessageThreadThreadLocal
    ANDROID_MARS学习笔记_S05_006_距离传感器
    ANDROID_MARS学习笔记_S05_005_方向传感器
    ANDROID_MARS学习笔记_S05_004_过滤杂质,得到真正的加速度
    ANDROID_MARS学习笔记_S05_003_传感器采样率及属性
  • 原文地址:https://www.cnblogs.com/1314520xh/p/11386081.html
Copyright © 2020-2023  润新知