Accept Merge Request #697: (feature/制造代码优化 -> develop)
Merge Request: 物流可见性控制,优化警告问题 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/697?initial=true
This commit is contained in:
@@ -3,9 +3,9 @@ import logging
|
||||
from datetime import datetime
|
||||
import requests
|
||||
import cpca
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo import api, fields, models, SUPERUSER_ID, _
|
||||
# from odoo.exceptions import UserError
|
||||
# from odoo.exceptions import ValidationError
|
||||
from odoo import api, fields, models
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -40,9 +40,22 @@ class JdEclp(models.Model):
|
||||
# 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)
|
||||
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')
|
||||
def query_bill_pdf(self):
|
||||
"""
|
||||
查询物流面单,并赋值给bill
|
||||
"""
|
||||
self.bill = self.env['ir.attachment'].sudo().search([('name', '=', self.carrier_tracking_ref)])
|
||||
|
||||
@api.depends('origin')
|
||||
@@ -77,7 +90,6 @@ class JdEclp(models.Model):
|
||||
self.receiverTownName = self.receiverTownName
|
||||
except Exception as e:
|
||||
print(f"Error address is none: {e}")
|
||||
pass
|
||||
|
||||
def create_order(self):
|
||||
# sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
|
||||
|
||||
@@ -212,7 +212,7 @@ class FinishStatusChange(models.Model):
|
||||
action['context'] = {'default_picking_ids': self.ids}
|
||||
return action
|
||||
|
||||
out_start_time = str(datetime.now())
|
||||
# out_start_time = str(datetime.now())
|
||||
json2 = {
|
||||
'params': {
|
||||
'model_name': 'jikimo.process.order',
|
||||
|
||||
@@ -1,14 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<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">
|
||||
<field name="name">物流</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form//header" position="inside">
|
||||
<button string="京东物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"/>
|
||||
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"/>
|
||||
<xpath expr="//form//header//button[@name='action_assign']" position="after">
|
||||
<button string="京东物流下单" name="create_order" 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>
|
||||
</field>
|
||||
</record>
|
||||
@@ -20,24 +33,24 @@
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//group//field[@name='carrier_id']" position="after">
|
||||
<!-- <field name="senderNickName" domain="[('self.name', 'like', '%OUT%')]"/> -->
|
||||
<field name="senderNickName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="expressItemName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="deliveryType" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverMobile" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverProvinceName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverCityName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverCountyName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverTownName" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="receiverCompany" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="remark" attrs="{'invisible': [('name', 'like', '%OUT%')]}"/>
|
||||
<field name="grossWeight"/>
|
||||
<field name="grossVolume"/>
|
||||
<field name="pickupBeginTime"/>
|
||||
<field name="bill_show"/>
|
||||
<field name="senderNickName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="expressItemName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="deliveryType" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverMobile" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverProvinceName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverCityName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverCountyName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverTownName" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="receiverCompany" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="remark" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="grossWeight" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="grossVolume" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="pickupBeginTime" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
<field name="bill_show" attrs="{'invisible': [('check_out', '!=', 'OUT')]}"/>
|
||||
</xpath>
|
||||
<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 expr="//group[@name='other_infos']" position="after"> -->
|
||||
<!-- <div> -->
|
||||
|
||||
Reference in New Issue
Block a user