需求计划详情调拨单显示
This commit is contained in:
@@ -10,3 +10,4 @@ from . import stock_rule
|
|||||||
from . import purchase_request
|
from . import purchase_request
|
||||||
from . import purchase_order
|
from . import purchase_order
|
||||||
from . import stock_move
|
from . import stock_move
|
||||||
|
from . import stock_picking
|
||||||
|
|||||||
@@ -911,22 +911,14 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
}
|
}
|
||||||
return values
|
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):
|
def button_plan_detail(self):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
purchase_request_ids = self.env['purchase.request'].sudo().search(
|
purchase_request_ids = self.env['purchase.request'].sudo().search(
|
||||||
[('line_ids.demand_plan_line_id', 'in', self.ids)])
|
[('line_ids.demand_plan_line_id', 'in', self.ids)])
|
||||||
purchase_order_ids = self.env['purchase.order'].sudo().search(
|
purchase_order_ids = self.env['purchase.order'].sudo().search(
|
||||||
[('order_line.demand_plan_line_id', 'in', self.ids)])
|
[('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 {
|
return {
|
||||||
'name': _('详情'),
|
'name': _('详情'),
|
||||||
'type': 'ir.actions.act_window',
|
'type': 'ir.actions.act_window',
|
||||||
@@ -949,4 +941,31 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
'default_outside_purchase_order_ids': purchase_order_ids.filtered(
|
'default_outside_purchase_order_ids': purchase_order_ids.filtered(
|
||||||
lambda o: o.purchase_type == 'outside'
|
lambda o: o.purchase_type == 'outside'
|
||||||
).ids,
|
).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,
|
||||||
}}
|
}}
|
||||||
|
|||||||
16
sf_demand_plan/models/stock_picking.py
Normal file
16
sf_demand_plan/models/stock_picking.py
Normal file
@@ -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
|
||||||
@@ -92,6 +92,10 @@
|
|||||||
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
|
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
|
||||||
/>
|
/>
|
||||||
<button name="edit_button" type="object" string="拆分" class="btn-primary"/>
|
<button name="edit_button" type="object" string="拆分" class="btn-primary"/>
|
||||||
|
<button string="详情" name="button_plan_detail" type="object"
|
||||||
|
class="btn-primary"
|
||||||
|
attrs="{'invisible': [('status', 'not in', ('50','60'))]}"
|
||||||
|
/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -27,3 +27,48 @@ class SfDemandPlanDetailWizard(models.TransientModel):
|
|||||||
relation='outside_purchase_order_rel',
|
relation='outside_purchase_order_rel',
|
||||||
column1='plan_detail_wizard_id', column2='purchase_order_id',
|
column1='plan_detail_wizard_id', column2='purchase_order_id',
|
||||||
readonly=True)
|
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)
|
||||||
|
|||||||
@@ -24,6 +24,33 @@
|
|||||||
<page string="外购订单采购" attrs="{'invisible': [('outside_purchase_order_ids', '=', [])]}">
|
<page string="外购订单采购" attrs="{'invisible': [('outside_purchase_order_ids', '=', [])]}">
|
||||||
<field name="outside_purchase_order_ids" widget="many2many"/>
|
<field name="outside_purchase_order_ids" widget="many2many"/>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="收料入库" attrs="{'invisible': [('in_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="in_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="客供料入库" attrs="{'invisible': [('dl_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="dl_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="内部调拨" attrs="{'invisible': [('int_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="int_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="生产发料" attrs="{'invisible': [('pc_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="pc_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="生产入库" attrs="{'invisible': [('sfp_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="sfp_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="外协入库" attrs="{'invisible': [('onin_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="onin_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="外协出库" attrs="{'invisible': [('ocout_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="ocout_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="发料出库" attrs="{'invisible': [('out_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="out_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
|
<page string="委外发料" attrs="{'invisible': [('res_stock_picking_ids', '=', [])]}">
|
||||||
|
<field name="res_stock_picking_ids" widget="many2many"/>
|
||||||
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class SfDemandPlanPrintWizard(models.Model):
|
|||||||
if pdf_data:
|
if pdf_data:
|
||||||
try:
|
try:
|
||||||
# 执行打印
|
# 执行打印
|
||||||
# self.env['jikimo.printing'].sudo().print_pdf(pdf_data)
|
self.env['jikimo.printing'].sudo().print_pdf(pdf_data)
|
||||||
record.status = 'success'
|
record.status = 'success'
|
||||||
production_demand_plan_id = self.env['sf.production.demand.plan'].sudo().search(
|
production_demand_plan_id = self.env['sf.production.demand.plan'].sudo().search(
|
||||||
[('model_id', '=', record.model_id)])
|
[('model_id', '=', record.model_id)])
|
||||||
|
|||||||
Reference in New Issue
Block a user