修改货架货位关联移动历史调拨单关联
This commit is contained in:
@@ -6,8 +6,8 @@ import os
|
|||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
#from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
#from OCC.Extend.DataExchange import write_stl_file
|
||||||
|
|
||||||
|
|
||||||
class ResProductMo(models.Model):
|
class ResProductMo(models.Model):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo import fields, models, api
|
from odoo import fields, models, api
|
||||||
from quatotion import readSql, feature_recognize, auto_quatotion
|
#from quatotion import readSql, feature_recognize, auto_quatotion
|
||||||
|
|
||||||
__author__ = 'jinling.yang'
|
__author__ = 'jinling.yang'
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ import os
|
|||||||
import json
|
import json
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import requests
|
import requests
|
||||||
from OCC.Extend.DataExchange import read_step_file
|
#from OCC.Extend.DataExchange import read_step_file
|
||||||
from OCC.Extend.DataExchange import write_stl_file
|
#from OCC.Extend.DataExchange import write_stl_file
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
from odoo.modules import get_resource_path
|
from odoo.modules import get_resource_path
|
||||||
from odoo.exceptions import ValidationError, UserError
|
from odoo.exceptions import ValidationError, UserError
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import datetime
|
||||||
import logging
|
import logging
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
from odoo.osv import expression
|
from odoo.osv import expression
|
||||||
@@ -223,6 +224,23 @@ class ShelfLocation(models.Model):
|
|||||||
_description = '货架货位'
|
_description = '货架货位'
|
||||||
_order = 'name'
|
_order = 'name'
|
||||||
|
|
||||||
|
# current_location_id = fields.Many2one('sf.shelf.location', string='当前位置')
|
||||||
|
# # 目的位置
|
||||||
|
# destination_location_id = fields.Many2one('sf.shelf.location', string='目的位置')
|
||||||
|
current_move_ids = fields.One2many('stock.move.line', 'current_location_id', '当前位置调拨单')
|
||||||
|
destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单')
|
||||||
|
storage_time = fields.Datetime('入库时间', compute='_compute_location_status')
|
||||||
|
|
||||||
|
@api.depends('location_status')
|
||||||
|
def _compute_location_status(self):
|
||||||
|
for record in self:
|
||||||
|
if record.location_status == '占用':
|
||||||
|
record.storage_time = datetime.datetime.now()
|
||||||
|
if record.location_status == '空闲':
|
||||||
|
record.storage_time = False
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
name = fields.Char('名称', required=True, size=20)
|
name = fields.Char('名称', required=True, size=20)
|
||||||
barcode = fields.Char('编码', copy=False, size=15)
|
barcode = fields.Char('编码', copy=False, size=15)
|
||||||
|
|
||||||
@@ -452,7 +470,7 @@ class SfStockPicking(models.Model):
|
|||||||
if line:
|
if line:
|
||||||
if line.current_location_id:
|
if line.current_location_id:
|
||||||
line.current_location_id.product_sn_id = False
|
line.current_location_id.product_sn_id = False
|
||||||
line.current_location_id = False
|
line.current_location_id.location_status = '空闲'
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
|
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='location_id'][2]" position="after">
|
<xpath expr="//field[@name='location_id'][2]" position="after">
|
||||||
<field name="current_location_id"/>
|
<field name="current_location_id" force_save="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='location_dest_id'][2]" position="after">
|
<xpath expr="//field[@name='location_dest_id'][2]" position="after">
|
||||||
<field name="destination_location_id" domain="[
|
<field name="destination_location_id" domain="[
|
||||||
@@ -23,13 +23,31 @@
|
|||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="sf_view_move_line_tree" model="ir.ui.view">
|
||||||
|
<field name="name">sf.stock.move.line.tree</field>
|
||||||
|
<field name="model">stock.move.line</field>
|
||||||
|
<field name="inherit_id" ref="stock.view_move_line_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='location_id']" position="after">
|
||||||
|
<field name="current_location_id" force_save="1"/>
|
||||||
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='location_dest_id']" position="after">
|
||||||
|
<field name="destination_location_id" />
|
||||||
|
<!-- <field name="location_dest_id_product_type"/> -->
|
||||||
|
<!-- <field name="location_dest_id"/> -->
|
||||||
|
<field name="location_dest_id_value" invisible="1"/>
|
||||||
|
<!-- <button name="button_test" string="测试" type="object" class="oe_highlight"/> -->
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="sf_stock_move_line_form" model="ir.ui.view">
|
<record id="sf_stock_move_line_form" model="ir.ui.view">
|
||||||
<field name="name">sf.stock.move.line.form</field>
|
<field name="name">sf.stock.move.line.form</field>
|
||||||
<field name="model">stock.move.line</field>
|
<field name="model">stock.move.line</field>
|
||||||
<field name="inherit_id" ref="stock.view_move_line_form"/>
|
<field name="inherit_id" ref="stock.view_move_line_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//form//sheet//group//group//field[@name='location_id']" position="after">
|
<xpath expr="//form//sheet//group//group//field[@name='location_id']" position="after">
|
||||||
<field name="current_location_id" options="{'no_create': False}"/>
|
<field name="current_location_id" options="{'no_create': False}" force_save="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//form//sheet//group//group//field[@name='location_dest_id']" position="after">
|
<xpath expr="//form//sheet//group//group//field[@name='location_dest_id']" position="after">
|
||||||
<field name="destination_location_id" options="{'no_create': False}"/>
|
<field name="destination_location_id" options="{'no_create': False}"/>
|
||||||
|
|||||||
@@ -9,26 +9,82 @@
|
|||||||
<field name="name" string="名称"/>
|
<field name="name" string="名称"/>
|
||||||
<field name="barcode" string="编码"/>
|
<field name="barcode" string="编码"/>
|
||||||
<field name="location_type"/>
|
<field name="location_type"/>
|
||||||
<!-- <field name="check_state" widget="label_selection"-->
|
<!-- <field name="check_state" widget="label_selection"-->
|
||||||
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
<!-- options="{'classes': {'unchecked':'warning','checked': 'success'}}"/>-->
|
||||||
<!-- <button name="action_check" string="审核" type="object"-->
|
<!-- <button name="action_check" string="审核" type="object"-->
|
||||||
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
<!-- attrs="{'invisible': [('check_state','=', 'enable')]}"-->
|
||||||
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
<!-- groups="sf_warehouse.group_sf_stock_manager"-->
|
||||||
<!-- class="oe_highlight"/>-->
|
<!-- class="oe_highlight"/>-->
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 货架货位移动历史按钮-->
|
||||||
|
|
||||||
|
<record id="sf_stock_move_line_view_search" model="ir.ui.view">
|
||||||
|
<field name="name">sf.view.picking.form</field>
|
||||||
|
<field name="model">stock.move.line</field>
|
||||||
|
<field name="inherit_id" ref="stock.stock_move_line_view_search"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//field[@name='product_id']" position="after">
|
||||||
|
<field name='current_location_id'/>
|
||||||
|
<field name='destination_location_id'/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="stock_move_line_action1" model="ir.actions.act_window">
|
||||||
|
<field name="name">移动历史</field>
|
||||||
|
<field name="res_model">stock.move.line</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="search_view_id" ref="sf_stock_move_line_view_search"/>
|
||||||
|
<field name="view_id" ref="stock.view_move_line_tree"/>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">
|
||||||
|
产品移动历史
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<record id="view_shelf_location_form" model="ir.ui.view">
|
<record id="view_shelf_location_form" model="ir.ui.view">
|
||||||
<field name="name">Shelf Location form</field>
|
<field name="name">Shelf Location form</field>
|
||||||
<field name="model">sf.shelf.location</field>
|
<field name="model">sf.shelf.location</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Shelf Location">
|
<form string="Shelf Location">
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
|
<button string="生成货位" name="create_location" type="object" class="oe_highlight"
|
||||||
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
attrs="{'invisible': [('hide_shelf', '=', False)]}"/>
|
||||||
|
|
||||||
|
<!-- <button name="%(shelf_location_kanban_action_id)d"-->
|
||||||
|
<!-- type="action"-->
|
||||||
|
<!-- class="oe_stat_button"-->
|
||||||
|
<!-- context="{'search_default_maintenance_equipment_id': [active_id]}"-->
|
||||||
|
<!-- icon="fa-wrench">-->
|
||||||
|
<!-- <field string="目标位置调拨" name="destination_move_ids" widget="statinfo"/>-->
|
||||||
|
<!-- </button>-->
|
||||||
</header>
|
</header>
|
||||||
<sheet>
|
<sheet>
|
||||||
|
<div class="oe_button_box" name="button_box">
|
||||||
|
<button name="%(stock_move_line_action1)d"
|
||||||
|
type="action"
|
||||||
|
class="oe_stat_button"
|
||||||
|
context="{'search_default_current_location_id': [active_id]}"
|
||||||
|
icon="fa-exchange">
|
||||||
|
|
||||||
|
<field string="当前位置历史" name="current_move_ids" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
|
<button name="%(stock_move_line_action1)d"
|
||||||
|
type="action"
|
||||||
|
class="oe_stat_button"
|
||||||
|
context="{'search_default_destination_location_id': [active_id]}"
|
||||||
|
icon="fa-exchange">
|
||||||
|
|
||||||
|
<field string="目标位置历史" name="destination_move_ids" widget="statinfo"/>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
<group>
|
<group>
|
||||||
<field name="hide_shelf" invisible="1"/>
|
<field name="hide_shelf" invisible="1"/>
|
||||||
<field name="hide_location" invisible="1"/>
|
<field name="hide_location" invisible="1"/>
|
||||||
@@ -55,6 +111,7 @@
|
|||||||
<!-- <field name="product_type" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '占用')]}" widget="many2many_tags"/> -->
|
<!-- <field name="product_type" attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False), ('location_status', '=', '占用')]}" widget="many2many_tags"/> -->
|
||||||
<field name="location_status"
|
<field name="location_status"
|
||||||
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
attrs="{'invisible': [('hide_location', '=', False)], 'required': [('hide_location', '!=', False)]}"/>
|
||||||
|
<field name="storage_time" widget="datetime"/>
|
||||||
</group>
|
</group>
|
||||||
</sheet>
|
</sheet>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user