← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/openerp-product-attributes/7.0-product_brand-migration into lp:openerp-product-attributes

 

Guewen Baconnier @ Camptocamp has proposed merging lp:~camptocamp/openerp-product-attributes/7.0-product_brand-migration into lp:openerp-product-attributes.

Commit message:
Migration of product_brand for version 7.0

Requested reviews:
  Product Core Editors (product-core-editors)

For more details, see:
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-product_brand-migration/+merge/211043

Migration of the module product brand.
-- 
https://code.launchpad.net/~camptocamp/openerp-product-attributes/7.0-product_brand-migration/+merge/211043
Your team Product Core Editors is requested to review the proposed merge of lp:~camptocamp/openerp-product-attributes/7.0-product_brand-migration into lp:openerp-product-attributes.
=== modified file 'product_brand/__init__.py' (properties changed: +x to -x)
--- product_brand/__init__.py	2012-03-27 12:50:22 +0000
+++ product_brand/__init__.py	2014-03-14 12:43:57 +0000
@@ -24,4 +24,4 @@
 ###################################################################################
 # Product Brand is an Openobject module wich enable Brand management for products #
 ###################################################################################
-import product_brand
+from . import product_brand

=== modified file 'product_brand/__openerp__.py'
--- product_brand/__openerp__.py	2013-02-05 09:50:07 +0000
+++ product_brand/__openerp__.py	2014-03-14 12:43:57 +0000
@@ -28,22 +28,26 @@
     'name': 'Product Brand Manager',
     'version': '0.1',
     'category': 'Product',
