add product color

This commit is contained in:
ivan deng
2019-01-04 20:07:39 +08:00
parent e617e814e6
commit 9716c0358e
18 changed files with 230 additions and 21 deletions

View File

@@ -0,0 +1 @@
#

View File

@@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
# Created on 2019-01-04
# author: 广州尚鹏http://www.sunpop.cn
# email: 300883@qq.com
# resource of Sunpop
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
# Odoo12在线用户手册长期更新
# http://www.sunpop.cn/documentation/user/12.0/en/index.html
# Odoo12在线开发者手册长期更新
# http://www.sunpop.cn/documentation/12.0/index.html
# Odoo10在线中文用户手册长期更新
# http://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
# Odoo10离线中文用户手册下载
# http://www.sunpop.cn/odoo10_user_manual_document_offline/
# Odoo10离线开发手册下载-含python教程jquery参考Jinja2模板PostgresSQL参考odoo开发必备
# http://www.sunpop.cn/odoo10_developer_document_offline/
# Odoo, Open Source Web Widget Color
# Copyright (C) 2012 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
# Copyright (C) 2014 Anybox <http://anybox.fr>
# Copyright (C) 2015 Taktik SA <http://taktik.be>
# Copyright (C) 2018 Alexandre Díaz <dev@redneboa.es>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).#
{
'name': "App Product Attribute Color",
'category': "Sales",
'version': "12.19.1.04",
"author": "Sunpop.cn",
'price': 0.00,
'currency': 'EUR',
'summary': """
Use for quick select color. can be use in product attribute and other color variant. color widget. color pick.
""",
'depends': [
'app_web_widget_color',
'sale',
],
'data': [
'view/product_attribute_views.xml'
],
'qweb': [
'static/src/xml/widget.xml',
],
'license': 'AGPL-3',
'auto_install': True,
'installable': True,
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -0,0 +1,85 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">App Product Attribute Color</h2>
<h3>Quick Color picker for product variant</h3>
<div class="oe_row">
<div class="oe_span12">
<img class="oe_demo oe_picture oe_screenshot" src="banner.png">
</div>
<div class="oe_span12 oe_spaced">
<div class="alert alert-info" style="padding:8px;font-weight: 300; font-size: 20px;">
<i class="fa fa-hand-o-right"></i><b> Key features: </b>
<ul class="list-unstyled">
<li>
<i class="fa fa-check-square-o text-primary"></i>
Lastest update: v12.19.1.4
</li>
<li>
<i class="fa fa-check-square-o text-primary"></i>
Easy to set color for product.
</li>
</ul>
</div>
</div>
<div class="oe_span12 mt32">
<h3>Use in product color setup</h3>
<img class="oe_demo oe_picture oe_screenshot" src="demo1.jpg">
</div>
<div class="oe_span12 mt32">
<img class="oe_demo oe_picture oe_screenshot" src="demo2.jpg">
</div>
<div class="oe_span12 mt32">
<h3>In Form View</h3>
<img class="oe_demo oe_picture oe_screenshot" src="form_view.png">
</div>
<div class="oe_span12 mt32">
<h3>In List View</h3>
<img class="oe_demo oe_picture oe_screenshot" src="list_view.png">
</div>
<div class="oe_span12 mt32">
<h3>Picker View</h3>
<img class="oe_demo oe_picture oe_screenshot" src="picker.png">
</div>
</div>
</div>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced text-center">
<div class="oe_span12">
<h2 class="oe_slogan">Technical Help & Support</h2>
</div>
<div class="col-md-12 pad0">
<div class="oe_mt16">
<p><h4>
For any type of technical help & support requests, Feel free to contact us</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:guohuadeng@hotmail.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> guohuadeng@hotmail.com</a>
<p><h4>
Via QQ: 300883</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="mailto:300883@qq.com"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-envelope"></i> 300883@qq.com</a>
</div>
<div class="oe_mt16">
<p><h4>
Visit our website for more support.</h4></p>
<a style="background: #002e5a none repeat scroll 0% 0%; color: rgb(255, 255, 255);position: relative; overflow: hidden;"
class="btn btn-warning btn-lg" rel="nofollow" href="http://www.sunpop.cn" target="_blank"><span
style="height: 354px; width: 354px; top: -147.433px; left: -6.93335px;" class="o_ripple"></span>
<i class="fa fa-web"></i>http://www.sunpop.cn</a>
</div>
</div>
</div>
<div class="oe_row oe_spaced text-center">
<h1>More Powerful addons, Make your odoo very easy to use, easy customize:
<a class="btn btn-primary mb16" href="http://www.odoo.com/apps/modules/browse?author=Sunpop.cn">Supop.cn Odoo Addons</a>
</h1>
</div>
</section>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -0,0 +1,61 @@
<odoo>
<data>
<!-- Product -->
<record id="app_product_attribute_view_form" model="ir.ui.view">
<field name="name">app.product.attribute.form.inherit</field>
<field name="model">product.attribute</field>
<field name="inherit_id" ref="sale.product_attribute_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='html_color']" position="attributes">
<attribute name="widget">color</attribute>
</xpath>
</field>
</record>
<record id="app_product_template_attribute_line_form" model="ir.ui.view">
<field name="name">app.product.template.attribute.line.form.inherit</field>
<field name="model">product.template.attribute.line</field>
<field name="inherit_id" ref="sale.product_template_attribute_line_form"/>
<field name="priority" eval="8"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='html_color']" position="attributes">
<attribute name="widget">color</attribute>
</xpath>
</field>
</record>
<record id="app_product_template_attribute_value_view_tree_inherit" model="ir.ui.view">
<field name="name">app.product.template.attribute.value.view.tree.inherit</field>
<field name="model">product.template.attribute.value</field>
<field name="inherit_id" ref="sale.product_template_attribute_value_view_tree_inherit"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='html_color']" position="attributes">
<attribute name="widget">color</attribute>
</xpath>
</field>
</record>
<record id="app_product_template_attribute_value_view_form_inherit" model="ir.ui.view">
<field name="name">app.product.template.attribute.value.view.form.inherit</field>
<field name="model">product.template.attribute.value</field>
<field name="inherit_id" ref="sale.product_template_attribute_value_view_form_inherit"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='html_color']" position="attributes">
<attribute name="widget">color</attribute>
</xpath>
</field>
</record>
<record id="app_variants_tree_view" model="ir.ui.view">
<field name="name">app.variants.template.tree</field>
<field name="model">product.attribute.value</field>
<field name="inherit_id" ref="sale.variants_tree_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='html_color']" position="attributes">
<attribute name="widget">color</attribute>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -21,7 +21,10 @@ class SaleOrderLine(models.Model):
weight = 0 weight = 0
weight_subtotal = 0 weight_subtotal = 0
if line.product_id and line.product_id.weight: if line.product_id and line.product_id.weight:
weight = line.product_id.weight / line.product_uom.factor try:
weight = line.product_id.weight / line.product_uom.factor
except:
weight = line.product_id.weight
weight_subtotal += (weight * line.product_uom_qty) weight_subtotal += (weight * line.product_uom_qty)
line.weight = weight line.weight = weight
line.weight_subtotal = weight_subtotal line.weight_subtotal = weight_subtotal

