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 resstate = 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_treeattribute> <attribute name="res_model">eno.hpm.employeeattribute> <attribute name="res_field">nameattribute> xpath>
- python碰见setup.py的模块怎么安装
python setup.py build python setup.py install
- odoo中的many2One()字段,让其只能选一次
widget="o2m_unique"