1、处理销售单的依赖导致的更新报错问题;2、优化客供料单据获取销售单字段信息和成品信息方法;
This commit is contained in:
@@ -402,3 +402,11 @@ class MachiningAccuracy(models.Model):
|
||||
name = fields.Char('一般公差', index=True)
|
||||
standard_tolerance = fields.Char(string="标准公差")
|
||||
sync_id = fields.Char('同步ID')
|
||||
|
||||
|
||||
class ReSaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
person_of_delivery = fields.Char('收货人')
|
||||
telephone_of_delivery = fields.Char('电话号码')
|
||||
address_of_delivery = fields.Char('联系地址')
|
||||
|
||||
@@ -139,7 +139,7 @@
|
||||
<field name="name">维保计划</field>
|
||||
<field name="res_model">maintenance.request</field>
|
||||
<field name="view_mode">tree,kanban,form,pivot,graph,calendar</field>
|
||||
<field name="view_id" ref="maintenance.hr_equipment_request_view_kanban"/>
|
||||
<field name="view_id" ref="sf_maintenance.maintenance_request_view_tree_sf"/>
|
||||
<field name="context">{'default_user_id': uid}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
|
||||
@@ -548,35 +548,42 @@ class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
surface_technics_parameters_id = fields.Many2one('sf.production.process.parameter', string="表面工艺可选参数")
|
||||
person_of_delivery = fields.Char('收货人', compute='_compute_origin', store=True)
|
||||
telephone_of_delivery = fields.Char('电话号码', compute='_compute_origin', store=True)
|
||||
address_of_delivery = fields.Char('联系地址', compute='_compute_origin')
|
||||
person_of_delivery = fields.Char('收货人', compute='_compute_move_ids', store=True)
|
||||
telephone_of_delivery = fields.Char('电话号码', compute='_compute_move_ids', store=True)
|
||||
address_of_delivery = fields.Char('联系地址', compute='_compute_move_ids', store=True)
|
||||
|
||||
retrospect_ref = fields.Char('追溯参考', compute='_compute_origin', store=True)
|
||||
retrospect_ref = fields.Char('追溯参考', compute='_compute_move_ids', store=True)
|
||||
|
||||
@api.depends('origin')
|
||||
def _compute_origin(self):
|
||||
"""
|
||||
计算带料入库单对应销售单
|
||||
"""
|
||||
@api.depends('move_ids')
|
||||
def _compute_move_ids(self):
|
||||
for item in self:
|
||||
if item.picking_type_id.sequence_code == 'DL' and item.origin:
|
||||
if 'WH/IN/' in item.origin:
|
||||
picking_id = self.env['stock.picking'].search([('name', '=', item.origin)])
|
||||
if picking_id and picking_id.origin:
|
||||
purchase_id = self.env['purchase.order'].sudo().search([('name', '=', picking_id.origin)])
|
||||
if purchase_id and purchase_id.origin:
|
||||
sale_id = self.env['sale.order'].sudo().search([('name', '=', purchase_id.origin)])
|
||||
item.person_of_delivery = sale_id.person_of_delivery
|
||||
item.telephone_of_delivery = sale_id.telephone_of_delivery
|
||||
item.address_of_delivery = sale_id.address_of_delivery
|
||||
|
||||
bom = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', '=', self.move_ids.product_id.id)])
|
||||
if bom:
|
||||
if item.move_ids:
|
||||
if item.picking_type_id.sequence_code == 'DL':
|
||||
item.retrospect_ref = bom.product_tmpl_id.default_code
|
||||
sale_name = item.move_ids[0].product_id.name.split('-')[1]
|
||||
if 'S' in sale_name:
|
||||
sale_id = self.env['sale.order'].sudo().search([('name', '=', sale_name)])
|
||||
item.person_of_delivery = sale_id.person_of_delivery
|
||||
item.telephone_of_delivery = sale_id.telephone_of_delivery
|
||||
item.address_of_delivery = sale_id.address_of_delivery
|
||||
else:
|
||||
raise ValidationError('坯料名称格式错误,正确格式为[R-S???-?]!!!')
|
||||
move_ids = []
|
||||
for move_id in item.move_ids:
|
||||
move_ids.append(move_id.product_id.id)
|
||||
boms = self.env['mrp.bom'].sudo().search([('bom_line_ids.product_id', 'in', move_ids)])
|
||||
default_codes = ''
|
||||
if boms:
|
||||
for bom in boms:
|
||||
code = bom.product_tmpl_id.default_code.split('-')[-1]
|
||||
default_code = bom.product_tmpl_id.default_code.split(f'-{code}')[0]
|
||||
if default_code not in default_codes:
|
||||
if default_codes == '':
|
||||
default_codes = default_code
|
||||
else:
|
||||
default_codes = default_codes + ',' + default_code
|
||||
item.retrospect_ref = default_codes
|
||||
elif item.picking_type_id.sequence_code in ['INT', 'PC']:
|
||||
item.retrospect_ref = bom.product_tmpl_id.name
|
||||
pass
|
||||
|
||||
# 设置外协出入单的名称
|
||||
def _get_name_Res(self, rescode):
|
||||
|
||||
@@ -32,9 +32,9 @@ class ReSaleOrder(models.Model):
|
||||
tracking=3,
|
||||
default='draft')
|
||||
deadline_of_delivery = fields.Date('订单交期', tracking=True)
|
||||
person_of_delivery = fields.Char('收货人')
|
||||
telephone_of_delivery = fields.Char('电话号码')
|
||||
address_of_delivery = fields.Char('联系地址')
|
||||
# person_of_delivery = fields.Char('收货人')
|
||||
# telephone_of_delivery = fields.Char('电话号码')
|
||||
# address_of_delivery = fields.Char('联系地址')
|
||||
payments_way = fields.Selection([('现结', '现结'), ('月结', '月结')], '结算方式', default='现结', tracking=True)
|
||||
pay_way = fields.Selection([('转账', '转账'), ('微信', '微信'), ('支付宝', '支付宝')], '支付方式')
|
||||
check_status = fields.Selection([('pending', '待审核'), ('approved', '已审核'), ('fail', '不通过')], '审核状态')
|
||||
|
||||
@@ -450,7 +450,7 @@
|
||||
<field name="production_line_name_id" optional="hide"/>
|
||||
<field name="machine_tool_name_id" optional="hide"/>
|
||||
<field name="applicant" optional="hide"/>
|
||||
<field name="apply_time"/>
|
||||
<field name="create_date" string="申请时间"/>
|
||||
<field name="assemble_status" widget='badge'
|
||||
decoration-info="assemble_status == '0'"
|
||||
decoration-warning="assemble_status == '01'"
|
||||
|
||||
Reference in New Issue
Block a user