物流相关可见性控制

This commit is contained in:
mgw
2023-11-27 15:40:16 +08:00
parent 54912f15b9
commit 96df8f971c
3 changed files with 41 additions and 21 deletions

View File

@@ -66,8 +66,8 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
// } // }
// 判断 this.state.columns 是否存在且长度大于零 // 判断 this.state.columns 是否存在且长度大于零
if (this.state.columns && this.state.columns.length > 0 && if (this.state.columns && this.state.columns.length > 0
this.state.columns[0].name === "sequence") { && this.state.columns[0].name === "sequence") {
widths[1] = { type: "relative", value: 0.1 }; widths[1] = { type: "relative", value: 0.1 };
} }

View File

@@ -40,6 +40,13 @@ class JdEclp(models.Model):
# bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf') # bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas') # bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
bill_show = fields.Binary(string='物流面单展示', readonly=True) bill_show = fields.Binary(string='物流面单展示', readonly=True)
check_out = fields.Char(string='查询是否为出库单', compute='_check_is_out')
@api.depends('name')
def _check_is_out(self):
if self.name:
is_check_out = self.name.split('/')
self.check_out = is_check_out[1]
@api.depends('carrier_tracking_ref') @api.depends('carrier_tracking_ref')
def query_bill_pdf(self): def query_bill_pdf(self):

View File

@@ -1,14 +1,27 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<odoo> <odoo>
<record id="add_check_out_view_picking_form" model="ir.ui.view">
<field name="name">增加一个check_out字段</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml">
<xpath expr="//form//sheet//div[@name='button_box']" position="inside">
<field name="check_out" invisible="True"/>
</xpath>
</field>
</record>
<record id="custom_view_picking_form" model="ir.ui.view"> <record id="custom_view_picking_form" model="ir.ui.view">
<field name="name">物流</field> <field name="name">物流</field>
<field name="model">stock.picking</field> <field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form"/> <field name="inherit_id" ref="stock.view_picking_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//form//header" position="inside"> <xpath expr="//form//header//button[@name='action_assign']" position="after">
<button string="京东物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"/> <button string="京东物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"/> attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"
attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
</xpath> </xpath>
</field> </field>
</record> </record>
@@ -20,24 +33,24 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//group//field[@name='carrier_id']" position="after"> <xpath expr="//group//field[@name='carrier_id']" position="after">
<!-- <field name="senderNickName" domain="[('self.name', 'like', '%OUT%')]"/> --> <!-- <field name="senderNickName" domain="[('self.name', 'like', '%OUT%')]"/> -->
<field name="senderNickName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="senderNickName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="expressItemName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="expressItemName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="deliveryType" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="deliveryType" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverMobile" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverMobile" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverProvinceName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverProvinceName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverCityName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverCityName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverCountyName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverCountyName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverTownName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverTownName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="receiverCompany" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="receiverCompany" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="remark" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/> <field name="remark" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="grossWeight"/> <field name="grossWeight" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="grossVolume"/> <field name="grossVolume" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="pickupBeginTime"/> <field name="pickupBeginTime" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
<field name="bill_show"/> <field name="bill_show" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
</xpath> </xpath>
<xpath expr="//group//field[@name='group_id']" position="after"> <xpath expr="//group//field[@name='group_id']" position="after">
<field name="bill_show" widget="pdf_viewer"/> <field name="bill_show" widget="pdf_viewer" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
</xpath> </xpath>
<!-- <xpath expr="//group[@name='other_infos']" position="after"> --> <!-- <xpath expr="//group[@name='other_infos']" position="after"> -->
<!-- <div> --> <!-- <div> -->