-    'description': """This module allows your user to easily manage product brand. You can define brand, attach it a logo and a description.
-    It also allows to attach a partner to a brand.
-    One installed check the menu Product/configuration/brand
-    To do / To come :
-        - A view to seeing products by brand.
+    'description': """
+Product Brand Manager
+=====================
+
+This module allows your user to easily manage product brands. You can
+define brand, attach it a logo and a description.  It also allows to
+attach a partner to a brand.  One installed check the menu
+Product/configuration/brand
+
+To do / To come:
+
+- A view to seeing products by brand.
+
     """,
     'author': 'NetAndCo',
     'website': 'http://ww.netandco.net',
     'depends': ['product'],
-    'init_xml': [],
-    'update_xml': [
+    'data': [
         'product_brand_view.xml',
         'security/ir.model.access.csv'
     ],
-    'demo_xml': [],
-    'installable': False,
-    'certificate': '',
+    'installable': True,
 }
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'product_brand/product_brand.py' (properties changed: +x to -x)
--- product_brand/product_brand.py	2012-08-21 14:10:21 +0000
+++ product_brand/product_brand.py	2014-03-14 12:43:57 +0000
@@ -21,23 +21,29 @@
 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.      #
 #                                                                               #
 #################################################################################
-from openerp.osv.orm import Model
-from openerp.osv import fields
-
-class product_brand(Model):
+from openerp.osv import orm, fields
+
+
+class product_brand(orm.Model):
     _name = 'product.brand'
     _columns = {
-        'name': fields.char('Brand Name',size=32),
-        'description': fields.text('Description',translate=True),
-        'partner_id' : fields.many2one('res.partner','partner', help='Select a partner for this brand if it exist'),
+        'name': fields.char('Brand Name'),
+        'description': fields.text('Description', translate=True),
+        'partner_id': fields.many2one(
+            'res.partner',
+            'partner',
+            help='Select a partner for this brand if it exists.',
+            ondelete='restrict'),
         'logo': fields.binary('Logo File')
     }
 
 
-class product_template(Model):
-    _name = 'product.template'
+class product_template(orm.Model):
     _inherit = 'product.template'
     _columns = {
-        'product_brand_id' : fields.many2one('product.brand','Brand', help='Select a brand for this product'),
+        'product_brand_id': fields.many2one(
+            'product.brand',
+            'Brand',
+            help='Select a brand for this product.',
+            ondelete='restrict')
     }
-

=== modified file 'product_brand/product_brand_view.xml' (properties changed: +x to -x)
--- product_brand/product_brand_view.xml	2012-03-27 12:50:22 +0000
+++ product_brand/product_brand_view.xml	2014-03-14 12:43:57 +0000
@@ -6,27 +6,48 @@
   Copyright (C) 2011 Akretion Benoît Guillot <benoit.guillot@xxxxxxxxxxxx>
   The licence is in the file __openerp__.py
 -->
-<openerp>  
+<openerp>
     <data>
+        <record id="product_brand_search_form_view" model="ir.ui.view">
+            <field name="name">product.brand.search.form</field>
+            <field name="model">product.brand</field>
+            <field name="arch" type="xml">
+                <search string="Product Brand">
+                   <field name="name"/>
+                   <field name="partner_id"/>
+                </search>
+            </field>
+        </record>
+
         <record model="ir.ui.view" id="view_product_brand_form">
             <field name="name">product.brand.form</field>
             <field name="model">product.brand</field>
-            <field name="type">form</field>
             <field name="arch" type="xml">
-                <form string="product.brand">
-                    <field name="name" select="1"/>
-                    <field name="logo" widget='image' />
-                    <field name="partner_id" select="1"/>
-                    <separator colspan="4" string="Description"/>
-                    <field colspan="4" name="description" nolabel="1"/>
+                <form string="Product Brand" version="7.0">
+                  <sheet>
+                      <field name="logo" widget="image" class="oe_avatar oe_left"/>
+                      <div class="oe_title">
+                        <div class="oe_edit_only">
+                          <label for="name" string="Brand Name"/>
+                        </div>
+                        <h1>
+                          <field name="name"/>
+                        </h1>
+                      </div>
+                      <group>
+                        <field name="partner_id"/>
+                      </group>
+                      <group string="Description">
+                        <field name="description" nolabel="1"/>
+                      </group>
+                  </sheet>
                 </form>
             </field>
         </record>
-        
+
         <record model="ir.ui.view" id="view_product_brand_tree">
             <field name="name">product.brand.tree</field>
             <field name="model">product.brand</field>
-            <field name="type">tree</field>
             <field name="arch" type="xml">
                 <tree string="product.brand">
                     <field name="name"/>
@@ -35,38 +56,51 @@
                 </tree>
             </field>
         </record>
-        
+
+        <record id="product_search_form_view" model="ir.ui.view">
+            <field name="name">product.search.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="product.product_search_form_view"/>
+            <field name="arch" type="xml">
+                <field name="categ_id" position="after">
+                    <field name="product_brand_id"/>
+                </field>
+                <group string='Group by...' position="inside">
+                    <filter string="Brand" name="groupby_brand" domain="[]" context="{'group_by' : 'product_brand_id'}"/>
+                </group>
+            </field>
+        </record>
+
         <record model="ir.ui.view" id="normal_form_product_brand">
            <field name="name">product.normal.form</field>
            <field name="model">product.product</field>
-           <field name="type">form</field>
            <field name="inherit_id" ref="product.product_normal_form_view" />
            <field name="arch" type="xml">
-                <field name="categ_id" position="after"  >
-                    <field name="product_brand_id" select="1" />
-               </field>
+                <div name="options" position="before">
+                    <label for="product_brand_id" class="oe_edit_only"/>
+                    <h2><field name="product_brand_id"/></h2>
+               </div>
            </field>
         </record>
-        
+
         <record model="ir.ui.view" id="product_template_form_brand_add">
             <field name="name">product.template.product.form</field>
             <field name="model">product.template</field>
-            <field name="type">form</field>
             <field name="inherit_id" ref="product.product_template_form_view" />
             <field name="arch" type="xml">
                 <field name="categ_id" position="after"  >
-                  <field name="product_brand_id" select="1" />
+                  <field name="product_brand_id" />
                 </field>
               </field>
         </record>
-        
+
         <record model="ir.actions.act_window" id="action_product_brand">
             <field name="name">Brand</field>
             <field name="res_model">product.brand</field>
             <field name="view_type">form</field>
             <field name="view_mode">tree,form</field>
         </record>
-        
+
         <menuitem name="Brand management" id="menu_product_brand" action="action_product_brand" parent="product.prod_config_main"/>
     </data>
 </openerp>