物料需求计划
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
'depends': ['sf_plan','jikimo_printing'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/demand_plan_info.xml.xml',
|
||||
'views/demand_plan.xml',
|
||||
'wizard/sf_demand_plan_print_wizard_view.xml',
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import sf_demand_plan
|
||||
from . import sf_production_demand_plan
|
||||
from . import sale_order
|
||||
from . import sf_demand_plan
|
||||
|
||||
@@ -16,7 +16,10 @@ class ReSaleOrder(models.Model):
|
||||
'sale_order_id': ret.order_id.id,
|
||||
'sale_order_line_id': ret.id,
|
||||
}
|
||||
demand_plan_info = self.env['sf.demand.plan'].sudo().create(vals)
|
||||
vals.update({'demand_plan_id': demand_plan_info.id})
|
||||
demand_plan = self.env['sf.production.demand.plan'].sudo().create(vals)
|
||||
demand_plan_info.write({'line_ids': demand_plan.id})
|
||||
if demand_plan.product_id.machining_drawings_name:
|
||||
filename_url = demand_plan.product_id.machining_drawings_name.rsplit('.', 1)[0]
|
||||
wizard_vals = {
|
||||
|
||||
@@ -12,7 +12,15 @@ class SfDemandPlan(models.Model):
|
||||
list = [(m.sync_id, m.name) for m in machinings]
|
||||
return list
|
||||
|
||||
line_ids = fields.One2many('sf.production.demand.plan', 'demand_plan_id', string="需求计划", copy=True)
|
||||
state = fields.Selection([
|
||||
('10', '草稿'),
|
||||
('20', '待工艺设计'),
|
||||
('30', '部分下达'),
|
||||
('40', '已下达'),
|
||||
], string='状态')
|
||||
|
||||
line_ids = fields.One2many(comodel_name='sf.production.demand.plan',
|
||||
inverse_name='demand_plan_id', string="需求计划", copy=True)
|
||||
|
||||
sale_order_id = fields.Many2one(comodel_name="sale.order",
|
||||
string="销售订单", readonly=True)
|
||||
@@ -35,6 +43,9 @@ class SfDemandPlan(models.Model):
|
||||
# product_uom_qty = fields.Float(
|
||||
# string="待计划",
|
||||
# related='sale_order_line_id.product_uom_qty', store=True)
|
||||
# product_uom_qty = fields.Float(
|
||||
# string="已计划",
|
||||
# related='sale_order_line_id.product_uom_qty', store=True)
|
||||
model_id = fields.Char('模型ID', related='product_id.model_id')
|
||||
customer_name = fields.Char('客户', related='sale_order_id.customer_name')
|
||||
product_uom_qty = fields.Float(
|
||||
@@ -65,6 +76,8 @@ class SfDemandPlan(models.Model):
|
||||
('4', '低'),
|
||||
], string='优先级', default='3')
|
||||
|
||||
remark = fields.Char('备注')
|
||||
|
||||
@api.depends('product_id.part_number', 'product_id.model_name')
|
||||
def _compute_part_number(self):
|
||||
for line in self:
|
||||
|
||||
@@ -270,6 +270,16 @@ class SfProductionDemandPlan(models.Model):
|
||||
pro_plan_list.date_planned_start = date_planned_start
|
||||
self._do_production_schedule(pro_plan_list)
|
||||
|
||||
def edit_button(self):
|
||||
return {
|
||||
'res_model': 'sf.demand.plan',
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': _("需求计划"),
|
||||
'domain': [('line_ids', 'in', self.demand_plan_id.ids)],
|
||||
'views': [[self.env.ref('sf_demand_plan.view_sf_demand_plan_list').id, 'list']],
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
def _do_production_schedule(self, pro_plan_list):
|
||||
for pro_plan in pro_plan_list:
|
||||
pro_plan.do_production_schedule()
|
||||
|
||||
@@ -4,3 +4,7 @@ access_sf_production_demand_plan_for_dispatch,sf.production.demand.plan for disp
|
||||
|
||||
access_sf_demand_plan_print_wizard,sf.demand.plan.print.wizard,model_sf_demand_plan_print_wizard,base.group_user,1,0,0,0
|
||||
access_sf_demand_plan_print_wizard_for_dispatch,sf.demand.plan.print.wizard for dispatch,model_sf_demand_plan_print_wizard,sf_base.group_plan_dispatch,1,1,0,0
|
||||
|
||||
|
||||
access_sf_demand_plan,sf.demand.plan,model_sf_demand_plan,base.group_user,1,0,0,0
|
||||
access_sf_demand_plan_for_dispatch,sf.demand.plan for dispatch,model_sf_demand_plan,sf_base.group_plan_dispatch,1,1,0,0
|
||||
|
||||
|
@@ -69,6 +69,8 @@
|
||||
<field name="print_count"/>
|
||||
<button name="release_production_order" type="object" string="下达生产" class="btn-primary"
|
||||
attrs="{'invisible': ['|',('status', '!=', '50'), ('supply_method', 'not in', ['automation', 'manual'])]}"/>
|
||||
|
||||
<button name="edit_button" type="object" string="编辑" class="btn-primary"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
40
sf_demand_plan/views/demand_plan_info.xml
Normal file
40
sf_demand_plan/views/demand_plan_info.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<odoo>
|
||||
<record id="view_sf_demand_plan_list" model="ir.ui.view">
|
||||
<field name="name">sf.demand.plan.list</field>
|
||||
<field name="model">sf.demand.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<header>
|
||||
<field name="state" widget="statusbar"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
<field name="product_id"/>
|
||||
<field name="part_name"/>
|
||||
<field name="part_number"/>
|
||||
<field name="materials_id"/>
|
||||
<field name="blank_type"/>
|
||||
<field name="embryo_long"/>
|
||||
<field name="is_incoming_material"/>
|
||||
<!-- <field name="待计划"/>-->
|
||||
<field name="model_id"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="customer_name"/>
|
||||
<field name="product_uom_qty"/>
|
||||
<field name="deadline_of_delivery"/>
|
||||
<field name="contract_date"/>
|
||||
<field name="contract_code"/>
|
||||
<field name="model_process_parameters_ids" widget="many2many_tags"/>
|
||||
<field name="model_machining_precision"/>
|
||||
<field name="inventory_quantity_auto_apply"/>
|
||||
<field name="priority"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user