新增上传模型功能
This commit is contained in:
@@ -312,7 +312,8 @@ class MachineToolType(models.Model):
|
|||||||
machine_tool_type_ids = []
|
machine_tool_type_ids = []
|
||||||
for item in machine_tool_type_code:
|
for item in machine_tool_type_code:
|
||||||
machine_tool_type = self.search([('code', '=', item)])
|
machine_tool_type = self.search([('code', '=', item)])
|
||||||
machine_tool_type_ids.append(machine_tool_type.id)
|
if machine_tool_type:
|
||||||
|
machine_tool_type_ids.append(machine_tool_type.id)
|
||||||
return [(6, 0, machine_tool_type_ids)]
|
return [(6, 0, machine_tool_type_ids)]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1520,7 +1520,7 @@ class SyncFixtureModel(models.Model):
|
|||||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||||
"driving_way": item['driving_way'],
|
"driving_way": item['driving_way'],
|
||||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||||
item['apply_machine_tool_type_code']).id,
|
item['apply_machine_tool_type_code']),
|
||||||
"through_hole_size": item['through_hole_size'],
|
"through_hole_size": item['through_hole_size'],
|
||||||
"screw_size": item['screw_size'],
|
"screw_size": item['screw_size'],
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
@@ -1550,7 +1550,7 @@ class SyncFixtureModel(models.Model):
|
|||||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||||
"driving_way": item['driving_way'],
|
"driving_way": item['driving_way'],
|
||||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||||
item['apply_machine_tool_type_code']).id,
|
item['apply_machine_tool_type_code']),
|
||||||
"through_hole_size": item['through_hole_size'],
|
"through_hole_size": item['through_hole_size'],
|
||||||
"screw_size": item['screw_size'],
|
"screw_size": item['screw_size'],
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
@@ -1602,7 +1602,7 @@ class SyncFixtureModel(models.Model):
|
|||||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||||
"driving_way": item['driving_way'],
|
"driving_way": item['driving_way'],
|
||||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||||
item['apply_machine_tool_type_code']).id,
|
item['apply_machine_tool_type_code']),
|
||||||
"through_hole_size": item['through_hole_size'],
|
"through_hole_size": item['through_hole_size'],
|
||||||
"screw_size": item['screw_size'],
|
"screw_size": item['screw_size'],
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
@@ -1632,7 +1632,7 @@ class SyncFixtureModel(models.Model):
|
|||||||
[('materials_no', '=', item['materials_model_code'])]).id,
|
[('materials_no', '=', item['materials_model_code'])]).id,
|
||||||
"driving_way": item['driving_way'],
|
"driving_way": item['driving_way'],
|
||||||
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
"apply_machine_tool_type_ids": self.env['sf.machine_tool.type'].sudo()._get_ids(
|
||||||
item['apply_machine_tool_type_code']).id,
|
item['apply_machine_tool_type_code']),
|
||||||
"through_hole_size": item['through_hole_size'],
|
"through_hole_size": item['through_hole_size'],
|
||||||
"screw_size": item['screw_size'],
|
"screw_size": item['screw_size'],
|
||||||
"active": item['active'],
|
"active": item['active'],
|
||||||
|
|||||||
@@ -10,9 +10,10 @@
|
|||||||
""",
|
""",
|
||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sale', 'sale_management', 'web_widget_model_viewer'],
|
'depends': ['sale', 'sale_management', 'point_of_sale', 'web_widget_model_viewer'],
|
||||||
'data': [
|
'data': [
|
||||||
'views/sale_order_view.xml'
|
'views/sale_order_view.xml',
|
||||||
|
'views/quick_easy_order_view.xml',
|
||||||
],
|
],
|
||||||
'demo': [
|
'demo': [
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
from. import sale_order
|
from. import sale_order
|
||||||
|
from. import quick_easy_order
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
26
sf_sale/models/quick_easy_order.py
Normal file
26
sf_sale/models/quick_easy_order.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
from odoo import models, fields
|
||||||
|
import datetime
|
||||||
|
import base64
|
||||||
|
|
||||||
|
|
||||||
|
class QuickEasyOrder(models.Model):
|
||||||
|
_name = 'quick.easy.order'
|
||||||
|
_description = '简易下单'
|
||||||
|
|
||||||
|
name = fields.Char('订单编号', default=lambda self: self.env['ir.sequence'].next_by_code('quick.easy.order'))
|
||||||
|
machining_precision = fields.Selection([
|
||||||
|
('0.10', '±0.10mm'),
|
||||||
|
('0.05', '±0.05mm'),
|
||||||
|
('0.03', '±0.03mm'),
|
||||||
|
('0.02', '±0.02mm'),
|
||||||
|
('0.01', '±0.01mm')], string='加工精度')
|
||||||
|
material_id = fields.Many2one('sf.production.materials', '材料')
|
||||||
|
material_model_id = fields.Many2one('sf.materials.model', '型号')
|
||||||
|
process_id = fields.Many2one('sf.production.process', string='表面工艺')
|
||||||
|
parameter_ids = fields.One2many('sf.production.process.parameter', 'process_id', string='可选参数')
|
||||||
|
quantity = fields.Integer('数量')
|
||||||
|
price = fields.Float('总价')
|
||||||
|
model_file = fields.Binary('模型文件')
|
||||||
|
upload_model_file = fields.Many2many('ir.attachment', 'upload_qf_model_file_attachment_ref', string='上传模型文件')
|
||||||
|
delivery_time = fields.Date('交货日期')
|
||||||
|
customer_id = fields.Many2one('res.partner', string='客户', default=lambda self: self.env.user.partner_id.id)
|
||||||
88
sf_sale/views/quick_easy_order_view.xml
Normal file
88
sf_sale/views/quick_easy_order_view.xml
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<record id="sequence_quick_easy_order" model="ir.sequence">
|
||||||
|
<field name="name">快速订单编码规则</field>
|
||||||
|
<field name="code">quick.easy.order</field>
|
||||||
|
<field name="prefix">FP-%(year)s-%(month)s%(day)s-</field>
|
||||||
|
<field name="padding">4</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
# ---------- 快速订单 ------------
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="tree_quick_easy_order_view">
|
||||||
|
<field name="name">tree.quick.easy.order</field>
|
||||||
|
<field name="model">quick.easy.order</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="快速订单">
|
||||||
|
<field optional="show" name="name" string="订单号"/>
|
||||||
|
<field optional="show" name="customer_id" string="客户"/>
|
||||||
|
<field optional="show" name="material_id"/>
|
||||||
|
<field optional="show" name="material_model_id"/>
|
||||||
|
<field optional="show" name="process_id"/>
|
||||||
|
<field optional="show" name="quantity"/>
|
||||||
|
<field optional="show" name="price"/>
|
||||||
|
<field optional="hide" name="delivery_time"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="form_quick_easy_order_view">
|
||||||
|
<field name="name">form.quick.easy.order</field>
|
||||||
|
<field name="model">quick.easy.order</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="快速订单">
|
||||||
|
<sheet>
|
||||||
|
<label for="name"/>
|
||||||
|
<h1>
|
||||||
|
<field name="name" readonly="True"/>
|
||||||
|
</h1>
|
||||||
|
<group>
|
||||||
|
<group>
|
||||||
|
<field name="customer_id"/>
|
||||||
|
<field name="material_id"/>
|
||||||
|
<field name="material_model_id"/>
|
||||||
|
<field name="process_id"/>
|
||||||
|
<field name="parameter_ids"/>
|
||||||
|
<field name="machining_precision"/>
|
||||||
|
<field name="quantity"/>
|
||||||
|
<field name="price"/>
|
||||||
|
</group>
|
||||||
|
</group>
|
||||||
|
</sheet>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="search_quick_easy_order_view">
|
||||||
|
<field name="name">search.quick.easy.order</field>
|
||||||
|
<field name="model">quick.easy.order</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<search string="快速订单">
|
||||||
|
<field name="name" string="模糊搜索"
|
||||||
|
filter_domain="['|', ('name', 'ilike', self), '|', ('receive_name', 'ilike', self),'|', ('receive_phone', 'ilike', self),('customer_id', 'ilike', self)]"/>
|
||||||
|
<separator/>
|
||||||
|
<field name="customer_id"/>
|
||||||
|
</search>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="action_quick_easy_order">
|
||||||
|
<field name="name">快速订单</field>
|
||||||
|
<field name="res_model">quick.easy.order</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="domain">[]</field>
|
||||||
|
<field name="context">{}</field>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="o_view_nocontent_smiling_face">
|
||||||
|
[便捷订单] 还没有哦!点左上角的[创建]按钮,沙发归你了!
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem parent="sale.sale_order_menu" sequence="99" name="上传模型" id="menu_quick_easy_order"
|
||||||
|
action="action_quick_easy_order"/>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
Reference in New Issue
Block a user