View File

@@ -24,7 +24,7 @@
'license': 'LGPL-3', 'license': 'LGPL-3',
'sequence': 2, 'sequence': 2,
'summary': """ 'summary': """
Use for parent children tree list select navigator. stock location tree. Use for parent children tree list select navigator. stock location tree, filter by parent location.
ztree widget. ztree widget.
""", """,
'description': """ 'description': """
@@ -40,7 +40,7 @@
], ],
'images': ['static/description/banner.gif'], 'images': ['static/description/banner.gif'],
'data': [ 'data': [
'views/stock_views.xml', 'views/stock_location_views.xml',
], ],
'demo': [ 'demo': [
], ],

View File

@@ -0,0 +1,24 @@
<odoo>
<data>
<!-- stock -->
<record id="view_location_search_superbar" model="ir.ui.view">
<field name="name">stock.location.search.superbar</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_search"/>
<field name="arch" type="xml">
<xpath expr="//search">
<superbar view_mode="kanban,tree">
<field name="location_id"
widget="ztree_search"
model="stock.location"
domain="[]"
parent_key="location_id"
level="1"
/>
<field name="usage"/>
</superbar>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -1,18 +0,0 @@
<odoo>
<data>
<!-- stock -->
<record id="app_view_location_form" model="ir.ui.view">
<field name="name">app.stock.location.form</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='location_id']" position="attributes">
<!-- Add your fields or attributes here -->
<attribute name="widget">ztree_select</attribute>
<attribute name="ztree_parent_key">location_id</attribute>
</xpath>
</field>
</record>
</data>
</odoo>