Compare commits
4 Commits
feature/72
...
feature/物料
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdb3cc7c03 | ||
|
|
19417dd569 | ||
|
|
20415d0d3f | ||
|
|
4d959eab59 |
@@ -35,6 +35,7 @@
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'sf_base/static/src/scss/*.scss',
|
||||
'sf_base/static/src/js/*.js',
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
@@ -42,7 +42,6 @@ class MrsMaterialModel(models.Model):
|
||||
materials_num = fields.Char("编码号")
|
||||
name = fields.Char('型号名')
|
||||
need_h = fields.Boolean("热处理", default="false")
|
||||
need_m = fields.Boolean("是否磁吸", default="false")
|
||||
mf_materia_post = fields.Char("热处理后密度")
|
||||
density = fields.Float("密度(kg/m³)")
|
||||
materials_id = fields.Many2one('sf.production.materials', "材料名")
|
||||
|
||||
62
sf_base/static/src/js/custom_barcode_handlers.js
Normal file
62
sf_base/static/src/js/custom_barcode_handlers.js
Normal file
@@ -0,0 +1,62 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from "@web/core/registry";
|
||||
import { barcodeGenericHandlers } from '@barcodes/barcode_handlers';
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
|
||||
// 定义新的 clickOnButton 函数
|
||||
function customClickOnButton(selector) {
|
||||
console.log("This is the custom clickOnButton function!");
|
||||
|
||||
const buttons = document.body.querySelectorAll(selector);
|
||||
|
||||
let length = buttons.length;
|
||||
if (length > 0) {
|
||||
buttons[length - 1].click();
|
||||
} else {
|
||||
console.warn(`Button with selector ${selector} not found`);
|
||||
}
|
||||
}
|
||||
|
||||
patch(barcodeGenericHandlers, "start", {
|
||||
start(env, { ui, barcode, notification }) {
|
||||
// 使用新定义的 clickOnButton 函数
|
||||
const COMMANDS = {
|
||||
"O-CMD.EDIT": () => customClickOnButton(".o_form_button_edit"),
|
||||
"O-CMD.DISCARD": () => customClickOnButton(".o_form_button_cancel"),
|
||||
"O-CMD.SAVE": () => customClickOnButton(".o_form_button_save"),
|
||||
"O-CMD.PREV": () => customClickOnButton(".o_pager_previous"),
|
||||
"O-CMD.NEXT": () => customClickOnButton(".o_pager_next"),
|
||||
"O-CMD.PAGER-FIRST": () => updatePager("first"),
|
||||
"O-CMD.PAGER-LAST": () => updatePager("last"),
|
||||
"O-CMD.CONFIRM": () => customClickOnButton(".jikimo_button_confirm"),
|
||||
"O-CMD.FLUSHED": () => customClickOnButton(".jikimo_button_flushed"),
|
||||
};
|
||||
|
||||
barcode.bus.addEventListener("barcode_scanned", (ev) => {
|
||||
const barcode = ev.detail.barcode;
|
||||
if (barcode.startsWith("O-BTN.")) {
|
||||
let targets = [];
|
||||
try {
|
||||
targets = getVisibleElements(ui.activeElement, `[barcode_trigger=${barcode.slice(6)}]`);
|
||||
} catch (_e) {
|
||||
console.warn(`Barcode '${barcode}' is not valid`);
|
||||
}
|
||||
for (let elem of targets) {
|
||||
elem.click();
|
||||
}
|
||||
}
|
||||
if (barcode.startsWith("O-CMD.")) {
|
||||
const fn = COMMANDS[barcode];
|
||||
if (fn) {
|
||||
fn();
|
||||
} else {
|
||||
notification.add(env._t("Barcode: ") + `'${barcode}'`, {
|
||||
title: env._t("Unknown barcode command"),
|
||||
type: "danger"
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
42
sf_base/static/src/js/remove_focus.js
Normal file
42
sf_base/static/src/js/remove_focus.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/** @odoo-module **/
|
||||
|
||||
import { registry } from '@web/core/registry';
|
||||
|
||||
import { formView } from '@web/views/form/form_view';
|
||||
import { FormController } from '@web/views/form/form_controller';
|
||||
|
||||
import { listView } from '@web/views/list/list_view';
|
||||
import { ListController } from '@web/views/list/list_controller'
|
||||
|
||||
import { onRendered, onMounted } from "@odoo/owl";
|
||||
|
||||
export class RemoveFocusFormController extends FormController {
|
||||
setup() {
|
||||
super.setup();
|
||||
|
||||
onMounted(() => {
|
||||
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
registry.category('views').add('remove_focus_form_view', {
|
||||
...formView,
|
||||
Controller: RemoveFocusFormController,
|
||||
});
|
||||
|
||||
|
||||
export class RemoveFocusListController extends ListController {
|
||||
setup() {
|
||||
super.setup();
|
||||
|
||||
onMounted(() => {
|
||||
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
registry.category('views').add('remove_focus_list_view', {
|
||||
...listView,
|
||||
Controller: RemoveFocusListController,
|
||||
});
|
||||
@@ -263,7 +263,6 @@
|
||||
<field name="materials_no" readonly="1" force_save="1"/>
|
||||
<field name="gain_way" required="0"/>
|
||||
<field name="density" readonly="1" required="1" class="custom_required"/>
|
||||
<field name="need_m" default="false" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="rough_machining" required="1"/>
|
||||
@@ -307,7 +306,6 @@
|
||||
<field name="tensile_strength"/>
|
||||
<field name="hardness" optional="show"/>
|
||||
<field name="need_h"/>
|
||||
<field name="need_m"/>
|
||||
<field name="apply" widget="many2many_tags" optional="show"/>
|
||||
<field name="density" optional="show"/>
|
||||
<field name="rough_machining" optional="hide"/>
|
||||
@@ -354,7 +352,6 @@
|
||||
<field name="materials_no"/>
|
||||
<field name="name"/>
|
||||
<field name="need_h"/>
|
||||
<field name="need_m"/>
|
||||
<field name="mf_materia_post"/>
|
||||
<field name="density"/>
|
||||
<field name='materials_id' default="default" invisible="1"/>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_plan','jikimo_printing'],
|
||||
'depends': ['sf_plan', 'jikimo_printing', 'purchase_request', 'purchase_request_tier_validation'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/stock_route_group.xml',
|
||||
@@ -20,6 +20,7 @@
|
||||
'views/sale_order_views.xml',
|
||||
'wizard/sf_demand_plan_print_wizard_view.xml',
|
||||
'wizard/sf_release_plan_wizard_views.xml',
|
||||
'wizard/sf_demand_plan_detail_wizard_view.xml',
|
||||
'views/menu_view.xml',
|
||||
],
|
||||
'demo': [
|
||||
|
||||
@@ -9,3 +9,5 @@ from . import mrp_production
|
||||
from . import stock_rule
|
||||
from . import purchase_request
|
||||
from . import purchase_order
|
||||
from . import stock_move
|
||||
from . import stock_picking
|
||||
|
||||
@@ -222,15 +222,10 @@ class SfDemandPlan(models.Model):
|
||||
line_ids = self.line_ids.filtered(lambda p: p.status == '30')
|
||||
sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty'))
|
||||
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
|
||||
check_overdelivery_allowed = False
|
||||
for line in line_ids:
|
||||
if line.location_id.id == customer_location_id:
|
||||
if not self.overdelivery_allowed:
|
||||
if float_compare(sum_product_uom_qty, self.product_uom_qty,
|
||||
precision_rounding=line.product_id.uom_id.rounding) == 1:
|
||||
check_overdelivery_allowed = True
|
||||
if check_overdelivery_allowed:
|
||||
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
|
||||
if not self.overdelivery_allowed and line_ids.filtered(lambda p: p.location_id.id == customer_location_id):
|
||||
if float_compare(sum_product_uom_qty, self.product_uom_qty,
|
||||
precision_rounding=self.product_id.uom_id.rounding) == 1:
|
||||
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
|
||||
elif float_compare(sum_product_uom_qty, self.product_uom_qty,
|
||||
precision_rounding=self.product_id.uom_id.rounding) == 1:
|
||||
return {
|
||||
|
||||
@@ -613,14 +613,14 @@ class SfProductionDemandPlan(models.Model):
|
||||
filtered_plan = self.filtered(lambda mo: mo.status == '30')
|
||||
if not filtered_plan:
|
||||
raise UserError(_("没有需要下达的计划!"))
|
||||
check_overdelivery_allowed = False
|
||||
if not self.demand_plan_id.overdelivery_allowed:
|
||||
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
|
||||
if self.location_id.id == customer_location_id:
|
||||
check_overdelivery_allowed = True
|
||||
# 按产品分组并计算总数
|
||||
product_data = {}
|
||||
for plan in filtered_plan:
|
||||
check_overdelivery_allowed = False
|
||||
if not plan.demand_plan_id.overdelivery_allowed:
|
||||
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
|
||||
if plan.location_id.id == customer_location_id:
|
||||
check_overdelivery_allowed = True
|
||||
if plan.product_id not in product_data:
|
||||
# 初始化产品数据,从产品上获取需求量
|
||||
product_data[plan.product_id] = {
|
||||
@@ -630,22 +630,17 @@ class SfProductionDemandPlan(models.Model):
|
||||
|
||||
# 累加计划数量
|
||||
product_data[plan.product_id]['plan_uom_qty'] += plan.plan_uom_qty
|
||||
product_data[plan.product_id]['overdelivery_allowed'] = check_overdelivery_allowed
|
||||
# 检查需求超过计划数量的产品
|
||||
warning_messages = []
|
||||
error_messages = []
|
||||
for product, data in product_data.items():
|
||||
if data['overdelivery_allowed'] and float_compare(data['plan_uom_qty'], data['product_uom_qty'],precision_rounding=product.uom_id.rounding) == 1:
|
||||
error_messages.append(f"您正在下达的产品 {product.display_name},已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
|
||||
elif float_compare(data['plan_uom_qty'], data['product_uom_qty'],
|
||||
if float_compare(data['plan_uom_qty'], data['product_uom_qty'],
|
||||
precision_rounding=product.uom_id.rounding) == 1:
|
||||
warning_messages.append(
|
||||
_("您正在下达的产品 %s,计划量%s,需求数量为%s,已超过需求数量") %
|
||||
(product.display_name, data['plan_uom_qty'], data['product_uom_qty'])
|
||||
)
|
||||
if error_messages:
|
||||
error_message = "\n".join(error_messages)
|
||||
raise ValidationError(error_message)
|
||||
if warning_messages and check_overdelivery_allowed:
|
||||
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
|
||||
elif warning_messages:
|
||||
warning_message = "\n".join(warning_messages)
|
||||
return {
|
||||
@@ -660,9 +655,6 @@ class SfProductionDemandPlan(models.Model):
|
||||
'default_demand_plan_line_id': self.ids,
|
||||
'default_release_message': warning_message,
|
||||
}}
|
||||
else:
|
||||
for demand_plan_line_id in filtered_plan:
|
||||
demand_plan_line_id.action_confirm()
|
||||
|
||||
def button_release_plan(self):
|
||||
self.ensure_one()
|
||||
@@ -920,4 +912,60 @@ class SfProductionDemandPlan(models.Model):
|
||||
return values
|
||||
|
||||
def button_plan_detail(self):
|
||||
pass
|
||||
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',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'sf.demand.plan.detail.wizard',
|
||||
'target': 'new',
|
||||
'views': [(False, 'form')],
|
||||
'context': {
|
||||
'default_mrp_production_ids': self.mrp_production_ids.ids,
|
||||
'default_purchase_request_ids': purchase_request_ids.ids,
|
||||
'default_standard_purchase_order_ids': purchase_order_ids.filtered(
|
||||
lambda o: o.purchase_type == 'standard'
|
||||
).ids,
|
||||
'default_consignment_purchase_order_ids': purchase_order_ids.filtered(
|
||||
lambda o: o.purchase_type == 'consignment'
|
||||
).ids,
|
||||
'default_outsourcing_purchase_order_ids': purchase_order_ids.filtered(
|
||||
lambda o: o.purchase_type == 'outsourcing'
|
||||
).ids,
|
||||
'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,
|
||||
}}
|
||||
|
||||
37
sf_demand_plan/models/stock_move.py
Normal file
37
sf_demand_plan/models/stock_move.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
_inherit = 'stock.move'
|
||||
|
||||
demand_plan_line_ids = fields.Many2many(comodel_name="sf.production.demand.plan",
|
||||
string="需求计划明细", compute='_compute_demand_plan_line_ids', store=True)
|
||||
|
||||
@api.depends('origin', 'move_orig_ids')
|
||||
def _compute_demand_plan_line_ids(self):
|
||||
sorted_records = self.sorted(key=lambda r: -r.id)
|
||||
for line in sorted_records:
|
||||
origin = [origin.replace(' ', '') for origin in line.origin.split(',')]
|
||||
if line.created_purchase_request_line_id:
|
||||
line.demand_plan_line_ids = line.created_purchase_request_line_id.demand_plan_line_id.ids
|
||||
elif line.origin and 'MO' in line.origin:
|
||||
mp_ids = self.env['mrp.production'].sudo().search([('name', '=', origin[0])])
|
||||
line.demand_plan_line_ids = mp_ids.demand_plan_line_id.ids if mp_ids else []
|
||||
elif line.origin and 'P' in line.origin:
|
||||
purchase_order_ids = self.env['purchase.order'].sudo().search([('name', '=', origin[0])])
|
||||
if purchase_order_ids.order_line:
|
||||
line.demand_plan_line_ids = purchase_order_ids.order_line.demand_plan_line_id.ids
|
||||
elif line.move_orig_ids:
|
||||
demand_plan_lines = self.env['sf.production.demand.plan']
|
||||
for move_orig in line.move_orig_ids:
|
||||
demand_plan_lines |= move_orig.demand_plan_line_ids
|
||||
line.demand_plan_line_ids = demand_plan_lines.ids
|
||||
else:
|
||||
line.demand_plan_line_ids = []
|
||||
|
||||
if not line.demand_plan_line_ids and self.env.context.get('demand_plan_line_id'):
|
||||
plan_ids = self.env.context['demand_plan_line_id']
|
||||
line.demand_plan_line_ids = [plan_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
|
||||
@@ -13,4 +13,7 @@ access_stock_route_group,stock.route.group,model_stock_route_group,base.group_us
|
||||
access_stock_route_group_dispatch,stock.route.group.dispatch,model_stock_route_group,sf_base.group_plan_dispatch,1,1,0,0
|
||||
|
||||
access_sf_release_plan_wizard,sf.release.plan.wizard,model_sf_release_plan_wizard,base.group_user,1,0,0,0
|
||||
access_sf_release_plan_wizard_for_dispatch,sf.release.plan.wizard for dispatch,model_sf_release_plan_wizard,sf_base.group_plan_dispatch,1,1,1,1
|
||||
access_sf_release_plan_wizard_for_dispatch,sf.release.plan.wizard for dispatch,model_sf_release_plan_wizard,sf_base.group_plan_dispatch,1,1,1,1
|
||||
|
||||
access_sf_demand_plan_detail_wizard,sf.demand.plan.detail.wizard,model_sf_demand_plan_detail_wizard,base.group_user,1,0,0,0
|
||||
access_sf_demand_plan_detail_wizard_for_dispatch,sf.demand.plan.detail.wizard for dispatch,model_sf_demand_plan_detail_wizard,sf_base.group_plan_dispatch,1,1,1,1
|
||||
|
@@ -25,7 +25,6 @@ export class CustomDemandPlanListRenderer extends ListRenderer {
|
||||
const selectedRecords = this.props.list.selection;
|
||||
const isStatus30 = selectedRecords.some(record => record.data.status != "30");
|
||||
const button = $(this.__owl__.parent.bdom.parentEl).find('button[name="button_batch_release_plan"]');
|
||||
console.log('isStatus30', isStatus30, button);
|
||||
if (isStatus30) {
|
||||
// 禁用按钮
|
||||
button.attr('disabled', true);
|
||||
|
||||
@@ -92,6 +92,10 @@
|
||||
attrs="{'invisible': [('hide_release_production_order', '=', False)]}"
|
||||
/>
|
||||
<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>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
/>
|
||||
<button string="详情" name="button_plan_detail" type="object"
|
||||
class="btn-primary"
|
||||
attrs="{'invisible': [('status', 'not in', ('50','60'))]}"
|
||||
/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
from . import sf_demand_plan_print_wizard
|
||||
from . import sf_release_plan_wizard
|
||||
from . import sf_demand_plan_detail_wizard
|
||||
|
||||
74
sf_demand_plan/wizard/sf_demand_plan_detail_wizard.py
Normal file
74
sf_demand_plan/wizard/sf_demand_plan_detail_wizard.py
Normal file
@@ -0,0 +1,74 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SfDemandPlanDetailWizard(models.TransientModel):
|
||||
_name = 'sf.demand.plan.detail.wizard'
|
||||
_description = u'需求计划详情向导'
|
||||
|
||||
mrp_production_ids = fields.Many2many('mrp.production', string='关联制造订单', readonly=True)
|
||||
purchase_request_ids = fields.Many2many('purchase.request', string='关联采购申请', readonly=True)
|
||||
standard_purchase_order_ids = fields.Many2many('purchase.order', string='关联标准采购',
|
||||
relation='standard_purchase_order_rel',
|
||||
column1='plan_detail_wizard_id', column2='purchase_order_id',
|
||||
readonly=True)
|
||||
consignment_purchase_order_ids = fields.Many2many('purchase.order', string='关联工序外协采购',
|
||||
relation='consignment_purchase_order_rel',
|
||||
column1='plan_detail_wizard_id', column2='purchase_order_id',
|
||||
readonly=True)
|
||||
outsourcing_purchase_order_ids = fields.Many2many('purchase.order', string='关联委外加工采购',
|
||||
relation='outsourcing_purchase_order_rel',
|
||||
column1='plan_detail_wizard_id', column2='purchase_order_id',
|
||||
readonly=True)
|
||||
outside_purchase_order_ids = fields.Many2many('purchase.order', string='关联外购订单采购',
|
||||
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)
|
||||
58
sf_demand_plan/wizard/sf_demand_plan_detail_wizard_view.xml
Normal file
58
sf_demand_plan/wizard/sf_demand_plan_detail_wizard_view.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="action_plan_detail_form" model="ir.ui.view">
|
||||
<field name="name">sf.demand.plan.detail.wizard.form</field>
|
||||
<field name="model">sf.demand.plan.detail.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="详情">
|
||||
<notebook>
|
||||
<page string="采购申请" attrs="{'invisible': [('purchase_request_ids', '=', [])]}">
|
||||
<field name="purchase_request_ids" widget="many2many"/>
|
||||
</page>
|
||||
<page string="制造订单" attrs="{'invisible': [('mrp_production_ids', '=', [])]}">
|
||||
<field name="mrp_production_ids" widget="many2many"/>
|
||||
</page>
|
||||
<page string="标准采购" attrs="{'invisible': [('standard_purchase_order_ids', '=', [])]}">
|
||||
<field name="standard_purchase_order_ids" widget="many2many"/>
|
||||
</page>
|
||||
<page string="工序外协采购" attrs="{'invisible': [('consignment_purchase_order_ids', '=', [])]}">
|
||||
<field name="consignment_purchase_order_ids" widget="many2many"/>
|
||||
</page>
|
||||
<page string="委外加工采购" attrs="{'invisible': [('outsourcing_purchase_order_ids', '=', [])]}">
|
||||
<field name="outsourcing_purchase_order_ids" widget="many2many"/>
|
||||
</page>
|
||||
<page string="外购订单采购" attrs="{'invisible': [('outside_purchase_order_ids', '=', [])]}">
|
||||
<field name="outside_purchase_order_ids" widget="many2many"/>
|
||||
</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>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -5,7 +5,7 @@ from odoo import models, fields, api, _
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SfDemandPlanPrintWizard(models.TransientModel):
|
||||
class SfDemandPlanPrintWizard(models.Model):
|
||||
_name = 'sf.demand.plan.print.wizard'
|
||||
_description = u'打印向导'
|
||||
|
||||
@@ -37,7 +37,7 @@ class SfDemandPlanPrintWizard(models.TransientModel):
|
||||
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)])
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse', 'jikimo_attachment_viewer',
|
||||
'jikimo_sale_multiple_supply_methods', 'product', 'jikimo_tree_header_buttons_always_visible'],
|
||||
'jikimo_sale_multiple_supply_methods', 'product'],
|
||||
'data': [
|
||||
'data/cron_data.xml',
|
||||
'data/stock_data.xml',
|
||||
|
||||
@@ -178,7 +178,6 @@ class sfMaterialModel(models.Model):
|
||||
materials_model.mf_materia_post = item['mf_materia_post']
|
||||
materials_model.materials_id = materials.id
|
||||
materials_model.need_h = item['need_h']
|
||||
materials_model.need_m = item['need_m']
|
||||
materials_model.density = item['density']
|
||||
materials_model.active = item['active']
|
||||
else:
|
||||
@@ -193,7 +192,6 @@ class sfMaterialModel(models.Model):
|
||||
"active": item['active'],
|
||||
"materials_id": materials.id,
|
||||
"need_h": item['need_h'],
|
||||
"need_m": item['need_m'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
})
|
||||
@@ -230,7 +228,6 @@ class sfMaterialModel(models.Model):
|
||||
"standards_id": self.env['sf.international.standards'].search(
|
||||
[("name", '=', item['standards_id'])]).id,
|
||||
"need_h": item['need_h'],
|
||||
"need_m": item['need_m'],
|
||||
"alloy_code": item['alloy_code'],
|
||||
"mf_materia_post": item['mf_materia_post'],
|
||||
"density": item['density'],
|
||||
@@ -251,7 +248,6 @@ class sfMaterialModel(models.Model):
|
||||
materials_model.mf_materia_post = item['mf_materia_post']
|
||||
materials_model.materials_id = materials.id
|
||||
materials_model.need_h = item['need_h']
|
||||
materials_model.need_m = item['need_m']
|
||||
materials_model.density = item['density']
|
||||
materials_model.active = item['active']
|
||||
materials_model.materials_code= item['materials_code']
|
||||
|
||||
@@ -45759,11 +45759,6 @@ msgstr ""
|
||||
msgid "热处理"
|
||||
msgstr ""
|
||||
|
||||
#. module: sf_base
|
||||
#: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__need_m
|
||||
msgid "是否磁吸"
|
||||
msgstr ""
|
||||
|
||||
#. module: sf_base
|
||||
#: model:ir.model.fields,field_description:sf_base.field_sf_materials_model__mf_materia_post
|
||||
msgid "热处理后密度"
|
||||
|
||||
@@ -155,7 +155,7 @@ class ReSaleOrder(models.Model):
|
||||
'glb_url': item['glb_url'],
|
||||
'remark': item.get('remark'),
|
||||
'embryo_redundancy_id': item.get('embryo_redundancy_id'),
|
||||
'is_incoming_material': True if item.get('incoming_size') else False,
|
||||
'is_incoming_material': True if item.get('embryo_redundancy_id') else False,
|
||||
'manual_quotation': item.get('manual_quotation'),
|
||||
'model_id': item['model_id'],
|
||||
'delivery_end_date': item['delivery_end_date']
|
||||
@@ -287,7 +287,7 @@ class ResaleOrderLine(models.Model):
|
||||
check_status = fields.Selection(related='order_id.check_status')
|
||||
remark = fields.Char('备注')
|
||||
|
||||
is_incoming_material = fields.Boolean('客供料', store=True)
|
||||
is_incoming_material = fields.Boolean('客供料', compute='_compute_is_incoming_material', store=True)
|
||||
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
|
||||
manual_quotation = fields.Boolean('人工编程', default=False)
|
||||
model_url = fields.Char('模型文件地址')
|
||||
|
||||
Reference in New Issue
Block a user