Accept Merge Request #2200: (feature/平台下单优化_1 -> develop)
Merge Request: Merge branch 'feature/平台下单优化' into feature/平台下单优化_1 Created By: @禹翔辉 Reviewed By: @胡尧 Approved By: @胡尧 Accepted By: @禹翔辉 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2200
This commit is contained in:
@@ -10,6 +10,7 @@ class ResProductTemplate(models.Model):
|
||||
model_name = fields.Char('模型名称')
|
||||
categ_type = fields.Selection(
|
||||
[("成品", "成品"), ("胚料", "胚料"), ("原材料", "原材料")], string='产品的类别', related='categ_id.type', store=True)
|
||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
|
||||
model_long = fields.Float('模型长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('模型宽[mm]', digits=(16, 3))
|
||||
model_height = fields.Float('模型高[mm]', digits=(16, 3))
|
||||
@@ -74,6 +75,7 @@ class ResProductTemplate(models.Model):
|
||||
attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
vals = {
|
||||
'name': '%s-%s-%s' % ('P', order_id.name, i),
|
||||
'blank_type': item.get('blank_type'),
|
||||
'model_long': item['model_long'] + model_type.embryo_tolerance,
|
||||
'model_width': item['model_width'] + model_type.embryo_tolerance,
|
||||
'model_height': item['model_height'] + model_type.embryo_tolerance,
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
<page string="加工参数">
|
||||
<group>
|
||||
<group string="模型">
|
||||
<label for="model_long" string="尺寸[mm]"/>
|
||||
<label for="model_long" string="坯料尺寸[mm]"/>
|
||||
<div class="o_address_format">
|
||||
<label for="model_long" string="长"/>
|
||||
<field name="model_long" class="o_address_zip"/>
|
||||
@@ -104,6 +104,7 @@
|
||||
<label for="model_height" string="高"/>
|
||||
<field name="model_height" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="blank_type" readonly="1"/>
|
||||
<field name="model_volume" string="体积[mm³]"/>
|
||||
<field name="product_model_type_id" string="模型类型"/>
|
||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"
|
||||
|
||||
@@ -45,9 +45,8 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
||||
product.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
|
||||
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
i += 1
|
||||
if kw.get('contract_file_name') and kw.get('contract_file') and kw.get('contract_code'):
|
||||
order_id.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
|
||||
order_id.write({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
|
||||
# BFM 内部下单 新增合同等内容补充
|
||||
order_id.write_sale_documents(kw)
|
||||
res['factory_order_no'] = order_id.name
|
||||
order_id.confirm_to_supply_method()
|
||||
except Exception as e:
|
||||
|
||||
@@ -26,6 +26,7 @@ class ResProductMo(models.Model):
|
||||
model_file = fields.Binary('模型文件')
|
||||
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
|
||||
model_name = fields.Char('模型名称')
|
||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
|
||||
model_long = fields.Float('模型长(mm)', digits=(16, 3))
|
||||
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
||||
model_height = fields.Float('模型高(mm)', digits=(16, 3))
|
||||
@@ -895,6 +896,7 @@ class ResProductMo(models.Model):
|
||||
product_name = self.generate_product_name(order_id, item, i)
|
||||
vals = {
|
||||
'name': product_name,
|
||||
'blank_type': item.get('blank_type'),
|
||||
'model_long': self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
||||
'model_width': self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
||||
'model_height': self.format_float(item['model_height'] + embryo_redundancy_id.height),
|
||||
|
||||
@@ -193,6 +193,19 @@ class SaleOrder(models.Model):
|
||||
'target': 'new',
|
||||
'res_id': wizard.id,
|
||||
}
|
||||
|
||||
def write_sale_documents(self, kw):
|
||||
"""BFM 内部下单 内容补充 """
|
||||
val = {}
|
||||
if kw.get('contract_file_name') and kw.get('contract_file'):
|
||||
document_id = self.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
|
||||
val.update({'contract_document_id': document_id.id})
|
||||
if kw.get('contract_code') or kw.get('contract_date'):
|
||||
val.update({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
|
||||
if kw.get('customer_name'):
|
||||
val.update({'customer_name': kw.get('customer_name')})
|
||||
self.write(val)
|
||||
|
||||
def create_sale_documents(self, contract_file_name, contract_file):
|
||||
# 创建ir.attachment记录
|
||||
attachment = self.env['ir.attachment'].sudo().create({
|
||||
@@ -214,9 +227,7 @@ class SaleOrder(models.Model):
|
||||
'res_id': self.id,
|
||||
})
|
||||
|
||||
self.write({
|
||||
'contract_document_id': document.id
|
||||
})
|
||||
return document
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
@@ -63,6 +63,7 @@ class ReSaleOrder(models.Model):
|
||||
|
||||
model_display_version = fields.Char('模型展示版本', default="v1")
|
||||
|
||||
customer_name = fields.Char('终端客户')
|
||||
contract_code = fields.Char('合同编号')
|
||||
contract_date = fields.Date('合同日期')
|
||||
contract_document_id = fields.Many2one('documents.document', string='合同文件')
|
||||
@@ -158,6 +159,7 @@ class ReSaleOrder(models.Model):
|
||||
'manual_quotation': item.get('manual_quotation'),
|
||||
'model_id': item['model_id'],
|
||||
'delivery_end_date': item['delivery_end_date'],
|
||||
'customer_delivery_date': item.get('customer_delivery_date'),
|
||||
}
|
||||
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
||||
|
||||
@@ -291,8 +293,8 @@ class ResaleOrderLine(models.Model):
|
||||
manual_quotation = fields.Boolean('人工编程', default=False)
|
||||
model_url = fields.Char('模型文件地址')
|
||||
model_id = fields.Char('模型ID')
|
||||
|
||||
delivery_end_date = fields.Date('交货截止日期')
|
||||
customer_delivery_date = fields.Date('客户交期')
|
||||
|
||||
@api.depends('embryo_redundancy_id')
|
||||
def _compute_is_incoming_material(self):
|
||||
|
||||
@@ -90,6 +90,9 @@
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'is_customer': True }"
|
||||
options='{"always_reload": True,"no_create": True}'/>
|
||||
<field name="customer_name" readonly="1"/>
|
||||
<field name="contract_code" readonly="1"/>
|
||||
<field name="contract_date" readonly="1"/>
|
||||
</field>
|
||||
<field name="payment_term_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||
@@ -124,6 +127,7 @@
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
||||
<field name="name" widget="section_and_note_text" optional="show"
|
||||
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
||||
<field name="customer_delivery_date" readonly="1"/>
|
||||
<field name="manual_quotation" readonly="1"/>
|
||||
<field name="is_incoming_material" readonly="1"/>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user