From ceae788eccc8b4b97be49278a1991d6d221c1158 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Wed, 17 Apr 2024 14:18:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=89=E6=AC=A1=E5=85=83=E6=A3=80=E6=B5=8Bz?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_manufacturing/models/mrp_workorder.py | 3 ++- sf_warehouse/models/model.py | 25 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 99061895..91c5d10d 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -364,6 +364,7 @@ class ResMrpWorkOrder(models.Model): y7 = self.Y7_axis y8 = self.Y8_axis z1 = self.Z9_axis + z2 = self.Z10_axis x0 = ((x3 - x4) * (x2 * y1 - x1 * y2) - (x1 - x2) * (x4 * y3 - x3 * y4)) / ( (x3 - x4) * (y1 - y2) - (x1 - x2) * (y3 - y4)) y0 = ((y3 - y4) * (y2 * x1 - y1 * x2) - (y1 - y2) * (y4 * x3 - y3 * x4)) / ( @@ -374,7 +375,7 @@ class ResMrpWorkOrder(models.Model): (y7 - y8) * (x5 - x6) - (y5 - y6) * (x7 - x8)) x = (x0 + x1) / 2 y = (y0 + y1) / 2 - z = z1 / 2 + z = (z1 + z2) / 2 jd = math.atan2((x5 - x6), (y5 - y6)) jdz = jd * 180 / math.pi diff --git a/sf_warehouse/models/model.py b/sf_warehouse/models/model.py index 37030471..1743de18 100644 --- a/sf_warehouse/models/model.py +++ b/sf_warehouse/models/model.py @@ -226,6 +226,7 @@ class SfShelf(models.Model): _order = 'create_date desc' name = fields.Char('货架名称', required=True, size=20) + active = fields.Boolean("有效", default=True) barcode = fields.Char('编码', copy=False, size=15, required=True) # 货位 location_ids = fields.One2many('sf.shelf.location', 'shelf_id', string='货位') @@ -304,6 +305,7 @@ class SfShelf(models.Model): class ShelfLocation(models.Model): _name = 'sf.shelf.location' _description = '货位' + _rec_name = 'barcode' _order = 'id asc, create_date asc' # current_location_id = fields.Many2one('sf.shelf.location', string='当前位置') @@ -313,6 +315,7 @@ class ShelfLocation(models.Model): destination_move_ids = fields.One2many('stock.move.line', 'destination_location_id', '目标位置调拨单') storage_time = fields.Datetime('入库时间', compute='_compute_location_status') production_id = fields.Many2one('mrp.production', string='制造订单') + active = fields.Boolean("有效", default=True) @api.depends('location_status') def _compute_location_status(self): @@ -859,15 +862,27 @@ class SfProcurementGroup(models.Model): return res +# class SfPickingType(models.Model): +# _inherit = 'stock.picking.type' +# +# def _default_show_operations(self): +# return self.user_has_groups('stock.group_production_lot,' +# 'stock.group_stock_multi_locations,' +# 'stock.group_tracking_lot', +# 'sf_warehouse.group_sf_stock_user', +# 'sf_warehouse.group_sf_stock_manager') + class SfPickingType(models.Model): _inherit = 'stock.picking.type' def _default_show_operations(self): - return self.user_has_groups('stock.group_production_lot,' - 'stock.group_stock_multi_locations,' - 'stock.group_tracking_lot', - 'sf_warehouse.group_sf_stock_user', - 'sf_warehouse.group_sf_stock_manager') + return self.user_has_groups( + 'stock.group_production_lot,' + 'stock.group_stock_multi_locations,' + 'stock.group_tracking_lot,' + 'sf_warehouse.group_sf_stock_user,' + 'sf_warehouse.group_sf_stock_manager' + ) class CustomStockMove(models.Model):