odoo13笔记点

  • tree视图上上对某个字典进行排序(默认是asc升序,desc降序)

<tree default_order="applicant_date desc">
    <field name="applicant_date"/>
</tree>
  • 过程型的展示, 草稿----》已提交-----》审批中----》
<field name="state" widget="statusbar" readonly="1"/>
  • 在create和write函数中传入的参数vals值中是没有的,无法直接从vals中获取。那怎么样可以让create函数和write函数获取到只读字段的值呢,方法其实很简单
    force_save='1',字面意思就可以看出来,这个属性是强制保存的意思,这样,只读字段就可以保存了
<field name="hr_department_id" readonly="1" force_save="1"/>
  • xml中    default_focus="1"
     default_focus:该字段是否获得默认焦点
  • postgresql中批量更新数据的sql
UPDATE account_account SET distribution_id = B.id 
FROM eno_fin_account B WHERE A.code = B.code
  • odoo删除时弹框提示

def unlink(self):
    """
        重写删除函数
        :return:
    """
    for rec in self:
        if rec.state != 'created':
            raise ValidationError('仅允许删除状态为草稿的调动申请单!')
    return super(EnoHrApplicationResignation, self).unlink()
  • 继承原表,给原表中的下拉框里面添加值,即给selection中添加值
# 员工状态添加
def _selection_state(self):
    res = super(EnoHrEmployee, self)._selection_state()
    res += [
        ('to_be_hired', '待入职'),
        ('practice', '实习')
    ]
    return res

    state = fields.Selection(selection=_selection_state)
子类继承,给父类添加下拉框的内容
application_model = fields.Selection(selection_add=[('eno_hr', '人力资源')])

  • odoo中的已失效的挂件
<widget name="web_ribbon" title="已失效" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
  • odoo中两个时间的间隔
def get_difference_year(self, do_date):
"""获取日期do_date和当前日期的年份差"""
    if do_date:
        return relativedelta(fields.Date.today(), do_date).years
    else:
        return 0
  • postgresql根据查询的条件,然后删除对应的数据,套三级
delete from row_data where num not in(select mid from 
(select min(num) mid from row_data group by name,place,company,scale,salary,education,experience,label,welfare,type) as a);
  • odoo个性化导入按钮
<field name="context">{'src_action': 'sdszl_hpm_personal_position_import_action'}</field>
<act_window id="personal_position_import_action"
            name="导入"
            res_model="sdszl.hpm.personal.position.import"
            binding_model="sdszl.hpm.personal.position"
            view_mode="form"
            view_id="sdszl_hpm_personal_position_import_form"
            target="new"
            context="{'on_tree': '2', 'src_action': 'sdszl_hpm_personal_position_import_action'}"/>
  • postgresql还原数据库
pg_restore -d "数据库名"-h localhost -p 5432 -U postgres -O 
postgres是数据库角色名称
  • 进入docker容器内部
docker exec -it 容器名称 /bin/bash
  • 行表,明细行可以多选
<xpath expr="/form/sheet/notebook/page[1]/field[@name='eno_hpm_secondary_distribution_ids']"
                       position="attributes">
                    <attribute name="widget">multi_select_tree</attribute>
                    <attribute name="res_model">eno.hpm.employee</attribute>
                    <attribute name="res_field">name</attribute>
                </xpath>
  • python碰见setup.py的模块怎么安装

python setup.py build
python setup.py install
  • odoo中的many2One()字段,让其只能选一次

        widget="o2m_unique"

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

还是那个同伟伟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值