提交 afef8d8f authored 作者: 贺阳's avatar 贺阳

查询尾程交货数据时,判断时间是否倒序了

上级 882d5dbe
...@@ -20,7 +20,7 @@ class PDAScanRecord(models.Model): ...@@ -20,7 +20,7 @@ class PDAScanRecord(models.Model):
self.record_type = 'handover' self.record_type = 'handover'
operator_id = fields.Many2one('res.users', string='操作人', required=True) operator_id = fields.Many2one('res.users', string='操作人', required=True)
# operation_time = fields.Datetime(string='操作时间', required=True, default=fields.Datetime.now) operation_time = fields.Datetime(string='操作时间', required=True, default=fields.Datetime.now)
operation = fields.Selection([ operation = fields.Selection([
('bill_tally', _('Bill Tally')), # 按提单理货 ('bill_tally', _('Bill Tally')), # 按提单理货
('tail_tally', _('Tail Tally')), # 按尾程理货 ('tail_tally', _('Tail Tally')), # 按尾程理货
...@@ -43,7 +43,7 @@ class PDAScanRecord(models.Model): ...@@ -43,7 +43,7 @@ class PDAScanRecord(models.Model):
failure_reason = fields.Char(string=_('Failure Reason')) # 失败原因 failure_reason = fields.Char(string=_('Failure Reason')) # 失败原因
@api.model @api.model
def create_scan_record(self, operation, record_type, bill_number, transfer_number, state, operator_id=False, bl_id=False,failure_reason=False): def create_scan_record(self, operation, record_type, bill_number, transfer_number, state, operator_id=False, bl_id=False, failure_reason=False, operation_time=False):
""" """
创建扫码记录的方法,供接口调用 创建扫码记录的方法,供接口调用
Create scan record method for API calls Create scan record method for API calls
...@@ -58,7 +58,8 @@ class PDAScanRecord(models.Model): ...@@ -58,7 +58,8 @@ class PDAScanRecord(models.Model):
if bl_obj: if bl_obj:
bl_id = bl_obj.id bl_id = bl_obj.id
record = self.create({ # 准备创建记录的数据
record_data = {
'operator_id': operator_id, 'operator_id': operator_id,
'operation': operation, 'operation': operation,
'record_type': record_type, 'record_type': record_type,
...@@ -67,7 +68,13 @@ class PDAScanRecord(models.Model): ...@@ -67,7 +68,13 @@ class PDAScanRecord(models.Model):
'bl_id': bl_id, 'bl_id': bl_id,
'state': state, 'state': state,
'failure_reason': failure_reason 'failure_reason': failure_reason
}) }
# 如果传入了自定义操作时间,使用它
if operation_time:
record_data['operation_time'] = operation_time
record = self.create(record_data)
return { return {
'success': True, 'success': True,
'record_id': record.id, 'record_id': record.id,
......
...@@ -7,9 +7,7 @@ ...@@ -7,9 +7,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree string="PDA Scan Record" decoration-info="state == 'success'" decoration-danger="state == 'failed'"> <tree string="PDA Scan Record" decoration-info="state == 'success'" decoration-danger="state == 'failed'">
<field name="operator_id" /> <field name="operator_id" />
<field name="create_date"/> <field name="operation_time"/>
<!-- <field name="operator_id"/>
<field name="operation_time"/> -->
<field name="operation"/> <field name="operation"/>
<field name="record_type"/> <field name="record_type"/>
<field name="bill_number"/> <field name="bill_number"/>
...@@ -34,9 +32,7 @@ ...@@ -34,9 +32,7 @@
<group> <group>
<group> <group>
<field name="operator_id" /> <field name="operator_id" />
<field name="create_date"/> <field name="operation_time"/>
<!-- <field name="operator_id"/>
<field name="operation_time"/> -->
<field name="operation"/> <field name="operation"/>
</group> </group>
<group> <group>
...@@ -61,7 +57,7 @@ ...@@ -61,7 +57,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<search string="PDA Scan Record"> <search string="PDA Scan Record">
<field name="operator_id"/> <field name="operator_id"/>
<field name="create_date"/> <field name="operation_time"/>
<field name="operation"/> <field name="operation"/>
<field name="record_type"/> <field name="record_type"/>
<field name="bill_number"/> <field name="bill_number"/>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论