Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造代码优化

This commit is contained in:
mgw
2024-05-18 15:14:38 +08:00
8 changed files with 313 additions and 277 deletions

View File

@@ -74,25 +74,25 @@
<field name="active">True</field>
<field name="sequence">11</field>
</record>
<!-- <record id="rule_surface_technology_in" model="stock.rule">-->
<!-- <field name="name">外协出库单</field>-->
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
<!--&lt;!&ndash; <field name="action">push</field>&ndash;&gt;-->
<!-- <field name="pick_type_id" ref="outcontract_picking_in"/>-->
<!-- &lt;!&ndash; <field name="location_src_id" search="[('barcode','=','WH-PREPRODUCTION')]"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="location_dest_id" ref="stock_location_locations_virtual_outcontract"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="active">True</field>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="sequence">11</field>&ndash;&gt;-->
<!-- </record>-->
<!-- <record id="rule_surface_technology_in" model="stock.rule">-->
<!-- <field name="name">外协入库单</field>-->
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
<!-- <field name="action">pull</field>-->
<!-- <field name="pick_type_id" ref="outcontract_picking_out"/>-->
<!-- <field name="location_src_id" ref="stock_location_locations_virtual_outcontract"/>-->
<!-- <field name="location_dest_id" search="[('barcode','=','WH-PREPRODUCTION')]"/>-->
<!-- <field name="active">True</field>-->
<!-- <field name="sequence">11</field>-->
<!-- </record>-->
<!-- <record id="rule_surface_technology_in" model="stock.rule">-->
<!-- <field name="name">外协出库单</field>-->
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
<!--&lt;!&ndash; <field name="action">push</field>&ndash;&gt;-->
<!-- <field name="pick_type_id" ref="outcontract_picking_in"/>-->
<!-- &lt;!&ndash; <field name="location_src_id" search="[('barcode','=','WH-PREPRODUCTION')]"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="location_dest_id" ref="stock_location_locations_virtual_outcontract"/>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="active">True</field>&ndash;&gt;-->
<!-- &lt;!&ndash; <field name="sequence">11</field>&ndash;&gt;-->
<!-- </record>-->
<!-- <record id="rule_surface_technology_in" model="stock.rule">-->
<!-- <field name="name">外协入库单</field>-->
<!-- <field name="route_id" ref="route_surface_technology_outsourcing"/>-->
<!-- <field name="action">pull</field>-->
<!-- <field name="pick_type_id" ref="outcontract_picking_out"/>-->
<!-- <field name="location_src_id" ref="stock_location_locations_virtual_outcontract"/>-->
<!-- <field name="location_dest_id" search="[('barcode','=','WH-PREPRODUCTION')]"/>-->
<!-- <field name="active">True</field>-->
<!-- <field name="sequence">11</field>-->
<!-- </record>-->
</data>
</odoo>

View File

@@ -796,8 +796,8 @@ class ResMrpWorkOrder(models.Model):
move_out = self.env['stock.move'].search(
[('location_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
('location_dest_id', '=', self.env.ref(
'sf_manufacturing.stock_location_locations_virtual_outcontract').id),
('location_dest_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'VL-SPOC')]).id),
('origin', '=', self.production_id.name)])
purchase = self.env['purchase.order'].search([('origin', '=', self.production_id.name)])
if purchase and move_out:
@@ -910,10 +910,14 @@ class ResMrpWorkOrder(models.Model):
'order_line': order_line_ids,
})
tem_date_planned_finished = record.date_planned_finished
logging.info('routing_type:%s' % record.routing_type)
super().button_finish()
record.write({
'date_planned_finished': tem_date_planned_finished # 保持原值
})
logging.info('date_planned_finished:%s' % record.date_planned_finished)
# 表面工艺工单完成不走该修改
if record.routing_type != '表面工艺':
record.write({
'date_planned_finished': tem_date_planned_finished # 保持原值
})
is_production_id = True
for workorder in record.production_id.workorder_ids:
if workorder.state != 'done':

View File

@@ -505,8 +505,8 @@ class StockPicking(models.Model):
move_out = self.env['stock.move'].search(
[('location_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
('location_dest_id', '=', self.env.ref(
'sf_manufacturing.stock_location_locations_virtual_outcontract').id),
('location_dest_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'VL-SPOC')]).id),
('origin', '=', self.origin)])
if self.id == move_out.picking_id.id:
if move_out.move_line_ids.workorder_id.state not in ['progress']:
@@ -516,8 +516,8 @@ class StockPicking(models.Model):
move_in = self.env['stock.move'].search(
[('location_dest_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
('location_id', '=', self.env.ref(
'sf_manufacturing.stock_location_locations_virtual_outcontract').id),
('location_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'VL-SPOC')]).id),
('origin', '=', self.origin)])
if self.location_id == move_in.location_id and self.location_dest_id == move_in.location_dest_id:
if move_out.origin == move_in.origin:
@@ -531,8 +531,8 @@ class StockPicking(models.Model):
move_in = self.env['stock.move'].search(
[('location_dest_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
('location_id', '=', self.env.ref(
'sf_manufacturing.stock_location_locations_virtual_outcontract').id),
('location_id', '=', self.env['stock.location'].search(
[('barcode', 'ilike', 'VL-SPOC')]).id),
('origin', '=', self.origin)])
# purchase = self.env['purchase.order'].search([('origin', '=', self.origin)])
if move_in:
@@ -552,8 +552,8 @@ class StockPicking(models.Model):
[('workorder_id', '=', sorted_workorders.id), ('production_id', '=', item.id)])
if not outcontract_stock_move:
new_picking = True
location_id = self.env.ref(
'sf_manufacturing.stock_location_locations_virtual_outcontract').id,
location_id = self.env['stock.location'].search(
[('barcode', 'ilike', 'VL-SPOC')]).id,
location_dest_id = self.env['stock.location'].search(
[('barcode', 'ilike', 'WH-PREPRODUCTION')]).id,
outcontract_picking_type_in = self.env.ref(
@@ -715,15 +715,15 @@ class ReStockMove(models.Model):
class ReStockQuant(models.Model):
_inherit = 'stock.quant'
def action_apply_inventory(self):
inventory_diff_quantity = self.inventory_diff_quantity
super(ReStockQuant, self).action_apply_inventory()
if inventory_diff_quantity >= 1:
stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
limit=1, order='id desc')
if self.product_id.categ_type == '夹具':
stock._register_fixture()
elif self.product_id.categ_type == '刀具':
stock._register_cutting_tool()
return True
# def action_apply_inventory(self):
# inventory_diff_quantity = self.inventory_diff_quantity
# super(ReStockQuant, self).action_apply_inventory()
# if inventory_diff_quantity >= 1:
# stock = self.env['stock.move'].search([('product_id', '=', self.product_id.id), ('is_inventory', '=', True),
# ('reference', '=', '更新的产品数量'), ('state', '=', 'done')],
# limit=1, order='id desc')
# if self.product_id.categ_type == '夹具':
# stock._register_fixture()
# elif self.product_id.categ_type == '刀具':
# stock._register_cutting_tool()
# return True