Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into develop
This commit is contained in:
@@ -10,11 +10,12 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.cs.jikimo.com',
|
'website': 'https://www.sf.cs.jikimo.com',
|
||||||
'depends': ['sf_base', 'base_setup'],
|
'depends': ['sf_base', 'base_setup','sf_bf_connect'],
|
||||||
'data': [
|
'data': [
|
||||||
'data/ir_cron_data.xml',
|
'data/ir_cron_data.xml',
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'views/res_config_settings_views.xml'
|
'views/res_config_settings_views.xml',
|
||||||
|
'views/order_price.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
from . import ftp_operate
|
from . import ftp_operate
|
||||||
from . import res_config_setting
|
from . import res_config_setting
|
||||||
from . import sync_common
|
from . import sync_common
|
||||||
|
from . import order_price
|
||||||
29
sf_mrs_connect/models/order_price.py
Normal file
29
sf_mrs_connect/models/order_price.py
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
from odoo import fields, models, api
|
||||||
|
|
||||||
|
|
||||||
|
class OrderPrice(models.Model):
|
||||||
|
_name = 'order.price'
|
||||||
|
_description = '订单价格对比'
|
||||||
|
sale_order_id = fields.Many2one('sale.order', '销售订单')
|
||||||
|
bfm_order_name = fields.Char(related="sale_order_id.default_code", string='bfm订单号')
|
||||||
|
sale_order_name = fields.Char(related="sale_order_id.name", string='销售订单号')
|
||||||
|
currency_id = fields.Many2one(
|
||||||
|
related='sale_order_id.currency_id', string='货币', store=True)
|
||||||
|
sale_order_amount_total = fields.Monetary(related="sale_order_id.amount_total", tracking=4, string='销售订单金额')
|
||||||
|
bfm_amount_total = fields.Float(string='价格合计', compute='_compute_bfm_amount_total', store=True)
|
||||||
|
|
||||||
|
def is_float(self,value):
|
||||||
|
try:
|
||||||
|
float(value)
|
||||||
|
return True
|
||||||
|
except ValueError:
|
||||||
|
return False
|
||||||
|
@api.depends('sale_order_id.remark')
|
||||||
|
def _compute_bfm_amount_total(self):
|
||||||
|
for record in self:
|
||||||
|
amount_total = 0
|
||||||
|
for line in record.sale_order_id.order_line:
|
||||||
|
# 判断remark是否存在并且是否是数字
|
||||||
|
if line.remark and self.is_float(line.remark):
|
||||||
|
amount_total += float(line.remark)
|
||||||
|
record.bfm_amount_total = amount_total
|
||||||
@@ -184,7 +184,10 @@ class ResConfigSettings(models.TransientModel):
|
|||||||
new_price = res_order_lines_map.get(str(index))
|
new_price = res_order_lines_map.get(str(index))
|
||||||
if order_line:
|
if order_line:
|
||||||
# 修改单价
|
# 修改单价
|
||||||
order_line.write({'remark': new_price})
|
order_line.write({'remark': new_price*order_line.product_uom_qty})
|
||||||
|
order_price = self.env['order.price'].sudo().search([('sale_order_id', '=',need_change_sale_order.id )])
|
||||||
|
if not order_price:
|
||||||
|
self.env['order.price'].sudo().create({'sale_order_id':need_change_sale_order.id})
|
||||||
else:
|
else:
|
||||||
logging.error('同步销售订单价格失败 {}'.format(response.text))
|
logging.error('同步销售订单价格失败 {}'.format(response.text))
|
||||||
raise UserError('同步销售订单价格失败')
|
raise UserError('同步销售订单价格失败')
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||||
access_sf_static_resource_datasync,sf_static_resource_datasync,model_sf_static_resource_datasync,base.group_user,1,1,1,1
|
access_sf_static_resource_datasync,sf_static_resource_datasync,model_sf_static_resource_datasync,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
access_order_price,order.price,model_order_price,base.group_user,1,1,1,1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
|
26
sf_mrs_connect/views/order_price.xml
Normal file
26
sf_mrs_connect/views/order_price.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<menuitem sequence="22" name="销售订单bfm对比" id="menu_sale_order_bfm_price"
|
||||||
|
action="order_price_tree_act"
|
||||||
|
parent="sale.sale_order_menu"
|
||||||
|
groups="base.group_user"
|
||||||
|
/>
|
||||||
|
<record model="ir.actions.act_window" id="order_price_tree_act">
|
||||||
|
<field name="name">bfm订单价格对比</field>
|
||||||
|
<field name="res_model">order.price</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
<record id="view_order_price_tree" model="ir.ui.view">
|
||||||
|
<field name="name">order.price.list</field>
|
||||||
|
<field name="model">order.price</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="订单计划">
|
||||||
|
<field name="bfm_order_name"/>
|
||||||
|
<field name="sale_order_name"/>
|
||||||
|
<field name="sale_order_amount_total"/>
|
||||||
|
<field name="bfm_amount_total"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</odoo>
|
||||||
@@ -75,16 +75,21 @@ class sf_production_plan(models.Model):
|
|||||||
if self.date_planned_start:
|
if self.date_planned_start:
|
||||||
self.date_planned_finished = self.date_planned_start + timedelta(hours=1)
|
self.date_planned_finished = self.date_planned_start + timedelta(hours=1)
|
||||||
|
|
||||||
#处理计划状态非代排程,计划结束时间为空的数据处理
|
#处理计划状态非待排程,计划结束时间为空的数据处理
|
||||||
def deal_no_date_planned_finished(self):
|
def deal_no_date_planned_finished(self):
|
||||||
plans = self.env['sf.production.plan'].search(
|
plans = self.env['sf.production.plan'].search(
|
||||||
[('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])])
|
[('date_planned_finished', '=', False), ('state', 'in', ['processing', 'done', 'finished'])])
|
||||||
for item in plans:
|
for item in plans:
|
||||||
if item.date_planned_start:
|
if item.date_planned_start:
|
||||||
item.date_planned_finished = item.date_planned_start + timedelta(hours=1)
|
item.date_planned_finished = item.date_planned_start + timedelta(hours=1)
|
||||||
if not item.order_deadline and item.date_planned_start:
|
|
||||||
item.order_deadline = item.date_planned_start + timedelta(days=7)
|
|
||||||
|
|
||||||
|
# 处理计划订单截止时间为空的数据
|
||||||
|
def deal_no_order_deadline(self):
|
||||||
|
plans = self.env['sf.production.plan'].sudo().search(
|
||||||
|
[('order_deadline', '=', False)])
|
||||||
|
for item in plans:
|
||||||
|
if item.date_planned_start:
|
||||||
|
item.order_deadline = item.date_planned_start + timedelta(days=7)
|
||||||
@api.model
|
@api.model
|
||||||
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
def search_read(self, domain=None, fields=None, offset=0, limit=None, order=None):
|
||||||
|
|
||||||
|
|||||||
@@ -3,4 +3,4 @@ from odoo import models, fields
|
|||||||
|
|
||||||
class SyncFunctionalCuttingToolModel(models.Model):
|
class SyncFunctionalCuttingToolModel(models.Model):
|
||||||
_inherit = 'sf.functional.cutting.tool.model'
|
_inherit = 'sf.functional.cutting.tool.model'
|
||||||
cutting_tool_type_ids = fields.Many2many('sf.cutting.tool.type', string='适用刀具物料类型', required=True)
|
cutting_tool_type_ids = fields.Many2many('sf.cutting.tool.type', string='适用刀具物料类型')
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
<field name="inherit_id" ref="sf_base.view_cutter_function_tree"/>
|
<field name="inherit_id" ref="sf_base.view_cutter_function_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath expr="//field[@name='name']" position="after">
|
<xpath expr="//field[@name='name']" position="after">
|
||||||
<field name="cutting_tool_type_ids" widget="many2many_tags"/>
|
<field name="cutting_tool_type_ids" widget="many2many_tags" options="{'no_create': True}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user