Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -7,10 +7,11 @@
|
|||||||
'sequence': 1,
|
'sequence': 1,
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['hr'],
|
'depends': ['base', 'hr'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/hr_employee.xml',
|
'views/hr_employee.xml',
|
||||||
'views/res_config_settings_views.xml',
|
'views/res_config_settings_views.xml',
|
||||||
|
'views/res_users_view.xml',
|
||||||
'data/cron_data.xml',
|
'data/cron_data.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
|
|||||||
@@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
from . import hr_employee
|
from . import hr_employee
|
||||||
from . import res_config_setting
|
from . import res_config_setting
|
||||||
|
from . import res_users
|
||||||
|
|||||||
@@ -20,7 +20,9 @@ class JkmPracticeEmployee(models.Model):
|
|||||||
if result['employee_list']:
|
if result['employee_list']:
|
||||||
for employee_info in result['employee_list']:
|
for employee_info in result['employee_list']:
|
||||||
if employee_info['work_email']:
|
if employee_info['work_email']:
|
||||||
self.sudo().search([('work_email', '=', employee_info['work_email'])]).write(
|
hr_employee = self.sudo().search([('work_email', '=', employee_info['work_email'])])
|
||||||
{'we_id': employee_info['we_id']})
|
hr_employee.write({'we_id': employee_info['we_id']})
|
||||||
|
if hr_employee.user_id:
|
||||||
|
hr_employee.user_id.write({'we_employee_id': employee_info['we_id']})
|
||||||
else:
|
else:
|
||||||
logging.info('_employee_info_sync error:%s' % result['message'])
|
logging.info('_employee_info_sync error:%s' % result['message'])
|
||||||
|
|||||||
12
sf_hr/models/res_users.py
Normal file
12
sf_hr/models/res_users.py
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from odoo import models, fields, api
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
class ResUsers(models.Model):
|
||||||
|
_inherit = 'res.users'
|
||||||
|
|
||||||
|
we_employee_id = fields.Char(string=u'企业微信账号', default="")
|
||||||
20
sf_hr/views/res_users_view.xml
Normal file
20
sf_hr/views/res_users_view.xml
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="view_users_account_form" model="ir.ui.view">
|
||||||
|
<field name="name">res.users.account.form</field>
|
||||||
|
<field name="model">res.users</field>
|
||||||
|
<field name="inherit_id" ref="base.view_users_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<page name="preferences" position="after">
|
||||||
|
<page name="account" string="企业微信">
|
||||||
|
<group>
|
||||||
|
<field name="we_employee_id"/>
|
||||||
|
</group>
|
||||||
|
</page>
|
||||||
|
</page>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify'],
|
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify','stock'],
|
||||||
'data': [
|
'data': [
|
||||||
'data/bussiness_node.xml'
|
'data/bussiness_node.xml'
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -10,5 +10,21 @@
|
|||||||
<field name="name">确认接单</field>
|
<field name="name">确认接单</field>
|
||||||
<field name="model">sale.order</field>
|
<field name="model">sale.order</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="transfer_inventory" model="jikimo.message.bussiness.node">
|
||||||
|
<field name="name">调拨入库</field>
|
||||||
|
<field name="model">stock.picking</field>
|
||||||
|
</record>
|
||||||
|
<record id="tool_assembly" model="jikimo.message.bussiness.node">
|
||||||
|
<field name="name">功能刀具组装</field>
|
||||||
|
<field name="model">sf.functional.tool.assembly</field>
|
||||||
|
</record>
|
||||||
|
<record id="tool_dismantle" model="jikimo.message.bussiness.node">
|
||||||
|
<field name="name">功能刀具寿命到期</field>
|
||||||
|
<field name="model">sf.functional.tool.dismantle</field>
|
||||||
|
</record>
|
||||||
|
<record id="bussiness_material_purchase_remind" model="jikimo.message.bussiness.node">
|
||||||
|
<field name="name">坯料采购提醒</field>
|
||||||
|
<field name="model">purchase.order</field>
|
||||||
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -6,3 +6,4 @@ from . import sf_message_cam_program
|
|||||||
from . import sf_message_functional_tool_assembly
|
from . import sf_message_functional_tool_assembly
|
||||||
from . import sf_message_purchase
|
from . import sf_message_purchase
|
||||||
from . import sf_message_workorder
|
from . import sf_message_workorder
|
||||||
|
from . import sf_message_functional_tool_dismantle
|
||||||
@@ -3,4 +3,16 @@ from odoo import models, fields, api, _
|
|||||||
|
|
||||||
class SFMessagefunctionalToolAssembly(models.Model):
|
class SFMessagefunctionalToolAssembly(models.Model):
|
||||||
_name = 'sf.functional.tool.assembly'
|
_name = 'sf.functional.tool.assembly'
|
||||||
|
_description = "刀具组装单"
|
||||||
_inherit = ['sf.functional.tool.assembly', 'jikimo.message.dispatch']
|
_inherit = ['sf.functional.tool.assembly', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals):
|
||||||
|
result = super(SFMessagefunctionalToolAssembly, self).create(vals)
|
||||||
|
is_cam = False
|
||||||
|
for obj in result:
|
||||||
|
if obj.loading_task_source == '0' and obj.assemble_status == '0':
|
||||||
|
is_cam = True
|
||||||
|
if is_cam:
|
||||||
|
self.add_queue('功能刀具组装')
|
||||||
|
return result
|
||||||
|
|||||||
18
sf_message/models/sf_message_functional_tool_dismantle.py
Normal file
18
sf_message/models/sf_message_functional_tool_dismantle.py
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
from odoo import models, api
|
||||||
|
|
||||||
|
|
||||||
|
class SFMessagefunctionalToolDismantle(models.Model):
|
||||||
|
_name = 'sf.functional.tool.dismantle'
|
||||||
|
_description = "刀具拆解单"
|
||||||
|
_inherit = ['sf.functional.tool.dismantle', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def create(self, vals):
|
||||||
|
result = super(SFMessagefunctionalToolDismantle, self).create(vals)
|
||||||
|
is_dismantle = False
|
||||||
|
for obj in result:
|
||||||
|
if obj.dismantle_cause in ['寿命到期报废', '崩刀报废']and obj.state=='待拆解':
|
||||||
|
is_dismantle = True
|
||||||
|
if is_dismantle:
|
||||||
|
self.add_queue('功能刀具寿命到期')
|
||||||
|
return result
|
||||||
@@ -1,6 +1,17 @@
|
|||||||
|
import logging
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
class SFMessagePurchase(models.Model):
|
class SFMessagePurchase(models.Model):
|
||||||
_name = 'purchase.order'
|
_name = 'purchase.order'
|
||||||
_inherit = ['purchase.order', 'jikimo.message.dispatch']
|
_inherit = ['purchase.order', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
|
@api.model_create_multi
|
||||||
|
def create(self, vals_list):
|
||||||
|
res = super(SFMessagePurchase, self).create(vals_list)
|
||||||
|
if res:
|
||||||
|
try:
|
||||||
|
res.add_queue('坯料采购提醒')
|
||||||
|
except Exception as e:
|
||||||
|
logging.info('add_queue error:%s' % e)
|
||||||
|
return res
|
||||||
|
|||||||
@@ -3,4 +3,11 @@ from odoo import models, fields, api, _
|
|||||||
|
|
||||||
class SFMessageStockPicking(models.Model):
|
class SFMessageStockPicking(models.Model):
|
||||||
_name = 'stock.picking'
|
_name = 'stock.picking'
|
||||||
|
_description = "库存调拨"
|
||||||
_inherit = ['stock.picking', 'jikimo.message.dispatch']
|
_inherit = ['stock.picking', 'jikimo.message.dispatch']
|
||||||
|
|
||||||
|
def button_validate(self):
|
||||||
|
res = super(SFMessageStockPicking, self).button_validate()
|
||||||
|
if self.location_id.name == '进货' and self.location_dest_id.name == '刀具房':
|
||||||
|
self.add_queue('调拨入库')
|
||||||
|
return res
|
||||||
|
|||||||
@@ -9,4 +9,8 @@ class SfMessageTemplate(models.Model):
|
|||||||
def _get_message_model(self):
|
def _get_message_model(self):
|
||||||
res = super(SfMessageTemplate, self)._get_message_model()
|
res = super(SfMessageTemplate, self)._get_message_model()
|
||||||
res.append("sale.order")
|
res.append("sale.order")
|
||||||
|
res.append("stock.picking")
|
||||||
|
res.append('sf.functional.tool.assembly')
|
||||||
|
res.append('sf.functional.tool.dismantle')
|
||||||
|
res.append('purchase.order')
|
||||||
return res
|
return res
|
||||||
|
|||||||
BIN
sf_plan/static/description/计划.png
Normal file
BIN
sf_plan/static/description/计划.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 673 B |
@@ -278,6 +278,7 @@
|
|||||||
sequence="150"
|
sequence="150"
|
||||||
action="sf_production_plan_action"
|
action="sf_production_plan_action"
|
||||||
groups="sf_base.group_plan_dispatch"
|
groups="sf_base.group_plan_dispatch"
|
||||||
|
web_icon="sf_plan,static/description/计划.png"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- <record model="ir.ui.menu" id="mrp_custom_menu" inherit_id="mrp.menu_mrp_manufacturing"> -->
|
<!-- <record model="ir.ui.menu" id="mrp_custom_menu" inherit_id="mrp.menu_mrp_manufacturing"> -->
|
||||||
|
|||||||
@@ -74,6 +74,8 @@ class StockPicking(models.Model):
|
|||||||
|
|
||||||
def send_to_bfm(self):
|
def send_to_bfm(self):
|
||||||
skip_backorder = self.env.context.get('skip_backorder')
|
skip_backorder = self.env.context.get('skip_backorder')
|
||||||
|
cancel_backorder_ids = self.env.context.get('picking_ids_not_to_backorder')
|
||||||
|
|
||||||
# 下发发货到bfm
|
# 下发发货到bfm
|
||||||
config = self.env['res.config.settings'].get_values()
|
config = self.env['res.config.settings'].get_values()
|
||||||
move_ids, move_line_ids = self.deal_move_ids(self.move_ids, self.move_line_ids)
|
move_ids, move_line_ids = self.deal_move_ids(self.move_ids, self.move_line_ids)
|
||||||
@@ -92,13 +94,13 @@ class StockPicking(models.Model):
|
|||||||
'state': self.state,
|
'state': self.state,
|
||||||
'backorder_id': self.deal_send_backorder_id(self.backorder_id),
|
'backorder_id': self.deal_send_backorder_id(self.backorder_id),
|
||||||
'backorder_ids': self.deal_send_backorder_id(self.backorder_ids),
|
'backorder_ids': self.deal_send_backorder_id(self.backorder_ids),
|
||||||
'cancel_backorder_ids': skip_backorder,
|
'cancel_backorder_ids': True if skip_backorder and cancel_backorder_ids else False, # 没有欠单判断
|
||||||
'move_type': self.move_type,
|
'move_type': self.move_type,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
url1 = config['bfm_url_new'] + '/api/stock/deliver_goods'
|
url1 = config['bfm_url_new'] + '/api/stock/deliver_goods'
|
||||||
json_str = json.dumps(data)
|
json_str = json.dumps(data)
|
||||||
print('json_str', json_str)
|
logging.info('json_str= %s', json_str)
|
||||||
r = requests.post(url1, json=data, data=None)
|
r = requests.post(url1, json=data, data=None)
|
||||||
if r.status_code == 200:
|
if r.status_code == 200:
|
||||||
result = json.loads(r.json()['result'])
|
result = json.loads(r.json()['result'])
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ class jikimo_bom(models.Model):
|
|||||||
('cutting_tool_blade_diameter', '=', self.tool_inventory_id.diameter),
|
('cutting_tool_blade_diameter', '=', self.tool_inventory_id.diameter),
|
||||||
|
|
||||||
# r角
|
# r角
|
||||||
('cutting_tool_blade_tip_working_size', '=', self.tool_inventory_id.angle)]
|
('cutting_tool_blade_tip_r_size', '=', self.tool_inventory_id.angle)]
|
||||||
if option.name == '刀杆':
|
if option.name == '刀杆':
|
||||||
domain = ['&'] + domain + [
|
domain = ['&'] + domain + [
|
||||||
("cutting_tool_cutter_arbor_diameter", "=", self.tool_inventory_id.diameter)]
|
("cutting_tool_cutter_arbor_diameter", "=", self.tool_inventory_id.diameter)]
|
||||||
|
|||||||
Reference in New Issue
Block a user