-
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP]product_brand: Several improvements
* add smart button, move menu to a more visible position. * show brand in product.template kanban and tree views. * show brand in product variant kanban and tree views. * add product_brand kanban view. * update module's README and manifest file. * Search and group by brand for both product.product and product.template. * Convert model to new APIs. * Refactor products_count computation using product_ids one2many field. * Add public read access to product.brand (fixes 403 error on webshop for public user). * Make brand name required.
- Loading branch information
1 parent
76dcd9e
commit a9e6a44
Showing
6 changed files
with
252 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
Product Brand Manage [product_brand] | ||
=========== | ||
Product Brand Manager [product_brand] | ||
===================================== | ||
|
||
This module allows odoo users to easily manage product brands. You can | ||
define brands, attach a logo and a description to them. | ||
|
@@ -35,20 +35,30 @@ For further information, please visit: | |
Known issues / Roadmap | ||
====================== | ||
|
||
* A view to list or sort products by brand | ||
* add a field with brands assiciated to a Customer or Supplier on | ||
the Customers/Suppliers Form View | ||
|
||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/issues>`_. | ||
In case of trouble, please check there if your issue has already been reported. | ||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback | ||
`here <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_brand%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
Mathieu Lemercier <[email protected]> | ||
Franck Bret <[email protected]> | ||
Seraphine Lantible <[email protected]> | ||
Gunnar Wagner <[email protected]> | ||
* Mathieu Lemercier <[email protected]> | ||
* Franck Bret <[email protected]> | ||
* Seraphine Lantible <[email protected]> | ||
* Gunnar Wagner <[email protected]> | ||
* Leonardo Donelli <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,71 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################### | ||
# # # | ||
# product_brand for Odoo # # | ||
# Copyright (C) 2009 NetAndCo (<http://www.netandco.net>). # # | ||
# Copyright (C) 2011 Akretion Benoît Guillot <[email protected]> # # | ||
# Copyright (C) 2014 prisnet.ch Seraphine Lantible <[email protected]> # # | ||
# # | ||
# product_brand for Odoo # | ||
# Copyright (C) 2009 NetAndCo (<http://www.netandco.net>). # | ||
# Copyright (C) 2011 Akretion Benoît Guillot <[email protected]> # | ||
# Copyright (C) 2014 prisnet.ch Seraphine Lantible <[email protected]> # | ||
# Copyright (C) 2015 Leonardo Donelli # | ||
# Contributors # | ||
# Mathieu Lemercier, [email protected], # # | ||
# Franck Bret, [email protected] # # | ||
# Mathieu Lemercier, [email protected] # | ||
# Franck Bret, [email protected] # | ||
# Seraphine Lantible, [email protected], http://www.prisnet.ch # | ||
# # # | ||
# This program is free software: you can redistribute it and/or modify # # | ||
# it under the terms of the GNU Affero General Public License as # # | ||
# published by the Free Software Foundation, either version 3 of the # # | ||
# License, or (at your option) any later version. # # | ||
# # # | ||
# This program is distributed in the hope that it will be useful, # # | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of # # | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # | ||
# GNU Affero General Public License for more details. # # | ||
# # # | ||
# You should have received a copy of the GNU Affero General Public License # # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # # | ||
# # # | ||
# Leonardo Donelli, [email protected], http://www.wearemonk.com # | ||
# # | ||
# This program is free software: you can redistribute it and/or modify # | ||
# it under the terms of the GNU Affero General Public License as # | ||
# published by the Free Software Foundation, either version 3 of the # | ||
# License, or (at your option) any later version. # | ||
# # | ||
# This program is distributed in the hope that it will be useful, # | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of # | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | ||
# GNU Affero General Public License for more details. # | ||
# # | ||
# You should have received a copy of the GNU Affero General Public License # | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. # | ||
# # | ||
############################################################################### | ||
############################################################################### | ||
# Product Brand is an Openobject module wich enable Brand management for # | ||
# products # | ||
############################################################################### | ||
from openerp.osv import orm, fields | ||
from openerp import models, fields, api | ||
|
||
|
||
class product_brand(orm.Model): | ||
class ProductBrand(models.Model): | ||
_name = 'product.brand' | ||
_columns = { | ||
'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'), | ||
} | ||
|
||
name = fields.Char('Brand Name', required=True) | ||
description = fields.Text('Description', translate=True) | ||
partner_id = fields.Many2one( | ||
'res.partner', | ||
string='Partner', | ||
help='Select a partner for this brand if it exists', | ||
ondelete='restrict' | ||
) | ||
logo = fields.Binary('Logo File') | ||
product_ids = fields.One2many( | ||
'product.template', | ||
'product_brand_id', | ||
string='Brand Products', | ||
) | ||
products_count = fields.Integer( | ||
string='Number of products', | ||
compute='_get_products_count', | ||
) | ||
|
||
class product_template(orm.Model): | ||
@api.one | ||
@api.depends('product_ids') | ||
def _get_products_count(self): | ||
self.products_count = len(self.product_ids) | ||
|
||
|
||
class ProductTemplate(models.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', | ||
string='Brand', | ||
help='Select a brand for this product' | ||
) |
Oops, something went wrong.