增加排程动作对销售订单状态的修改
This commit is contained in:
@@ -8,8 +8,6 @@ from odoo.exceptions import UserError
|
|||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo.tools import float_compare, float_round, float_is_zero, format_datetime
|
from odoo.tools import float_compare, float_round, float_is_zero, format_datetime
|
||||||
|
|
||||||
from odoo.tools import float_compare, float_is_zero
|
|
||||||
|
|
||||||
|
|
||||||
class MrpProduction(models.Model):
|
class MrpProduction(models.Model):
|
||||||
_inherit = 'mrp.production'
|
_inherit = 'mrp.production'
|
||||||
@@ -162,7 +160,6 @@ class MrpProduction(models.Model):
|
|||||||
logging.info('fetchCNC error:%s' % e)
|
logging.info('fetchCNC error:%s' % e)
|
||||||
raise UserError("cnc程序获取编程单失败,请联系管理员")
|
raise UserError("cnc程序获取编程单失败,请联系管理员")
|
||||||
|
|
||||||
|
|
||||||
# 维修模块按钮
|
# 维修模块按钮
|
||||||
def button_maintenance_req(self):
|
def button_maintenance_req(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
@@ -506,7 +503,6 @@ class MrpProduction(models.Model):
|
|||||||
productions_not_to_backorder = self
|
productions_not_to_backorder = self
|
||||||
productions_to_backorder = self.env['mrp.production']
|
productions_to_backorder = self.env['mrp.production']
|
||||||
|
|
||||||
|
|
||||||
backorders = productions_to_backorder and productions_to_backorder._split_productions()
|
backorders = productions_to_backorder and productions_to_backorder._split_productions()
|
||||||
backorders = backorders - productions_to_backorder
|
backorders = backorders - productions_to_backorder
|
||||||
|
|
||||||
@@ -514,13 +510,16 @@ class MrpProduction(models.Model):
|
|||||||
productions_to_backorder._post_inventory(cancel_backorder=True)
|
productions_to_backorder._post_inventory(cancel_backorder=True)
|
||||||
|
|
||||||
# if completed products make other confirmed/partially_available moves available, assign them
|
# if completed products make other confirmed/partially_available moves available, assign them
|
||||||
done_move_finished_ids = (productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(lambda m: m.state == 'done')
|
done_move_finished_ids = (
|
||||||
|
productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(
|
||||||
|
lambda m: m.state == 'done')
|
||||||
done_move_finished_ids._trigger_assign()
|
done_move_finished_ids._trigger_assign()
|
||||||
|
|
||||||
# Moves without quantity done are not posted => set them as done instead of canceling. In
|
# Moves without quantity done are not posted => set them as done instead of canceling. In
|
||||||
# case the user edits the MO later on and sets some consumed quantity on those, we do not
|
# case the user edits the MO later on and sets some consumed quantity on those, we do not
|
||||||
# want the move lines to be canceled.
|
# want the move lines to be canceled.
|
||||||
(productions_not_to_backorder.move_raw_ids | productions_not_to_backorder.move_finished_ids).filtered(lambda x: x.state not in ('done', 'cancel')).write({
|
(productions_not_to_backorder.move_raw_ids | productions_not_to_backorder.move_finished_ids).filtered(
|
||||||
|
lambda x: x.state not in ('done', 'cancel')).write({
|
||||||
'state': 'done',
|
'state': 'done',
|
||||||
'product_uom_qty': 0.0,
|
'product_uom_qty': 0.0,
|
||||||
})
|
})
|
||||||
@@ -546,8 +545,10 @@ class MrpProduction(models.Model):
|
|||||||
'res_id': self.id,
|
'res_id': self.id,
|
||||||
'target': 'main',
|
'target': 'main',
|
||||||
}
|
}
|
||||||
if self.user_has_groups('mrp.group_mrp_reception_report') and self.picking_type_id.auto_show_reception_report:
|
if self.user_has_groups(
|
||||||
lines = self.move_finished_ids.filtered(lambda m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
|
'mrp.group_mrp_reception_report') and self.picking_type_id.auto_show_reception_report:
|
||||||
|
lines = self.move_finished_ids.filtered(lambda
|
||||||
|
m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
|
||||||
if lines:
|
if lines:
|
||||||
if any(mo.show_allocation for mo in self):
|
if any(mo.show_allocation for mo in self):
|
||||||
action = self.action_view_reception_report()
|
action = self.action_view_reception_report()
|
||||||
|
|||||||
@@ -195,6 +195,10 @@ class sf_production_plan(models.Model):
|
|||||||
item.date_planned_start, item.date_planned_finished
|
item.date_planned_start, item.date_planned_finished
|
||||||
record.state = 'done'
|
record.state = 'done'
|
||||||
record.production_id.schedule_state = '已排'
|
record.production_id.schedule_state = '已排'
|
||||||
|
# self.env['sale.order'].browse(record.production_id.origin).schedule_status = 'to process'
|
||||||
|
sale_obj = self.env['sale.order'].search([('name', '=', record.origin)])
|
||||||
|
if 'S' in sale_obj.name:
|
||||||
|
sale_obj.schedule_status = 'to process'
|
||||||
mrp_production_ids = record.production_id._get_children().ids
|
mrp_production_ids = record.production_id._get_children().ids
|
||||||
print('mrp_production_ids', mrp_production_ids)
|
print('mrp_production_ids', mrp_production_ids)
|
||||||
for i in mrp_production_ids:
|
for i in mrp_production_ids:
|
||||||
@@ -276,6 +280,10 @@ class sf_production_plan(models.Model):
|
|||||||
self.production_line_id = False
|
self.production_line_id = False
|
||||||
aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
|
aa = self.env['mrp.production'].sudo().search([('name', '=', self.name)])
|
||||||
aa.schedule_state = '未排'
|
aa.schedule_state = '未排'
|
||||||
|
# self.env['sale.order'].browse(record.production_id.origin).schedule_status = 'to shedule'
|
||||||
|
sale_obj = self.env['sale.order'].search([('name', '=', self.origin)])
|
||||||
|
if 'S' in sale_obj.name:
|
||||||
|
sale_obj.schedule_status = 'to schedule'
|
||||||
return self.date_planned_finished
|
return self.date_planned_finished
|
||||||
|
|
||||||
def liucheng_cs(self):
|
def liucheng_cs(self):
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ access_purchase_order_wizard_group_purchase_director,purchase_order_wizard_group
|
|||||||
access_crm_tag_group_sale_salemanager,crm_tag_group_sale_salemanager,sales_team.model_crm_tag,sf_base.group_sale_salemanager,1,0,0,0
|
access_crm_tag_group_sale_salemanager,crm_tag_group_sale_salemanager,sales_team.model_crm_tag,sf_base.group_sale_salemanager,1,0,0,0
|
||||||
access_crm_tag_group_sale_director,crm_tag_group_sale_director,sales_team.model_crm_tag,sf_base.group_sale_director,1,1,1,0
|
access_crm_tag_group_sale_director,crm_tag_group_sale_director,sales_team.model_crm_tag,sf_base.group_sale_director,1,1,1,0
|
||||||
|
|
||||||
access_sale_order,sale.order,sale.model_sale_order,sf_base.group_plan_dispatch,1,0,0,0
|
access_sale_order,sale.order,sale.model_sale_order,sf_base.group_plan_dispatch,1,1,0,0
|
||||||
access_res_partner_group_sale_salemanager,res_partner_group_sale_salemanager,base.model_res_partner,sf_base.group_sale_salemanager,1,0,1,0
|
access_res_partner_group_sale_salemanager,res_partner_group_sale_salemanager,base.model_res_partner,sf_base.group_sale_salemanager,1,0,1,0
|
||||||
access_res_partner_group_sale_director,res_partner_group_sale_director,base.model_res_partner,sf_base.group_sale_director,1,0,1,0
|
access_res_partner_group_sale_director,res_partner_group_sale_director,base.model_res_partner,sf_base.group_sale_director,1,0,1,0
|
||||||
access_res_partner_group_purchase,res_partner_group_purchase,base.model_res_partner,sf_base.group_purchase,1,0,1,0
|
access_res_partner_group_purchase,res_partner_group_purchase,base.model_res_partner,sf_base.group_purchase,1,0,1,0
|
||||||
|
|||||||
|
Reference in New Issue
Block a user