+41
-10
@@ -1,27 +1,39 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { Component, useRef } from "@odoo/owl";
|
||||
|
||||
import { Component, useState, onWillStart } from "@odoo/owl";
|
||||
import { useService } from "@web/core/utils/hooks";
|
||||
export class QuickFilter extends Component {
|
||||
setup() {
|
||||
super.setup();
|
||||
// this.activeFilterIds = this.props.activeFilterIds;
|
||||
this.orm = useService("orm");
|
||||
this.state = useState({ filters: [] });
|
||||
this.activeFilterIds = this.env.searchModel.headerSearchInfo.quickFilter[this.props.groupId]?.filters || [];
|
||||
onWillStart(async () => {
|
||||
await this.loadFilters();
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回过滤器列表
|
||||
*/
|
||||
get filters() {
|
||||
// 通过ID查询过滤器列表
|
||||
const filters = this.env.searchModel.headerSearchInfo.headerQuickFilter[this.props.id].filters || [];
|
||||
filters.forEach((filter,fdx) => {
|
||||
filter.isChecked = this.activeFilterIds.includes(filter.inputId);
|
||||
filter.index = fdx + 1;
|
||||
});
|
||||
return filters;
|
||||
// 这里直接返回 state,避免在 getter 里做异步
|
||||
return this.state.filters;
|
||||
}
|
||||
|
||||
async loadFilters() {
|
||||
const { searchModel } = this.env;
|
||||
const resModel = searchModel.resModel;
|
||||
const filters = searchModel.headerSearchInfo.headerQuickFilter[this.props.id]?.filters || [];
|
||||
for (let [idx, filter] of filters.entries()) {
|
||||
const domain = this.safeParseDomain(filter.domain);
|
||||
const count = await this.orm.searchCount(resModel, domain);
|
||||
filter.count = count;
|
||||
filter.isChecked = this.activeFilterIds.includes(filter.inputId);
|
||||
filter.index = idx + 1;
|
||||
}
|
||||
this.state.filters = filters;
|
||||
}
|
||||
/**
|
||||
* 设置活动的过滤器
|
||||
*/
|
||||
@@ -75,6 +87,24 @@ export class QuickFilter extends Component {
|
||||
this.env.searchModel.applyHeaderFilters();
|
||||
|
||||
}
|
||||
safeParseDomain(domain) {
|
||||
if (Array.isArray(domain)) {
|
||||
return domain; // 已经是数组
|
||||
}
|
||||
if (typeof domain === "string") {
|
||||
try {
|
||||
// 替换 Python tuple 为 JS 数组
|
||||
const jsDomain = domain
|
||||
.replace(/\(/g, "[")
|
||||
.replace(/\)/g, "]");
|
||||
return JSON.parse(jsDomain.replace(/'/g, '"'));
|
||||
} catch (e) {
|
||||
console.warn("无法解析 domain:", domain, e);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
QuickFilter.template = "header_search_panel.QuickFilter";
|
||||
@@ -91,4 +121,5 @@ QuickFilter.props = {
|
||||
groupId: { type: Number, required: true },
|
||||
// 显示label
|
||||
showLabel: { type: Boolean, required: false, default: true },
|
||||
resModel: { type: String }
|
||||
}
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<label class="btn btn-primary" t-att-for="filter.inputId" >
|
||||
<t t-esc="filter.description"/>
|
||||
<span class="filter-badge" t-if="filter.show_number">
|
||||
<t t-esc="filter.index"/>
|
||||
<t t-esc="filter.count"/>
|
||||
</span>
|
||||
</label>
|
||||
<!-- End Edit -->
|
||||
|
||||
@@ -36,7 +36,7 @@ export class HeaderSearchFilter extends Component {
|
||||
}
|
||||
|
||||
get class() {
|
||||
return this.env.searchModel.headerSearchInfo.class;
|
||||
return this.env.searchModel.headerSearchInfo.class;
|
||||
}
|
||||
|
||||
// 点击筛选按钮显示筛选面板
|
||||
@@ -74,7 +74,7 @@ export class HeaderSearchFilter extends Component {
|
||||
// 存储筛选ID的列表
|
||||
const searchItems = this.env.searchModel.headerSearchInfo.searchItems;
|
||||
const items = [];
|
||||
for (let {id, type} of searchItems) {
|
||||
for (let { id, type } of searchItems) {
|
||||
// 解析所有筛选,根据类型决定使用不同的组件
|
||||
switch (type) {
|
||||
case "field":
|
||||
|
||||
@@ -750,16 +750,15 @@ class AppletAttendance(Controller):
|
||||
first_day_str = first_day.strftime('%Y-%m-%d')
|
||||
last_day_str = last_day.strftime('%Y-%m-%d')
|
||||
|
||||
# 去掉 数据为 0 的数据.
|
||||
electric_records = request.env(user=SUPERUSER_ID)['meter.archives.line'].search([
|
||||
('archives_state', '=', 'use'),
|
||||
('current_read', '=', 0),
|
||||
('meter_date', '>=', first_day_str),
|
||||
('meter_date', '<=', last_day_str)
|
||||
])
|
||||
|
||||
water_records = request.env(user=SUPERUSER_ID)['meter.water.line'].search([
|
||||
('water_state', '=', 'use'),
|
||||
('current_read', '=', 0),
|
||||
('meter_date', '>=', first_day_str),
|
||||
('meter_date', '<=', last_day_str)
|
||||
])
|
||||
@@ -803,6 +802,7 @@ class AppletAttendance(Controller):
|
||||
'epitope_values':electric.epitope_values_id.name,
|
||||
'unit_number':electric.unit_number,
|
||||
'state': electric.state, # 状态 reading unreading
|
||||
'last_read': electric.last_read,
|
||||
}
|
||||
|
||||
electric_result_dict.setdefault(state, {}).setdefault(building,{}).setdefault(floor, []).append(electric_value)
|
||||
@@ -861,6 +861,7 @@ class AppletAttendance(Controller):
|
||||
'epitope_values':water.epitope_values_id.name,
|
||||
'unit_number':water.unit_number,
|
||||
'state': water.state, # 状态 reading unreading
|
||||
'last_read': water.last_read,
|
||||
}
|
||||
water_result_dict.setdefault(state, {}).setdefault(building,{}).setdefault(floor, []).append(water_value)
|
||||
|
||||
@@ -916,7 +917,7 @@ class AppletAttendance(Controller):
|
||||
})
|
||||
record = request.env(user=SUPERUSER_ID)[model_name].browse(int(id))
|
||||
if record:
|
||||
record.write({'current_read': current_read,'last_reading_time':last_reading_time})
|
||||
record.write({'current_read': current_read,'last_reading_time':last_reading_time,'state':'reading'})
|
||||
# record.last_dosage += record.current_meter
|
||||
# record.current_meter = 0
|
||||
# record.last_meter = datetime.now()
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
<field name="due_date" readonly="1"/>
|
||||
<field name="due_date_end" readonly="1"/>
|
||||
<field name="payout_date" readonly="1"/>
|
||||
<field name="management_type_id" readonly="1"/>
|
||||
<field name="original_amount" readonly="1"/>
|
||||
<field name="discount_amount" readonly="1"/>
|
||||
<field name="delivered1" readonly="1"/>
|
||||
<field name="submitted" readonly="1"/>
|
||||
<field name="management_type_id" readonly="1"/>
|
||||
<field name="multiplier" column_invisible="1"/>
|
||||
<field name="is_push" optional="hide" readonly="1"/>
|
||||
<field name="reconciliation_time" optional="hide" readonly="1"/>
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<field name="bank_branch"/>
|
||||
<field name="name_account" />
|
||||
<field name="original_amount"/>
|
||||
<field name="yes_amount"/>
|
||||
<field name="yes_amount" string="已对"/>
|
||||
<field name="no_amount" />
|
||||
<field name="your_own_account" />
|
||||
<field name="your_own_unit" />
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<field name="model">yuthon.epitope.values</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="电水表位置" editable="bottom">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="sequence"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
|
||||
@@ -43,6 +43,7 @@ class PropertyBankStatements(models.Model):
|
||||
|
||||
contract_id = fields.Many2one('property.lease.contract', string="关联租赁合同审批")
|
||||
contract_ids = fields.Many2many('property.lease.contract', string="租赁合同审批")
|
||||
property_name = fields.Char(string="物业名称")
|
||||
accounts_id = fields.Many2one('property.accounts.approval', string="关联生成应收审批单")
|
||||
|
||||
def batch_revocation(self):
|
||||
@@ -393,6 +394,13 @@ class PropertyAccountsReceivable(models.Model):
|
||||
|
||||
actual_coping = fields.Float(string="实际应付")
|
||||
|
||||
def update_lessee_id(self):
|
||||
accounts_ids = self.env["property.accounts.receivable"].browse(
|
||||
self._context.get('active_ids', self._context.get('active_id')))
|
||||
for rec in accounts_ids:
|
||||
rec.lessee_id = rec.contract_id.lessee_id
|
||||
|
||||
|
||||
@api.depends('management_type_id')
|
||||
def _compute_is_rent(self):
|
||||
for rec in self:
|
||||
|
||||
@@ -293,11 +293,11 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='payout_date']" position="after">
|
||||
<field name="is_rent" column_invisible="1"/>
|
||||
<field name="property_name"/>
|
||||
<field name="property_ids" options="{'no_create': True}" widget="many2many_tags" column_invisible="1"/>
|
||||
<field name="lessee_id" options="{'no_create': True}" readonly="1"/>
|
||||
<field name="title_deed" readonly="1"/>
|
||||
<field name="company_id" column_invisible="1"/>
|
||||
<field name="property_ids" options="{'no_create': True}" widget="many2many_tags" column_invisible="1"/>
|
||||
<field name="property_name"/>
|
||||
<field name="contract_id" string="合同编号" options="{'no_create': True}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='receivable_log']" position="after">
|
||||
|
||||
Reference in New Issue
Block a user