From 47c73ae66e83a64cdeba7182aa35fefd76fa0f6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Fri, 17 Jan 2025 15:20:50 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A4=84=E7=90=86=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E8=A1=8C=E5=8F=82=E6=95=B0=E8=AF=B4=E6=98=8E=E7=9A=84=E7=B2=BE?= =?UTF-8?q?=E5=BA=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_sale/models/sale_order.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sf_sale/models/sale_order.py b/sf_sale/models/sale_order.py index 73837271..31681932 100644 --- a/sf_sale/models/sale_order.py +++ b/sf_sale/models/sale_order.py @@ -130,7 +130,10 @@ class ReSaleOrder(models.Model): 'order_id': self.id, 'product_id': product.id, 'name': '%s/%s/%s/%s/%s/%s' % ( - product.model_long, product.model_width, product.model_height, product.model_volume, + self.format_float(product.model_long), + self.format_float(product.model_width), + self.format_float(product.model_height), + self.format_float(product.model_volume), machining_accuracy_name, product.materials_id.name), 'price_unit': product.list_price, @@ -143,6 +146,20 @@ class ReSaleOrder(models.Model): } return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals) + def format_float(self, value): + # 将浮点数转换为字符串 + value_str = str(value) + # 检查小数点的位置 + if '.' in value_str: + # 获取小数部分 + decimal_part = value_str.split('.')[1] + # 判断小数位数是否超过2位 + if len(decimal_part) > 2: + # 超过2位则保留2位小数 + return "{:.2f}".format(value) + # 否则保持原来的位数 + return float(value_str) + @api.constrains('order_line') def check_order_line(self): for item in self: From 9e2704f726a0fef35c91bb688b66c6ed0011e0fc Mon Sep 17 00:00:00 2001 From: yuxianghui <3437689193@qq.com> Date: Mon, 20 Jan 2025 10:34:32 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E9=80=81=E6=A3=80=E6=8C=89=E9=92=AE=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E6=97=B6=E5=80=99=E9=9A=90=E8=97=8F=E5=AE=8C=E6=88=90=E6=8C=89?= =?UTF-8?q?=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/views/mrp_workorder_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 505d0c41..5b409e38 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -182,7 +182,7 @@