回退代码
This commit is contained in:
@@ -13,7 +13,6 @@
|
||||
'views/purchase_request_view.xml',
|
||||
'wizard/purchase_request_line_make_purchase_order_view.xml',
|
||||
'views/purchase_request_line_view.xml',
|
||||
'views/stock_picking_views.xml',
|
||||
],
|
||||
'assets': {
|
||||
'web.assets_backend': [
|
||||
|
||||
@@ -1043,7 +1043,7 @@ msgstr "询价单"
|
||||
#. module: purchase_request
|
||||
#: model:ir.model.fields,field_description:purchase_request.field_purchase_request_line__purchased_qty
|
||||
msgid "RFQ/PO Qty"
|
||||
msgstr "已订购数"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_request
|
||||
#. odoo-python
|
||||
|
||||
@@ -5,4 +5,3 @@ from . import sale_order
|
||||
from . import mrp_production
|
||||
from . import purchase_order
|
||||
from . import stock_rule
|
||||
from . import stock_picking
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
from odoo import fields, api, models, _
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = "stock.picking"
|
||||
|
||||
purchase_request_count = fields.Integer('采购订单数量', compute='_compute_purchase_request')
|
||||
|
||||
@api.depends('name')
|
||||
def _compute_purchase_request(self):
|
||||
for record in self:
|
||||
purchase_request_ids = self.env['purchase.request'].search([('origin', '=', record.name)])
|
||||
record.purchase_request_count = len(purchase_request_ids)
|
||||
|
||||
def action_view_purchase_request(self):
|
||||
self.ensure_one()
|
||||
|
||||
purchase_request_ids = self.env['purchase.request'].search([('origin', '=', self.name)])
|
||||
|
||||
action = {
|
||||
'res_model': 'purchase.request',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
if len(purchase_request_ids) == 1:
|
||||
action.update({
|
||||
'view_mode': 'form',
|
||||
'res_id': purchase_request_ids[0].id,
|
||||
})
|
||||
else:
|
||||
action.update({
|
||||
'name': _("从 %s生成采购请求单", self.name),
|
||||
'domain': [('id', 'in', purchase_request_ids.ids)],
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action
|
||||
@@ -48,8 +48,8 @@ class StockRule(models.Model):
|
||||
# 如果补货组相同,并且产品相同,则合并
|
||||
procurements_dict = defaultdict()
|
||||
for procurement, rule in procurements:
|
||||
if (procurement.product_id.id, procurement.values['group_id'], rule.id) not in procurements_dict:
|
||||
procurements_dict[(procurement.product_id.id, procurement.values['group_id'], rule.id)] = {
|
||||
if (procurement.product_id, procurement.values['group_id'], rule) not in procurements_dict:
|
||||
procurements_dict[(procurement.product_id, procurement.values['group_id'], rule)] = {
|
||||
'product_id': procurement.product_id,
|
||||
'product_qty': procurement.product_qty,
|
||||
'product_uom': procurement.product_uom,
|
||||
@@ -61,8 +61,7 @@ class StockRule(models.Model):
|
||||
'rule': rule
|
||||
}
|
||||
else:
|
||||
procurements_dict[(procurement.product_id.id, procurement.values['group_id'], rule.id)]['product_qty'] += procurement.product_qty
|
||||
procurements_dict[(procurement.product_id.id, procurement.values['group_id'], rule.id)]['values']['move_dest_ids'] |= procurement.values['move_dest_ids']
|
||||
procurements_dict[(procurement.product_id, procurement.values['group_id'], rule)]['product_qty'] += procurement.product_qty
|
||||
new_procurements = []
|
||||
for k, p in procurements_dict.items():
|
||||
new_procurements.append((
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="stock_pikcing_inherited_form_jikimo_purchase_request" model="ir.ui.view">
|
||||
<field name="name">stock.pikcing.inherited.form.jikimo.purchase.request</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='button_box']/button" position="before">
|
||||
<button class="oe_stat_button" name="action_view_purchase_request" type="object" icon="fa-credit-card"
|
||||
attrs="{'invisible': [('purchase_request_count', '=', 0)]}">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value">
|
||||
<field name="purchase_request_count"/>
|
||||
</span>
|
||||
<span class="o_stat_text">采购申请</span>
|
||||
</div>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -119,11 +119,3 @@ class PurchaseRequestLineMakePurchaseOrderItem(models.TransientModel):
|
||||
_inherit = "purchase.request.line.make.purchase.order.item"
|
||||
|
||||
supply_method = fields.Selection(related='line_id.supply_method', string='供货方式')
|
||||
|
||||
wiz_id = fields.Many2one(
|
||||
comodel_name="purchase.request.line.make.purchase.order",
|
||||
string="Wizard",
|
||||
required=False,
|
||||
ondelete="cascade",
|
||||
readonly=True,
|
||||
)
|
||||
|
||||
@@ -141,7 +141,7 @@ class QualityCheck(models.Model):
|
||||
# # 出厂检验报告编号
|
||||
# report_number = fields.Char('出厂检验报告编号', compute='_compute_report_number', readonly=True)
|
||||
# 总数量,值为调拨单_产品明细_数量
|
||||
total_qty = fields.Char('总数量', compute='_compute_total_qty', store=True)
|
||||
total_qty = fields.Char('总数量', compute='_compute_total_qty')
|
||||
|
||||
column_nums = fields.Integer('测量值列数', default=1)
|
||||
|
||||
@@ -153,9 +153,9 @@ class QualityCheck(models.Model):
|
||||
for move in record.picking_id.move_ids_without_package:
|
||||
if move.product_id == record.product_id:
|
||||
total_qty = int(move.product_uom_qty)
|
||||
record.total_qty = total_qty if total_qty > 0 else 0
|
||||
record.total_qty = total_qty if total_qty > 0 else ''
|
||||
else:
|
||||
record.total_qty = 0
|
||||
record.total_qty = ''
|
||||
|
||||
# 检验数
|
||||
check_qty = fields.Integer('检验数', default=lambda self: self._get_default_check_qty())
|
||||
@@ -735,9 +735,8 @@ class QualityCheck(models.Model):
|
||||
def _compute_qty_to_test(self):
|
||||
for qc in self:
|
||||
if qc.is_lot_tested_fractionally:
|
||||
rounding = qc.product_id.uom_id.rounding if qc.product_id.uom_id else 0.01
|
||||
qc.qty_to_test = float_round(qc.qty_line * qc.testing_percentage_within_lot / 100,
|
||||
precision_rounding=rounding, rounding_method="UP")
|
||||
precision_rounding=self.product_id.uom_id.rounding, rounding_method="UP")
|
||||
else:
|
||||
qc.qty_to_test = qc.qty_line
|
||||
|
||||
|
||||
@@ -23,8 +23,8 @@ class QualityCheckWizard(models.TransientModel):
|
||||
lot_name = fields.Char(related='current_check_id.lot_name')
|
||||
lot_line_id = fields.Many2one(related='current_check_id.lot_line_id')
|
||||
qty_line = fields.Float(related='current_check_id.qty_line')
|
||||
qty_to_test = fields.Float(related='current_check_id.qty_to_test', string='待检')
|
||||
qty_tested = fields.Float(related='current_check_id.qty_tested', string='已检', readonly=False)
|
||||
qty_to_test = fields.Float(related='current_check_id.qty_to_test')
|
||||
qty_tested = fields.Float(related='current_check_id.qty_tested', readonly=False)
|
||||
measure = fields.Float(related='current_check_id.measure', readonly=False)
|
||||
measure_on = fields.Selection(related='current_check_id.measure_on')
|
||||
quality_state = fields.Selection(related='current_check_id.quality_state')
|
||||
|
||||
@@ -268,8 +268,6 @@ class ReworkWizard(models.TransientModel):
|
||||
'cmm_ids': new_cnc_workorder.cmm_ids.sudo()._json_cmm_program(
|
||||
cnc_work.processing_panel, ret),
|
||||
'cnc_worksheet': old_cnc_rework.cnc_worksheet})
|
||||
# 复制装夹图纸
|
||||
new_cnc_workorder.processing_drawing = old_cnc_rework.processing_drawing
|
||||
# ========== 处理装夹预调 【装夹图纸】 数据 ================
|
||||
for new_pre_work in new_pre_workorder_ids:
|
||||
pre_rework = max(self.production_id.workorder_ids.filtered(
|
||||
|
||||
@@ -5,7 +5,6 @@ from odoo import fields, models, api
|
||||
from odoo.exceptions import ValidationError
|
||||
from datetime import datetime
|
||||
from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.tools import float_round
|
||||
|
||||
|
||||
class QualityCheck(models.Model):
|
||||
@@ -141,71 +140,3 @@ class QualityCheck(models.Model):
|
||||
return "零件特采发送成功"
|
||||
else:
|
||||
raise ValidationError("零件特采发送失败")
|
||||
|
||||
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
for val in vals_list:
|
||||
if 'point_id' in val and 'measure_on' not in val:
|
||||
# 如果没有控制方式字段,则从检查点读取质量方式
|
||||
point_id = self.env['quality.point'].browse(val['point_id'])
|
||||
val.update({'measure_on': point_id.measure_on})
|
||||
return super(QualityCheck, self).create(vals_list)
|
||||
|
||||
|
||||
@api.depends('total_qty','testing_percentage_within_lot', 'is_lot_tested_fractionally')
|
||||
def _compute_workorder_qty_to_test(self):
|
||||
for qc in self:
|
||||
if qc.is_lot_tested_fractionally:
|
||||
rounding = qc.product_id.uom_id.rounding if qc.product_id.uom_id else 0.01
|
||||
qc.workorder_qty_to_test = float_round(float(qc.total_qty) * qc.testing_percentage_within_lot / 100,
|
||||
precision_rounding=rounding, rounding_method="UP")
|
||||
else:
|
||||
qc.workorder_qty_to_test = qc.total_qty
|
||||
|
||||
@api.depends('picking_id', 'workorder_id')
|
||||
def _compute_total_qty(self):
|
||||
super(QualityCheck, self)._compute_total_qty()
|
||||
for qc in self:
|
||||
if not qc.picking_id and qc.workorder_id:
|
||||
qc.total_qty = qc.workorder_id.production_id.product_qty
|
||||
|
||||
@api.depends('workorder_qty_to_test')
|
||||
def _compute_workorder_qty_tested(self):
|
||||
for qc in self:
|
||||
qc.workorder_qty_tested = qc.workorder_qty_to_test
|
||||
|
||||
|
||||
workorder_qty_to_test = fields.Float('应检', compute='_compute_workorder_qty_to_test', store=True)
|
||||
workorder_qty_tested = fields.Float('已检', compute='_compute_workorder_qty_tested', store=True)
|
||||
workorder_qty_test_failed = fields.Float('不合格数')
|
||||
|
||||
|
||||
@api.onchange('total_qty', 'workorder_qty_test_failed', 'workorder_qty_to_test', 'workorder_qty_tested')
|
||||
def _onchage_qty(self):
|
||||
for record in self:
|
||||
if record.total_qty and record.workorder_qty_to_test and record.workorder_qty_to_test > float(record.total_qty):
|
||||
record.workorder_qty_to_test = float(record.total_qty)
|
||||
return {
|
||||
'warning': {
|
||||
'title': '警告',
|
||||
'message': '待检数量不能超过总数量'
|
||||
}
|
||||
}
|
||||
if record.workorder_qty_to_test and record.workorder_qty_tested and record.workorder_qty_tested > record.workorder_qty_to_test:
|
||||
record.workorder_qty_tested = record.workorder_qty_to_test
|
||||
return {
|
||||
'warning': {
|
||||
'title': '警告',
|
||||
'message': '已检数量不能超过待检数量'
|
||||
}
|
||||
}
|
||||
if record.workorder_qty_tested and record.workorder_qty_test_failed and record.workorder_qty_test_failed > record.workorder_qty_tested:
|
||||
record.workorder_qty_test_failed = record.workorder_qty_tested
|
||||
return {
|
||||
'warning': {
|
||||
'title': '警告',
|
||||
'message': '不合格数量不能超过已检数量'
|
||||
}
|
||||
}
|
||||
@@ -88,42 +88,6 @@
|
||||
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" confirm="确定取消发布吗?" attrs="{'invisible': ['|',('is_out_check', '=', False), ('publish_status', '!=', 'published')]}"/>
|
||||
<button name="do_re_publish" string="重新发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'canceled')]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='total_qty']" position="attributes">
|
||||
<attribute name="attrs">{
|
||||
'invisible': ['&', '|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False), '|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)],
|
||||
'readonly': ['|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)],
|
||||
'on_change': ['|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)]
|
||||
}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='total_qty']" position="after">
|
||||
<label for="workorder_qty_to_test"
|
||||
attrs="{'invisible': ['|', '&', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False), ('is_lot_tested_fractionally', '=', False)]}"/>
|
||||
<div class="o_row"
|
||||
attrs="{'invisible': ['|', '&', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False), ('is_lot_tested_fractionally', '=', False)]}">
|
||||
<field name="workorder_qty_to_test" attrs="{'readonly': 0, 'on_chnage': 1}"/>
|
||||
<field name="uom_id"/>
|
||||
</div>
|
||||
<label for="workorder_qty_tested"
|
||||
attrs="{'invisible': ['|', '&', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False), ('is_lot_tested_fractionally', '=', False)]}"/>
|
||||
<div class="o_row"
|
||||
attrs="{'invisible': ['|', '&', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False), ('is_lot_tested_fractionally', '=', False)]}">
|
||||
<field name="workorder_qty_tested" attrs="{'readonly': [('quality_state', '!=', 'none')], 'on_chnage': 1}"/>
|
||||
<field name="uom_id"/>
|
||||
</div>
|
||||
<label for="workorder_qty_test_failed"
|
||||
attrs="{'invisible': ['|', '&', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False), ('is_lot_tested_fractionally', '=', False)]}"/>
|
||||
<div class="o_row"
|
||||
attrs="{'invisible': ['|', '&', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False), ('is_lot_tested_fractionally', '=', False)]}">
|
||||
<field name="workorder_qty_test_failed" attrs="{'readonly': [('quality_state', '!=', 'none')], 'on_chnage': 1}"/>
|
||||
<field name="uom_id"/>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='qty_tested']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False), '&', ('measure_on', '=', 'move_line'), ('workorder_id', '!=', False)]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@class='o_row'][.//field[@name='qty_tested']]" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '|', ('measure_on', '!=', 'move_line'), ('is_lot_tested_fractionally', '=', False), '&', ('measure_on', '=', 'move_line'), ('workorder_id', '!=', False)]}</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user