diff --git a/jikimo_frontend/static/src/scss/custom_style.scss b/jikimo_frontend/static/src/scss/custom_style.scss index 6904dbac..c668d82e 100644 --- a/jikimo_frontend/static/src/scss/custom_style.scss +++ b/jikimo_frontend/static/src/scss/custom_style.scss @@ -157,11 +157,11 @@ td.o_required_modifier { color: #aaa; } -.o_kanban_primary_left { - display: flex; - flex-direction: row-reverse; - justify-content: flex-start; -} +// .o_kanban_primary_left { +// display: flex; +// flex-direction: row-reverse; +// justify-content: flex-start; +// } .o_list_view .o_list_table thead { position: sticky; diff --git a/jikimo_purchase_request/models/mrp_production.py b/jikimo_purchase_request/models/mrp_production.py index c1c0feb9..4ae6bd61 100644 --- a/jikimo_purchase_request/models/mrp_production.py +++ b/jikimo_purchase_request/models/mrp_production.py @@ -20,7 +20,7 @@ class MrpProduction(models.Model): 采购请求 """ self.ensure_one() - pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name)]) + pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name),('is_subcontract', '!=', True)]) action = { 'res_model': 'purchase.request', 'type': 'ir.actions.act_window', diff --git a/sf_base/static/src/scss/test.scss b/sf_base/static/src/scss/test.scss index 565e7956..dea33556 100644 --- a/sf_base/static/src/scss/test.scss +++ b/sf_base/static/src/scss/test.scss @@ -148,12 +148,17 @@ td.o_required_modifier { color: #aaa; } -.o_kanban_primary_left { - display: flex; - flex-direction: row-reverse; - justify-content: flex-start; +// .o_kanban_primary_left { +// display: flex; +// flex-direction: row-reverse; +// justify-content: flex-start; +// } +.o_list_button { + min-width: 32px; +} +.o_list_record_remove { + padding-left: 0px !important; } - .diameter:before { content:"Ф"; display:inline; diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py index 7412c8d5..f73590bd 100644 --- a/sf_manufacturing/models/mrp_production.py +++ b/sf_manufacturing/models/mrp_production.py @@ -922,6 +922,7 @@ class MrpProduction(models.Model): "requested_by": self.env.context.get("uid", self.env.uid), "assigned_to": False, "bom_id": self[0].bom_id.id, + "is_subcontract":True, }) for product_id, request_line_list in grouped_purchase_request_line_sorted_list.items(): cur_request_line = request_line_list[0] diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py index 1a4ca008..f0e24398 100644 --- a/sf_manufacturing/models/mrp_workorder.py +++ b/sf_manufacturing/models/mrp_workorder.py @@ -69,7 +69,18 @@ class ResMrpWorkOrder(models.Model): delivery_warning = fields.Selection([('normal', '正常'), ('warning', '告警'), ('overdue', '逾期')], string='时效', tracking=True) back_button_display = fields.Boolean(default=False, compute='_compute_back_button_display', store=True) - + pr_mp_count = fields.Integer('采购申请单数量', compute='_compute_pr_mp_count', store=True) + @api.depends('state') + def _compute_pr_mp_count(self): + for item in self: + if not item.is_subcontract: + item.pr_mp_count = 0 + continue + pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', item.name),('is_subcontract','=','True')]) + if pr_ids: + item.pr_mp_count = len(pr_ids) + else: + item.pr_mp_count = 0 @api.depends('state') def _compute_back_button_display(self): for record in self: @@ -445,6 +456,28 @@ class ResMrpWorkOrder(models.Model): else: order.surface_technics_purchase_count = 0 + def action_view_pr_mrp_workorder(self): + """ + 采购请求 + """ + self.ensure_one() + pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', self.name),('is_subcontract', '=', True)]) + action = { + 'res_model': 'purchase.request', + 'type': 'ir.actions.act_window', + } + if len(pr_ids) == 1: + action.update({ + 'view_mode': 'form', + 'res_id': pr_ids[0].id, + }) + else: + action.update({ + 'name': _("从 %s生成采购请求单", self.name), + 'domain': [('id', 'in', pr_ids)], + 'view_mode': 'tree,form', + }) + return action def action_view_surface_technics_purchase(self): self.ensure_one() # if self.routing_type == '表面工艺': diff --git a/sf_manufacturing/models/purchase_request_line.py b/sf_manufacturing/models/purchase_request_line.py index 385594e4..b08bb3e7 100644 --- a/sf_manufacturing/models/purchase_request_line.py +++ b/sf_manufacturing/models/purchase_request_line.py @@ -17,6 +17,9 @@ from odoo.exceptions import UserError, ValidationError from odoo.tools import float_compare, float_round, float_is_zero, format_datetime +class PurchaseRequestLine(models.Model): + _inherit = 'purchase.request' + is_subcontract = fields.Boolean(string='是否外协',default=False) class PurchaseRequestLine(models.Model): _inherit = 'purchase.request.line' is_subcontract = fields.Boolean(string='是否外协') diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml index 5946509a..a9382725 100644 --- a/sf_manufacturing/views/mrp_workorder_view.xml +++ b/sf_manufacturing/views/mrp_workorder_view.xml @@ -144,6 +144,17 @@ statusbar_visible="pending,waiting,ready,progress,to be detected,done,rework"/> +