Commit 4890b850 authored by rex wu's avatar rex wu
Browse files

Merge branch '15.0' into 'deploy'

15.0

See merge request !25
2 merge requests!39feat(deploy): remove all files that are not needed in the deployment stage and...,!2515.0
Showing with 69 additions and 24 deletions
+69 -24
......@@ -7,31 +7,32 @@ class Product(models.Model):
_inherit = "product.product"
product_type = fields.Selection([
('project', 'Project'),
('component', 'Component')], default='component')
('project', '專案'),
('component', '物料')], default='component', string='產品類型')
component_type = fields.Selection([
('none', 'None'),
('product', 'Product'),
('processed', 'Processed Part'),
('3d', '3D Printing'),
('consumable', 'Consumable'),
('cb', 'Control Box'),
('ec', 'Electric Component')], default=lambda self: 'product' if self.product_type == 'component' else 'none')
('none', '未選擇'),
('product', '成品'),
('processed', '加工件'),
('3d', '3D 列印件'),
('consumable', '消耗品'),
('cb', '電控箱'),
('ec', '電子材料')], default=lambda self: 'product' if self.product_type == 'component' else 'none', string='物料類型')
class ProductTemplate(models.Model):
_inherit = "product.template"
product_type = fields.Selection([
('project', 'Project'),
('component', 'Component')], default='component')
('project', '專案'),
('component', '物料')], default='component', string='產品類型')
component_type = fields.Selection([
('none', 'None'),
('product', 'Product'),
('processed', 'Processed Part'),
('3d', '3D Printing'),
('consumable', 'Consumable'),
('cb', 'Control Box'),
('ec', 'Electric Component')], default=lambda self: 'product' if self.product_type == 'component' else 'none')
('none', '未選擇'),
('product', '成品'),
('processed', '加工件'),
('3d', '3D 列印件'),
('consumable', '消耗品'),
('cb', '電控箱'),
('ec', '電子材料')], default=lambda self: 'product' if self.product_type == 'component' else 'none',
string='物料類型')
......@@ -6,7 +6,7 @@
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='detailed_type']" position="before">
<field name="product_type"/>
<field name="product_type" readonly="1"/>
<field name="component_type"/>
</xpath>
</field>
......
......@@ -23,11 +23,52 @@
<field name="groups_id" eval="[(6,0,[ref('make_invisible')])]"/>
</record>
<menuitem action="mrp.product_template_action"
id="root_menu_mrp_product_form"
name="產品"
parent="mrp.menu_mrp_root"
sequence="13"/>
<record id="project_template_action" model="ir.actions.act_window">
<field name="name">專案</field>
<field name="res_model">product.template</field>
<field name="search_view_id" ref="mrp.mrp_product_template_search_view"/>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_consumable": 1, 'default_detailed_type': 'product'}</field>
<field name="domain">[('product_type', '=', 'project')]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No product found. Let's create one!
</p><p>
Define the components and finished products you wish to use in
bill of materials and manufacturing orders.
</p>
</field>
</record>
<menuitem action="project_template_action"
id="root_menu_mrp_project_form"
name="專案"
parent="mrp.menu_mrp_bom"
sequence="1"/>
<record id="component_template_action" model="ir.actions.act_window">
<field name="name">物料</field>
<field name="res_model">product.template</field>
<field name="search_view_id" ref="mrp.mrp_product_template_search_view"/>
<field name="view_mode">kanban,tree,form</field>
<field name="context">{"search_default_consumable": 1, 'default_detailed_type': 'product'}</field>
<field name="domain">[('product_type', '=', 'component')]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
No product found. Let's create one!
</p><p>
Define the components and finished products you wish to use in
bill of materials and manufacturing orders.
</p>
</field>
</record>
<menuitem action="component_template_action"
id="root_menu_mrp_component_form"
name="物料"
parent="mrp.menu_mrp_bom"
sequence="2"/>
<!-- <menuitem id="root_menu_mrp_bom_form_action"-->
<!-- action="mrp.mrp_bom_form_action"-->
......
......@@ -23,6 +23,9 @@ class InternalPurchaseOrder(models.Model):
This function create a bom-1 for estimate a case.
'''
product = self.env['product.product'].create({'name': self.inquiry_id['name'], 'product_type': 'project'})
product.product_tmpl_id.update({
'product_type': 'project',
})
if self.inquiry_id['type'] == 'project':
bom = self.env['mrp.bom'].create({
'product_tmpl_id': product.product_tmpl_id.id,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment