销售订单价格问题
This commit is contained in:
@@ -157,12 +157,7 @@ class ResConfigSettings(models.TransientModel):
|
||||
try:
|
||||
convert_sale_data = map(lambda data:
|
||||
{'name': data.name, 'order_lines': {
|
||||
'%s/%s/%s/%s/±%s/' % (
|
||||
order_line.product_template_id.model_long, order_line.product_template_id.model_width, order_line.product_template_id.model_height,
|
||||
order_line.product_template_id.model_volume,
|
||||
order_line.product_template_id.model_machining_precision,
|
||||
): order_line.price_unit for order_line in
|
||||
data.order_line
|
||||
str(i): str(value.price_unit) for i, value in enumerate(data.order_line)
|
||||
}
|
||||
},
|
||||
datas)
|
||||
@@ -182,17 +177,14 @@ class ResConfigSettings(models.TransientModel):
|
||||
if not res_order_lines_map:
|
||||
continue
|
||||
need_change_sale_order = self.env['sale.order'].sudo().search([('name', '=', need_change_sale_data.get('name'))])
|
||||
|
||||
for need_change_sale_order_line in need_change_sale_order.order_line:
|
||||
order_line_uniq='%s/%s/%s/%s/±%s/' % (
|
||||
need_change_sale_order_line.product_template_id.model_long, need_change_sale_order_line.product_template_id.model_width,
|
||||
need_change_sale_order_line.product_template_id.model_height,
|
||||
need_change_sale_order_line.product_template_id.model_volume,
|
||||
need_change_sale_order_line.product_template_id.model_machining_precision,
|
||||
)
|
||||
if not res_order_lines_map.get(order_line_uniq):
|
||||
for index,need_change_sale_order_line in enumerate(need_change_sale_order.order_line):
|
||||
if not res_order_lines_map.get(str(index)):
|
||||
continue
|
||||
need_change_sale_order_line.write({'price_unit': res_order_lines_map.get(order_line_uniq)})
|
||||
order_line = self.env['sale.order.line'].browse(need_change_sale_order_line.id)
|
||||
new_price = res_order_lines_map.get(str(index))
|
||||
if order_line:
|
||||
# 修改单价
|
||||
order_line.write({'remark': new_price})
|
||||
else:
|
||||
logging.error('同步销售订单价格失败 {}'.format(response.text))
|
||||
raise UserError('同步销售订单价格失败')
|
||||
|
||||
Reference in New Issue
Block a user