Accept Merge Request #176: (feature/销售订单行新增模型展示 -> develop)
Merge Request: 销售订单行新增模型展示 Created By: @杨金灵 Accepted By: @杨金灵 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/176?initial=true
This commit is contained in:
@@ -131,7 +131,7 @@
|
|||||||
<sheet>
|
<sheet>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="code" readonly="1"/>
|
<field name="code" />
|
||||||
<field name="name" string="参数名"/>
|
<field name="name" string="参数名"/>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group>
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
id="menu_sf_production_process"
|
id="menu_sf_production_process"
|
||||||
name="表面工艺"
|
name="表面工艺"
|
||||||
parent="menu_sf_production_process_1"
|
parent="menu_sf_production_process_1"
|
||||||
sequence="1"
|
sequence="2"
|
||||||
action="sf_production_process"
|
action="sf_production_process"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@
|
|||||||
id="menu_sf_production_process_category"
|
id="menu_sf_production_process_category"
|
||||||
name="表面工艺类别"
|
name="表面工艺类别"
|
||||||
parent="menu_sf_production_process_1"
|
parent="menu_sf_production_process_1"
|
||||||
sequence="2"
|
sequence="1"
|
||||||
action="sf_production_process_category"
|
action="sf_production_process_category"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@
|
|||||||
id="menu_sf_processing_technology"
|
id="menu_sf_processing_technology"
|
||||||
name="加工工艺"
|
name="加工工艺"
|
||||||
parent="menu_sf_production_process_1"
|
parent="menu_sf_production_process_1"
|
||||||
sequence="1"
|
sequence="3"
|
||||||
action="sf_processing_technology"/>
|
action="sf_processing_technology"/>
|
||||||
|
|
||||||
<!-- <menuitem-->
|
<!-- <menuitem-->
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ _logger = logging.getLogger(__name__)
|
|||||||
class AuthenticationError(Exception):
|
class AuthenticationError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
class AuthenticationError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Http(models.AbstractModel):
|
class Http(models.AbstractModel):
|
||||||
_inherit = 'ir.http'
|
_inherit = 'ir.http'
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import cpca
|
#import cpca
|
||||||
import logging
|
import logging
|
||||||
import base64
|
import base64
|
||||||
import requests
|
import requests
|
||||||
|
|||||||
@@ -203,12 +203,14 @@ class ResProductTemplate(models.Model):
|
|||||||
if vals.get('upload_model_file'):
|
if vals.get('upload_model_file'):
|
||||||
if vals.get('is_bfm') is False and vals.get('categ_type') == '成品':
|
if vals.get('is_bfm') is False and vals.get('categ_type') == '成品':
|
||||||
for item in vals['upload_model_file']:
|
for item in vals['upload_model_file']:
|
||||||
|
logging.info('create-attachment:%s' % int(item[2][0]))
|
||||||
attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))])
|
attachment = self.env['ir.attachment'].sudo().search([('id', '=', int(item[2][0]))])
|
||||||
base64_data = base64.b64encode(attachment.datas)
|
base64_data = base64.b64encode(attachment.datas)
|
||||||
base64_datas = base64_data.decode('utf-8')
|
base64_datas = base64_data.decode('utf-8')
|
||||||
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
||||||
report_path = attachment._full_path(attachment.store_fname)
|
report_path = attachment._full_path(attachment.store_fname)
|
||||||
vals['model_file'] = self.transition_glb_file(report_path, model_code)
|
vals['model_file'] = self.transition_glb_file(report_path, model_code)
|
||||||
|
logging.info('create-model_file:%s' % len(vals['model_file']))
|
||||||
self._sanitize_vals(vals)
|
self._sanitize_vals(vals)
|
||||||
templates = super(ResProductTemplate, self).create(vals_list)
|
templates = super(ResProductTemplate, self).create(vals_list)
|
||||||
if "create_product_product" not in self._context:
|
if "create_product_product" not in self._context:
|
||||||
@@ -222,7 +224,7 @@ class ResProductTemplate(models.Model):
|
|||||||
related_vals[field_name] = vals[field_name]
|
related_vals[field_name] = vals[field_name]
|
||||||
if related_vals:
|
if related_vals:
|
||||||
template.write(related_vals)
|
template.write(related_vals)
|
||||||
|
logging.info('create-model_file:%s' % templates.model_file)
|
||||||
return templates
|
return templates
|
||||||
|
|
||||||
@api.onchange('upload_model_file')
|
@api.onchange('upload_model_file')
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import base64
|
import base64
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from odoo import api, fields, models
|
from odoo import api, fields, models
|
||||||
from pystrich.code128 import Code128Encoder
|
#from pystrich.code128 import Code128Encoder
|
||||||
|
|
||||||
|
|
||||||
class Tray(models.Model):
|
class Tray(models.Model):
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sale', 'sale_management'],
|
'depends': ['sale', 'sale_management', 'web_widget_model_viewer'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/sale_order_view.xml'
|
'views/sale_order_view.xml'
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
from odoo import models, fields
|
from odoo import models, fields
|
||||||
import datetime
|
import datetime
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
class ReSaleOrder(models.Model):
|
class ReSaleOrder(models.Model):
|
||||||
@@ -48,5 +49,13 @@ class ReSaleOrder(models.Model):
|
|||||||
product.materials_id.name),
|
product.materials_id.name),
|
||||||
'price_unit': product.list_price,
|
'price_unit': product.list_price,
|
||||||
'product_uom_qty': item['number'],
|
'product_uom_qty': item['number'],
|
||||||
|
'model_glb_file': base64.b64decode(item['model_file']),
|
||||||
}
|
}
|
||||||
return self.env['sale.order.line'].create(vals)
|
return self.env['sale.order.line'].create(vals)
|
||||||
|
|
||||||
|
|
||||||
|
class ResaleOrderLine(models.Model):
|
||||||
|
_inherit = 'sale.order.line'
|
||||||
|
|
||||||
|
model_glb_file = fields.Binary('模型的glb文件')
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,10 @@
|
|||||||
<field name="payment_term_id" position="after">
|
<field name="payment_term_id" position="after">
|
||||||
<field name="deadline_of_delivery"/>
|
<field name="deadline_of_delivery"/>
|
||||||
</field>
|
</field>
|
||||||
|
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="before">
|
||||||
|
<field name="model_glb_file" widget="Viewer3D" optional="show"
|
||||||
|
string="模型文件"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
<xpath expr="//field[@name='order_line']/tree/field[@name='name']" position="replace">
|
||||||
<field name="name" widget="section_and_note_text" optional="show"
|
<field name="name" widget="section_and_note_text" optional="show"
|
||||||
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user