修复报废-拣货单(sfp)
This commit is contained in:
@@ -797,7 +797,7 @@ class MrpProduction(models.Model):
|
|||||||
})
|
})
|
||||||
return action
|
return action
|
||||||
|
|
||||||
# 返工
|
# 报废
|
||||||
def button_scrap_new(self):
|
def button_scrap_new(self):
|
||||||
cloud_programming = self._cron_get_programming_state()
|
cloud_programming = self._cron_get_programming_state()
|
||||||
return {
|
return {
|
||||||
@@ -969,12 +969,12 @@ class MrpProduction(models.Model):
|
|||||||
'location_dest_id', '=', self.env['stock.location'].search([('parent_path', '=', '2/5/')]).id),
|
'location_dest_id', '=', self.env['stock.location'].search([('parent_path', '=', '2/5/')]).id),
|
||||||
('location_src_id', '=', self.env['stock.location'].search(
|
('location_src_id', '=', self.env['stock.location'].search(
|
||||||
[('barcode', '=', 'CP')]).id)])
|
[('barcode', '=', 'CP')]).id)])
|
||||||
origin = move._prepare_procurement_origin()
|
# origin = move._prepare_procurement_origin()
|
||||||
procurement_requests.append(self.env['procurement.group'].Procurement(
|
procurement_requests.append(self.env['procurement.group'].Procurement(
|
||||||
move.product_id, 1.0, move.product_uom,
|
move.product_id, 1.0, move.product_uom,
|
||||||
self.env['stock.location'].search([('barcode', '=', 'CP')]),
|
self.env['stock.location'].search([('barcode', '=', 'CP')]),
|
||||||
rule and rule.name or "/",
|
rule and rule.name or "/",
|
||||||
origin, move.company_id, move_values))
|
sale_order.name, move.company_id, move_values))
|
||||||
self.env['procurement.group'].run(procurement_requests,
|
self.env['procurement.group'].run(procurement_requests,
|
||||||
raise_user_error=not self.env.context.get('from_orderpoint'))
|
raise_user_error=not self.env.context.get('from_orderpoint'))
|
||||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||||
@@ -986,7 +986,6 @@ class MrpProduction(models.Model):
|
|||||||
[('origin', '=', self.origin)], order='id desc', limit=1)
|
[('origin', '=', self.origin)], order='id desc', limit=1)
|
||||||
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
move = self.env['stock.move'].search([('origin', '=', productions.name)], order='id desc')
|
||||||
for mo in move:
|
for mo in move:
|
||||||
print(mo.id)
|
|
||||||
if mo.procure_method == 'make_to_order' and mo.name != productions.name:
|
if mo.procure_method == 'make_to_order' and mo.name != productions.name:
|
||||||
if mo.name == '/':
|
if mo.name == '/':
|
||||||
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
|
domain = [('barcode', '=', 'WH-PC'), ('sequence_code', '=', 'PC')]
|
||||||
@@ -1001,6 +1000,14 @@ class MrpProduction(models.Model):
|
|||||||
if mo.production_id:
|
if mo.production_id:
|
||||||
if mo.production_id != productions:
|
if mo.production_id != productions:
|
||||||
mo.production_id = False
|
mo.production_id = False
|
||||||
|
mo_move = self.env['stock.move'].search(
|
||||||
|
[('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/MO/')])
|
||||||
|
if mo_move:
|
||||||
|
sfp_move = self.env['stock.move'].search(
|
||||||
|
[('origin', '=', sale_order.name), ('reference', 'ilike', 'WH/SFP/')], limit=1)
|
||||||
|
mo_move.write({'reference': sfp_move.reference, 'partner_id': sfp_move.partner_id.id,
|
||||||
|
'picking_id': sfp_move.picking_id.id, 'picking_type_id': sfp_move.picking_type_id.id,
|
||||||
|
'production_id': False})
|
||||||
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
||||||
productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
||||||
{'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
{'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
||||||
|
|||||||
@@ -130,7 +130,7 @@
|
|||||||
attrs="{'invisible': ['|',('state', '!=', 'rework') ,('programming_state', '!=', '已编程')]}"/>
|
attrs="{'invisible': ['|',('state', '!=', 'rework') ,('programming_state', '!=', '已编程')]}"/>
|
||||||
<button name="button_scrap_new" string="报废" type="object"
|
<button name="button_scrap_new" string="报废" type="object"
|
||||||
groups="sf_base.group_sf_mrp_user"
|
groups="sf_base.group_sf_mrp_user"
|
||||||
attrs="{'invisible': [('is_scrap', '=', False)]}"/>
|
attrs="{'invisible': ['|',('is_scrap', '=', False),('state','=','cancel')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="(//header//button[@name='button_mark_done'])[3]" position="replace">
|
<xpath expr="(//header//button[@name='button_mark_done'])[3]" position="replace">
|
||||||
<button name="button_mark_done" attrs="{'invisible': [
|
<button name="button_mark_done" attrs="{'invisible': [
|
||||||
|
|||||||
@@ -20,6 +20,11 @@ class ProductionWizard(models.TransientModel):
|
|||||||
('已下发', '已下发')],
|
('已下发', '已下发')],
|
||||||
string='编程状态')
|
string='编程状态')
|
||||||
|
|
||||||
|
@api.onchange('is_remanufacture')
|
||||||
|
def _onchange_is_reprogramming(self):
|
||||||
|
if self.is_remanufacture is False:
|
||||||
|
self.is_reprogramming = False
|
||||||
|
|
||||||
def confirm(self):
|
def confirm(self):
|
||||||
self.production_id.action_cancel()
|
self.production_id.action_cancel()
|
||||||
self.production_id.detection_result_ids.write({'handle_result': '已处理'})
|
self.production_id.detection_result_ids.write({'handle_result': '已处理'})
|
||||||
|
|||||||
Reference in New Issue
Block a user