diff --git a/sf_demand_plan/models/__init__.py b/sf_demand_plan/models/__init__.py
index 46c426fd..e911ac92 100644
--- a/sf_demand_plan/models/__init__.py
+++ b/sf_demand_plan/models/__init__.py
@@ -10,3 +10,4 @@ from . import stock_rule
from . import purchase_request
from . import purchase_order
from . import stock_move
+from . import stock_picking
diff --git a/sf_demand_plan/models/sf_production_demand_plan.py b/sf_demand_plan/models/sf_production_demand_plan.py
index f85adc65..1841fbee 100644
--- a/sf_demand_plan/models/sf_production_demand_plan.py
+++ b/sf_demand_plan/models/sf_production_demand_plan.py
@@ -911,22 +911,14 @@ class SfProductionDemandPlan(models.Model):
}
return values
- @api.model
- def check_other_custom_made_demands(self, plan_id, product_id, custom_made_type):
- return bool(self.env['sf.production.demand.plan'].sudo().search_count([
- ('product_id', '=', product_id),
- ('id', '!=', plan_id),
- ('new_supply_method', '=', 'custom_made'),
- ('status', '=', '30'),
- ('custom_made_type', '!=', custom_made_type),
- ], limit=1))
-
def button_plan_detail(self):
self.ensure_one()
purchase_request_ids = self.env['purchase.request'].sudo().search(
[('line_ids.demand_plan_line_id', 'in', self.ids)])
purchase_order_ids = self.env['purchase.order'].sudo().search(
[('order_line.demand_plan_line_id', 'in', self.ids)])
+ picking_ids = self.env['stock.picking'].sudo().search(
+ [('demand_plan_line_ids', 'in', self.ids)])
return {
'name': _('详情'),
'type': 'ir.actions.act_window',
@@ -949,4 +941,31 @@ class SfProductionDemandPlan(models.Model):
'default_outside_purchase_order_ids': purchase_order_ids.filtered(
lambda o: o.purchase_type == 'outside'
).ids,
+ 'default_in_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'IN'
+ ).ids,
+ 'default_dl_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'DL'
+ ).ids,
+ 'default_int_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'INT'
+ ).ids,
+ 'default_pc_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'PC'
+ ).ids,
+ 'default_sfp_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'SFP'
+ ).ids,
+ 'default_onin_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'OCIN'
+ ).ids,
+ 'default_ocout_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'OCOUT'
+ ).ids,
+ 'default_out_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'OUT'
+ ).ids,
+ 'default_res_stock_picking_ids': picking_ids.filtered(
+ lambda o: o.picking_type_sequence_code == 'RES'
+ ).ids,
}}
diff --git a/sf_demand_plan/models/stock_picking.py b/sf_demand_plan/models/stock_picking.py
new file mode 100644
index 00000000..8a1a1abd
--- /dev/null
+++ b/sf_demand_plan/models/stock_picking.py
@@ -0,0 +1,16 @@
+from odoo import fields, api, models, _
+
+
+class StockPicking(models.Model):
+ _inherit = "stock.picking"
+
+ demand_plan_line_ids = fields.Many2many(comodel_name="sf.production.demand.plan",
+ string="需求计划明细", compute='_compute_demand_plan_line_ids', store=True)
+
+ @api.depends('move_ids_without_package')
+ def _compute_demand_plan_line_ids(self):
+ for line in self:
+ demand_plan_lines = self.env['sf.production.demand.plan']
+ if line.move_ids_without_package and line.move_ids_without_package.demand_plan_line_ids:
+ demand_plan_lines |= line.move_ids_without_package.demand_plan_line_ids
+ line.demand_plan_line_ids = demand_plan_lines.ids
diff --git a/sf_demand_plan/views/demand_plan.xml b/sf_demand_plan/views/demand_plan.xml
index a5b3bddd..9bc631ad 100644
--- a/sf_demand_plan/views/demand_plan.xml
+++ b/sf_demand_plan/views/demand_plan.xml
@@ -92,6 +92,10 @@
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
/>
+
diff --git a/sf_demand_plan/wizard/sf_demand_plan_detail_wizard.py b/sf_demand_plan/wizard/sf_demand_plan_detail_wizard.py
index f4b568f4..4646ce03 100644
--- a/sf_demand_plan/wizard/sf_demand_plan_detail_wizard.py
+++ b/sf_demand_plan/wizard/sf_demand_plan_detail_wizard.py
@@ -27,3 +27,48 @@ class SfDemandPlanDetailWizard(models.TransientModel):
relation='outside_purchase_order_rel',
column1='plan_detail_wizard_id', column2='purchase_order_id',
readonly=True)
+
+ in_stock_picking_ids = fields.Many2many('stock.picking', string='关联收料入库调拨单',
+ relation='in_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ dl_stock_picking_ids = fields.Many2many('stock.picking', string='关联客供料入库调拨单',
+ relation='dl_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ int_stock_picking_ids = fields.Many2many('stock.picking', string='关联内部调拨',
+ relation='int_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ pc_stock_picking_ids = fields.Many2many('stock.picking', string='关联生产发料调拨单',
+ relation='pc_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ sfp_stock_picking_ids = fields.Many2many('stock.picking', string='关联生产入库调拨单',
+ relation='sfp_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ onin_stock_picking_ids = fields.Many2many('stock.picking', string='关联外协入库调拨单',
+ relation='onin_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ ocout_stock_picking_ids = fields.Many2many('stock.picking', string='关联外协出库调拨单',
+ relation='ocout_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ out_stock_picking_ids = fields.Many2many('stock.picking', string='关联发料出库调拨单',
+ relation='out_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
+
+ res_stock_picking_ids = fields.Many2many('stock.picking', string='关联委外发料调拨单',
+ relation='res_stock_picking_rel',
+ column1='plan_detail_wizard_id', column2='stock_picking_id',
+ readonly=True)
diff --git a/sf_demand_plan/wizard/sf_demand_plan_detail_wizard_view.xml b/sf_demand_plan/wizard/sf_demand_plan_detail_wizard_view.xml
index 8b2cb368..801d4bb8 100644
--- a/sf_demand_plan/wizard/sf_demand_plan_detail_wizard_view.xml
+++ b/sf_demand_plan/wizard/sf_demand_plan_detail_wizard_view.xml
@@ -24,6 +24,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py b/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py
index 337fd4f4..79644242 100644
--- a/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py
+++ b/sf_demand_plan/wizard/sf_demand_plan_print_wizard.py
@@ -37,7 +37,7 @@ class SfDemandPlanPrintWizard(models.Model):
if pdf_data:
try:
# 执行打印
- # self.env['jikimo.printing'].sudo().print_pdf(pdf_data)
+ self.env['jikimo.printing'].sudo().print_pdf(pdf_data)
record.status = 'success'
production_demand_plan_id = self.env['sf.production.demand.plan'].sudo().search(
[('model_id', '=', record.model_id)])