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>
|
||||
<group>
|
||||
<group>
|
||||
<field name="code" readonly="1"/>
|
||||
<field name="code" />
|
||||
<field name="name" string="参数名"/>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
id="menu_sf_production_process"
|
||||
name="表面工艺"
|
||||
parent="menu_sf_production_process_1"
|
||||
sequence="1"
|
||||
sequence="2"
|
||||
action="sf_production_process"
|
||||
/>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
id="menu_sf_production_process_category"
|
||||
name="表面工艺类别"
|
||||
parent="menu_sf_production_process_1"
|
||||
sequence="2"
|
||||
sequence="1"
|
||||
action="sf_production_process_category"
|
||||
/>
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
id="menu_sf_processing_technology"
|
||||
name="加工工艺"
|
||||
parent="menu_sf_production_process_1"
|
||||
sequence="1"
|
||||
sequence="3"
|
||||
action="sf_processing_technology"/>
|
||||
|
||||
<!-- <menuitem-->
|
||||
|
||||
@@ -13,6 +13,10 @@ _logger = logging.getLogger(__name__)
|
||||
class AuthenticationError(Exception):
|
||||
pass
|
||||
|
||||
class AuthenticationError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Http(models.AbstractModel):
|
||||
_inherit = 'ir.http'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import cpca
|
||||
#import cpca
|
||||
import logging
|
||||
import base64
|
||||
import requests
|
||||
|
||||
@@ -203,12 +203,14 @@ class ResProductTemplate(models.Model):
|
||||
if vals.get('upload_model_file'):
|
||||
if vals.get('is_bfm') is False and vals.get('categ_type') == '成品':
|
||||
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]))])
|
||||
base64_data = base64.b64encode(attachment.datas)
|
||||
base64_datas = base64_data.decode('utf-8')
|
||||
model_code = hashlib.sha1(base64_datas.encode('utf-8')).hexdigest()
|
||||
report_path = attachment._full_path(attachment.store_fname)
|
||||
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)
|
||||
templates = super(ResProductTemplate, self).create(vals_list)
|
||||
if "create_product_product" not in self._context:
|
||||
@@ -222,7 +224,7 @@ class ResProductTemplate(models.Model):
|
||||
related_vals[field_name] = vals[field_name]
|
||||
if related_vals:
|
||||
template.write(related_vals)
|
||||
|
||||
logging.info('create-model_file:%s' % templates.model_file)
|
||||
return templates
|
||||
|
||||
@api.onchange('upload_model_file')
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import base64
|
||||
from io import BytesIO
|
||||
from odoo import api, fields, models
|
||||
from pystrich.code128 import Code128Encoder
|
||||
#from pystrich.code128 import Code128Encoder
|
||||
|
||||
|
||||
class Tray(models.Model):
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sale', 'sale_management'],
|
||||
'depends': ['sale', 'sale_management', 'web_widget_model_viewer'],
|
||||
'data': [
|
||||
'views/sale_order_view.xml'
|
||||
],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from odoo import models, fields
|
||||
import datetime
|
||||
import base64
|
||||
|
||||
|
||||
class ReSaleOrder(models.Model):
|
||||
@@ -48,5 +49,13 @@ class ReSaleOrder(models.Model):
|
||||
product.materials_id.name),
|
||||
'price_unit': product.list_price,
|
||||
'product_uom_qty': item['number'],
|
||||
'model_glb_file': base64.b64decode(item['model_file']),
|
||||
}
|
||||
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="deadline_of_delivery"/>
|
||||
</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">
|
||||
<field name="name" widget="section_and_note_text" optional="show"
|
||||
string="参数说明(长/宽/高/体积/精度/材质)"/>
|
||||
|
||||
Reference in New Issue
Block a user