mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
add brand
This commit is contained in:
120
app_product_brand/README.rst
Normal file
120
app_product_brand/README.rst
Normal file
@@ -0,0 +1,120 @@
|
||||
=====================
|
||||
Product Brand Manager
|
||||
=====================
|
||||
|
||||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
|
||||
:target: https://odoo-community.org/page/development-status
|
||||
:alt: Mature
|
||||
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github
|
||||
:target: https://github.com/OCA/product-attribute/tree/12.0/product_brand
|
||||
:alt: OCA/product-attribute
|
||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
||||
:target: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_brand
|
||||
:alt: Translate me on Weblate
|
||||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
|
||||
:target: https://runbot.odoo-community.org/runbot/135/12.0
|
||||
:alt: Try me on Runbot
|
||||
|
||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||
|
||||
This module allows odoo users to easily manage product brands.
|
||||
|
||||
**Table of contents**
|
||||
|
||||
.. contents::
|
||||
:local:
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To create a new brand:
|
||||
|
||||
#. Go to *Sales > Configuration > Products > Product Brands*.
|
||||
#. You can set its logo, associate a partner and add a description.
|
||||
|
||||
To add a product to a brand:
|
||||
|
||||
#. Go to the product itself and edit.
|
||||
#. Below the product's name there is a Brand field where you can pick the one
|
||||
the product belongs to.
|
||||
|
||||
To see the sales report based on brand dimension:
|
||||
|
||||
#. Go to *Sales > Reporting > Sales*.
|
||||
#. There you can *Group by* brand or add it as a dimension in the pivot view.
|
||||
|
||||
To see the invoice report based on brand dimension:
|
||||
|
||||
#. Go to *Invoicing > Reporting > Management > Invoices*.
|
||||
#. There you can *Group by* brand or add it as a dimension in the pivot view.
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* Add a field with brands associated to a Customer or Supplier on
|
||||
the Customers/Suppliers Form View.
|
||||
* Fix smart button alignment in brand 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 <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_brand%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Do not contact contributors directly about support or help with technical issues.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Authors
|
||||
~~~~~~~
|
||||
|
||||
* NetAndCo
|
||||
* Akretion
|
||||
* Prisnet Telecommunications SA
|
||||
* MONK Software
|
||||
* SerpentCS Pvt. Ltd.
|
||||
* Tecnativa
|
||||
|
||||
Contributors
|
||||
~~~~~~~~~~~~
|
||||
|
||||
* Mathieu Lemercier <mathieu@netandco.net>
|
||||
* Franck Bret <franck@netandco.net>
|
||||
* Seraphine Lantible <s.lantible@gmail.com>
|
||||
* Gunnar Wagner <vrms@netcologne.de>
|
||||
* Leonardo Donelli <donelli@webmonks.it>
|
||||
* Serpent Consulting Services Pvt. Ltd. <jay.vora@serpentcs.com>
|
||||
* Marcelo Pickler <loxamir@gmail.com>
|
||||
* Andrius Laukavičius <ala@boolit.eu> (Boolit)
|
||||
* Daniel Campos <danielcampos@avanzosc.es>
|
||||
* `Tecnativa <https://www.tecnativa.com>`_
|
||||
|
||||
* David Vidal <david.vidal@tecnativa.com>
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.
|
||||
|
||||
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/12.0/product_brand>`_ project on GitHub.
|
||||
|
||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||
2
app_product_brand/__init__.py
Normal file
2
app_product_brand/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import models
|
||||
# from . import reports
|
||||
95
app_product_brand/__manifest__.py
Normal file
95
app_product_brand/__manifest__.py
Normal file
@@ -0,0 +1,95 @@
|
||||
# Copyright 2009 NetAndCo (<http://www.netandco.net>).
|
||||
# Copyright 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>
|
||||
# Copyright 2014 prisnet.ch Seraphine Lantible <s.lantible@gmail.com>
|
||||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# Copyright 2018 Daniel Campos <danielcampos@avanzosc.es>
|
||||
# Copyright 2018 Tecnativa - David Vidal
|
||||
# Copyright 2019 Giovanni - GSLabIt
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Created on 2019-11-12
|
||||
# author: 广州尚鹏,https://www.sunpop.cn
|
||||
# email: 300883@qq.com
|
||||
# resource of Sunpop
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
# Odoo12在线用户手册(长期更新)
|
||||
# https://www.sunpop.cn/documentation/user/12.0/zh_CN/index.html
|
||||
|
||||
# Odoo12在线开发者手册(长期更新)
|
||||
# https://www.sunpop.cn/documentation/12.0/index.html
|
||||
|
||||
# Odoo10在线中文用户手册(长期更新)
|
||||
# https://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
|
||||
|
||||
# Odoo10离线中文用户手册下载
|
||||
# https://www.sunpop.cn/odoo10_user_manual_document_offline/
|
||||
# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备)
|
||||
# https://www.sunpop.cn/odoo10_developer_document_offline/
|
||||
|
||||
##############################################################################
|
||||
# Copyright (C) 2009-TODAY Sunpop.cn Ltd. https://www.sunpop.cn
|
||||
# Author: Ivan Deng,300883@qq.com
|
||||
# You can modify it under the terms of the GNU LESSER
|
||||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
|
||||
# See <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# It is forbidden to publish, distribute, sublicense, or sell copies
|
||||
# of the Software or modified copies of the Software.
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
'name': 'Product Brand Manager',
|
||||
'version': '13.19.12.12',
|
||||
'author': 'Sunpop.cn',
|
||||
'category': 'Product',
|
||||
'website': 'https://www.sunpop.cn',
|
||||
'license': 'LGPL-3',
|
||||
'sequence': 2,
|
||||
'price': 0.00,
|
||||
'currency': 'EUR',
|
||||
'images': ['static/description/banner.png'],
|
||||
'depends': [
|
||||
'sale',
|
||||
],
|
||||
'summary': """
|
||||
Odoo App of Sunpop.cn
|
||||
""",
|
||||
'description': """
|
||||
Support Odoo 13,12, 11, Enterprise and Community Edition
|
||||
1.
|
||||
2.
|
||||
3. Multi-language Support.
|
||||
4. Multi-Company Support.
|
||||
5. Support Odoo 13,12, 11, Enterprise and Community Edition
|
||||
==========
|
||||
1.
|
||||
2.
|
||||
3. 多语言支持
|
||||
4. 多公司支持
|
||||
5. Odoo 13, 12, 11, 企业版,社区版,多版本支持
|
||||
""",
|
||||
'depends': [
|
||||
'sale',
|
||||
],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/product_brand_views.xml',
|
||||
'views/product_template_views.xml',
|
||||
'views/product_product_views.xml',
|
||||
# todo: update report
|
||||
# 'reports/sale_report_view.xml',
|
||||
# 'reports/account_invoice_report_view.xml',
|
||||
],
|
||||
'qweb': [
|
||||
'static/src/xml/*.xml',
|
||||
],
|
||||
'demo': [],
|
||||
# 'pre_init_hook': 'pre_init_hook',
|
||||
# 'post_init_hook': 'post_init_hook',
|
||||
# 'uninstall_hook': 'uninstall_hook',
|
||||
'installable': True,
|
||||
'application': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
32
app_product_brand/hooks.py
Normal file
32
app_product_brand/hooks.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Created on 2018-10-12
|
||||
# author: 广州尚鹏,https://www.sunpop.cn
|
||||
# email: 300883@qq.com
|
||||
# resource of Sunpop
|
||||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
|
||||
|
||||
# Odoo在线中文用户手册(长期更新)
|
||||
# https://www.sunpop.cn/documentation/user/10.0/zh_CN/index.html
|
||||
|
||||
# Odoo10离线中文用户手册下载
|
||||
# https://www.sunpop.cn/odoo10_user_manual_document_offline/
|
||||
# Odoo10离线开发手册下载-含python教程,jquery参考,Jinja2模板,PostgresSQL参考(odoo开发必备)
|
||||
# https://www.sunpop.cn/odoo10_developer_document_offline/
|
||||
# description:
|
||||
|
||||
from odoo import api, SUPERUSER_ID, _
|
||||
|
||||
|
||||
def pre_init_hook(cr):
|
||||
pass
|
||||
# cr.execute("")
|
||||
|
||||
def post_init_hook(cr, registry):
|
||||
pass
|
||||
# cr.execute("")
|
||||
|
||||
def uninstall_hook(cr, registry):
|
||||
pass
|
||||
# cr.execute("")
|
||||
|
||||
147
app_product_brand/i18n/zh_CN.po
Normal file
147
app_product_brand/i18n/zh_CN.po
Normal file
@@ -0,0 +1,147 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * app_product_brand
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 13.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2019-12-11 17:04+0000\n"
|
||||
"PO-Revision-Date: 2019-12-11 17:04+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.actions.act_window,name:app_product_brand.action_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_product__product_brand_id
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_template__product_brand_id
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.product_template_form_brand_add
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_template_search_brand
|
||||
msgid "Brand"
|
||||
msgstr "品牌"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__name
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_brand_form
|
||||
msgid "Brand Name"
|
||||
msgstr "品牌名称"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.actions.act_window,name:app_product_brand.action_open_brand_products
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__product_ids
|
||||
msgid "Brand Products"
|
||||
msgstr "品牌产品"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__create_uid
|
||||
msgid "Created by"
|
||||
msgstr "创建者"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__create_date
|
||||
msgid "Created on"
|
||||
msgstr "创建时间"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__description
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_brand_form
|
||||
msgid "Description"
|
||||
msgstr "说明"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,help:app_product_brand.field_product_brand__sequence
|
||||
msgid "Determine the display order"
|
||||
msgstr "决定显示顺序"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "显示名称"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand____last_update
|
||||
msgid "Last Modified on"
|
||||
msgstr "最后更改日"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__write_uid
|
||||
msgid "Last Updated by"
|
||||
msgstr "最后更新者"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__write_date
|
||||
msgid "Last Updated on"
|
||||
msgstr "更新时间"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_brand_kanban
|
||||
msgid "Logo"
|
||||
msgstr ""
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__logo
|
||||
msgid "Logo File"
|
||||
msgstr "Logo文件"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__products_count
|
||||
msgid "Number of products"
|
||||
msgstr "产品数量"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__partner_id
|
||||
msgid "Partner"
|
||||
msgstr "业务伙伴"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.actions.act_window,name:app_product_brand.action_open_single_product_brand
|
||||
#: model:ir.model,name:app_product_brand.model_product_brand
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.product_brand_search_form_view
|
||||
msgid "Product Brand"
|
||||
msgstr "产品品牌"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.ui.menu,name:app_product_brand.menu_product_brand
|
||||
msgid "Product Brands"
|
||||
msgstr "产品品牌"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model,name:app_product_brand.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "产品模板"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_brand_form
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_brand_kanban
|
||||
msgid "Products"
|
||||
msgstr "产品"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,help:app_product_brand.field_product_product__product_brand_id
|
||||
#: model:ir.model.fields,help:app_product_brand.field_product_template__product_brand_id
|
||||
msgid "Select a brand for this product"
|
||||
msgstr "为产品选择一个品牌"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,help:app_product_brand.field_product_brand__partner_id
|
||||
msgid "Select a partner for this brand if any."
|
||||
msgstr "为品牌选择一个供应商"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__sequence
|
||||
msgid "Sequence"
|
||||
msgstr "单号规则"
|
||||
|
||||
#. module: app_product_brand
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_brand.view_product_brand_tree
|
||||
msgid "product.brand"
|
||||
msgstr "产品.品牌"
|
||||
14
app_product_brand/migrations/12.0.2.0.0/post-migration.py
Normal file
14
app_product_brand/migrations/12.0.2.0.0/post-migration.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
from openupgradelib import openupgrade_90
|
||||
|
||||
|
||||
@openupgrade.migrate(use_env=True)
|
||||
def migrate(env, version):
|
||||
column = openupgrade.get_legacy_name('logo')
|
||||
if openupgrade.column_exists(env.cr, 'product_brand', column):
|
||||
openupgrade_90.convert_binary_field_to_attachment(
|
||||
env, {'product.brand': [('logo', None)]},
|
||||
)
|
||||
16
app_product_brand/migrations/12.0.2.0.0/pre-migration.py
Normal file
16
app_product_brand/migrations/12.0.2.0.0/pre-migration.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright 2019 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
column_renames = {
|
||||
'product_brand': [
|
||||
('logo', None),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@openupgrade.migrate()
|
||||
def migrate(env, version):
|
||||
if openupgrade.column_exists(env.cr, 'product_brand', 'logo'):
|
||||
openupgrade.rename_columns(env.cr, column_renames)
|
||||
1
app_product_brand/models/__init__.py
Normal file
1
app_product_brand/models/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import product_brand
|
||||
50
app_product_brand/models/product_brand.py
Normal file
50
app_product_brand/models/product_brand.py
Normal file
@@ -0,0 +1,50 @@
|
||||
# Copyright 2009 NetAndCo (<http://www.netandco.net>).
|
||||
# Copyright 2011 Akretion Benoît Guillot <benoit.guillot@akretion.com>
|
||||
# Copyright 2014 prisnet.ch Seraphine Lantible <s.lantible@gmail.com>
|
||||
# Copyright 2016 Serpent Consulting Services Pvt. Ltd.
|
||||
# Copyright 2018 Daniel Campos <danielcampos@avanzosc.es>
|
||||
# Copyright 2019 Sunpop.cn <guohuadeng@hotmail.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from odoo import api, fields, models, _
|
||||
|
||||
|
||||
class ProductBrand(models.Model):
|
||||
_name = 'product.brand'
|
||||
_description = "Product Brand"
|
||||
_order = 'sequence, name'
|
||||
|
||||
name = fields.Char('Brand Name', required=True)
|
||||
description = fields.Text(translate=True)
|
||||
partner_id = fields.Many2one(
|
||||
'res.partner',
|
||||
string='Partner',
|
||||
help='Select a partner for this brand if any.',
|
||||
ondelete='restrict'
|
||||
)
|
||||
logo = fields.Binary('Logo File', attachment=True)
|
||||
product_ids = fields.One2many(
|
||||
'product.template',
|
||||
'product_brand_id',
|
||||
string='Brand Products',
|
||||
)
|
||||
products_count = fields.Integer(
|
||||
string='Number of products',
|
||||
compute='_compute_products_count',
|
||||
)
|
||||
sequence = fields.Integer('Sequence', help="Determine the display order")
|
||||
|
||||
@api.depends('product_ids')
|
||||
def _compute_products_count(self):
|
||||
for brand in self:
|
||||
brand.products_count = len(brand.product_ids)
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
product_brand_id = fields.Many2one(
|
||||
'product.brand',
|
||||
string='Brand',
|
||||
help='Select a brand for this product'
|
||||
)
|
||||
12
app_product_brand/readme/CONTRIBUTORS.rst
Normal file
12
app_product_brand/readme/CONTRIBUTORS.rst
Normal file
@@ -0,0 +1,12 @@
|
||||
* Mathieu Lemercier <mathieu@netandco.net>
|
||||
* Franck Bret <franck@netandco.net>
|
||||
* Seraphine Lantible <s.lantible@gmail.com>
|
||||
* Gunnar Wagner <vrms@netcologne.de>
|
||||
* Leonardo Donelli <donelli@webmonks.it>
|
||||
* Serpent Consulting Services Pvt. Ltd. <jay.vora@serpentcs.com>
|
||||
* Marcelo Pickler <loxamir@gmail.com>
|
||||
* Andrius Laukavičius <ala@boolit.eu> (Boolit)
|
||||
* Daniel Campos <danielcampos@avanzosc.es>
|
||||
* `Tecnativa <https://www.tecnativa.com>`_
|
||||
|
||||
* David Vidal <david.vidal@tecnativa.com>
|
||||
1
app_product_brand/readme/DESCRIPTION.rst
Normal file
1
app_product_brand/readme/DESCRIPTION.rst
Normal file
@@ -0,0 +1 @@
|
||||
This module allows odoo users to easily manage product brands.
|
||||
3
app_product_brand/readme/ROADMAP.rst
Normal file
3
app_product_brand/readme/ROADMAP.rst
Normal file
@@ -0,0 +1,3 @@
|
||||
* Add a field with brands associated to a Customer or Supplier on
|
||||
the Customers/Suppliers Form View.
|
||||
* Fix smart button alignment in brand form view
|
||||
20
app_product_brand/readme/USAGE.rst
Normal file
20
app_product_brand/readme/USAGE.rst
Normal file
@@ -0,0 +1,20 @@
|
||||
To create a new brand:
|
||||
|
||||
#. Go to *Sales > Configuration > Products > Product Brands*.
|
||||
#. You can set its logo, associate a partner and add a description.
|
||||
|
||||
To add a product to a brand:
|
||||
|
||||
#. Go to the product itself and edit.
|
||||
#. Below the product's name there is a Brand field where you can pick the one
|
||||
the product belongs to.
|
||||
|
||||
To see the sales report based on brand dimension:
|
||||
|
||||
#. Go to *Sales > Reporting > Sales*.
|
||||
#. There you can *Group by* brand or add it as a dimension in the pivot view.
|
||||
|
||||
To see the invoice report based on brand dimension:
|
||||
|
||||
#. Go to *Invoicing > Reporting > Management > Invoices*.
|
||||
#. There you can *Group by* brand or add it as a dimension in the pivot view.
|
||||
2
app_product_brand/report/__init__.py
Normal file
2
app_product_brand/report/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
2
app_product_brand/reports/__init__.py
Normal file
2
app_product_brand/reports/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from . import account_invoice_report
|
||||
from . import sale_report
|
||||
32
app_product_brand/reports/account_invoice_report.py
Normal file
32
app_product_brand/reports/account_invoice_report.py
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2018 Tecnativa - David Vidal
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountInvoiceReport(models.Model):
|
||||
_inherit = "account.invoice.report"
|
||||
|
||||
product_brand_id = fields.Many2one(
|
||||
comodel_name='product.brand',
|
||||
string='Brand',
|
||||
)
|
||||
|
||||
def _select(self):
|
||||
select_str = super()._select()
|
||||
select_str += """
|
||||
, sub.product_brand_id as product_brand_id
|
||||
"""
|
||||
return select_str
|
||||
|
||||
def _sub_select(self):
|
||||
select_str = super()._sub_select()
|
||||
select_str += """
|
||||
, pt.product_brand_id
|
||||
"""
|
||||
return select_str
|
||||
|
||||
def _group_by(self):
|
||||
group_by_str = super()._group_by()
|
||||
group_by_str += ", pt.product_brand_id"
|
||||
return group_by_str
|
||||
15
app_product_brand/reports/account_invoice_report_view.xml
Normal file
15
app_product_brand/reports/account_invoice_report_view.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_account_invoice_report_search" model="ir.ui.view">
|
||||
<field name="inherit_id" ref="account.view_account_invoice_report_search"/>
|
||||
<field name="model">account.invoice.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="category_product" position="after">
|
||||
<filter string="Brand" name="brand"
|
||||
context="{'group_by':'product_brand_id'}"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
21
app_product_brand/reports/sale_report.py
Normal file
21
app_product_brand/reports/sale_report.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright 2018 Tecnativa - David Vidal
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class SaleReport(models.Model):
|
||||
_inherit = "sale.report"
|
||||
|
||||
product_brand_id = fields.Many2one(
|
||||
comodel_name='product.brand',
|
||||
string='Brand',
|
||||
)
|
||||
|
||||
# pylint:disable=dangerous-default-value
|
||||
def _query(self, with_clause='', fields={}, groupby='', from_clause=''):
|
||||
fields['product_brand_id'] = ", t.product_brand_id as product_brand_id"
|
||||
groupby += ', t.product_brand_id'
|
||||
return super(SaleReport, self)._query(
|
||||
with_clause, fields, groupby, from_clause
|
||||
)
|
||||
15
app_product_brand/reports/sale_report_view.xml
Normal file
15
app_product_brand/reports/sale_report_view.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_order_product_search" model="ir.ui.view">
|
||||
<field name="inherit_id" ref="sale.view_order_product_search"/>
|
||||
<field name="model">sale.report</field>
|
||||
<field name="arch" type="xml">
|
||||
<filter name="Customer" position="after">
|
||||
<filter string="Brand" name="brand"
|
||||
context="{'group_by':'product_brand_id'}"/>
|
||||
</filter>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
51
app_product_brand/security/app_security.xml
Normal file
51
app_product_brand/security/app_security.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<!-- model权限 -->
|
||||
<record id="acc_module" model="ir.model.access">
|
||||
<field name="name">acc_module_user</field>
|
||||
<field name="model_id" ref="model_app_order"/>
|
||||
<field name="group_id" ref="base.group_user"/>
|
||||
<field name="perm_read" eval="1"/>
|
||||
<field name="perm_write" eval="1"/>
|
||||
<field name="perm_create" eval="1"/>
|
||||
<field name="perm_unlink" eval="1"/>
|
||||
</record>
|
||||
<!-- 应用权限目录 -->
|
||||
<record model="ir.module.category" id="app_module_category_1">
|
||||
<field name="name">App...</field>
|
||||
<field name="description">Helps you manage your ...</field>
|
||||
<field name="sequence">8</field>
|
||||
</record>
|
||||
<!-- 权限用户 -->
|
||||
<!-- 普通 -->
|
||||
<record id="group_app_user" model="res.groups">
|
||||
<field name="name">App User</field>
|
||||
<field name="category_id" ref="app_module_category_1"/>
|
||||
<field name="implied_ids" eval="[(4, ref('base.group_user'))]"/>
|
||||
<field name="comment">The user will be able to ...</field>
|
||||
</record>
|
||||
|
||||
<!-- 管理员,可以配置 -->
|
||||
<record id="group_app_admin" model="res.groups">
|
||||
<field name="name">App Admin</field>
|
||||
<field name="category_id" ref="app_module_category_1"/>
|
||||
<field name="implied_ids" eval="[(4, ref('group_app_user'))]"/>
|
||||
<field name="comment">The user will be able to config ...</field>
|
||||
</record>
|
||||
|
||||
<!-- group_erp_manager自动有完整权限 -->
|
||||
<record id="base.group_erp_manager" model="res.groups">
|
||||
<field name="implied_ids" eval="[(4, ref('group_app_admin'))]"/>
|
||||
</record>
|
||||
|
||||
<!-- Rules -->
|
||||
<record id="rule_user" model="ir.rule">
|
||||
<field name="name">Users are allowed to access their own m///</field>
|
||||
<field name="model_id" ref="model_app_order"/>
|
||||
<field name="domain_force">['|', ('partner_id', 'in', [user.partner_id.id]), ('user_id.id', '=', user.id)]</field>
|
||||
<field name="groups" eval="[(4, ref('base.group_user'))]"/>
|
||||
</record>
|
||||
<!--End -->
|
||||
</data>
|
||||
</odoo>
|
||||
3
app_product_brand/security/ir.model.access.csv
Normal file
3
app_product_brand/security/ir.model.access.csv
Normal file
@@ -0,0 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_product_brand_product_manager","product.brand","model_product_brand","base.group_partner_manager",1,1,1,1
|
||||
"access_product_brand_public","product.brand.public","model_product_brand",,1,0,0,0
|
||||
|
BIN
app_product_brand/static/description/banner.png
Normal file
BIN
app_product_brand/static/description/banner.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 222 KiB |
BIN
app_product_brand/static/description/icon.png
Normal file
BIN
app_product_brand/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
470
app_product_brand/static/description/index.html
Normal file
470
app_product_brand/static/description/index.html
Normal file
@@ -0,0 +1,470 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
|
||||
<title>Product Brand Manager</title>
|
||||
<style type="text/css">
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
|
||||
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
*/
|
||||
|
||||
/* used to remove borders from tables and images */
|
||||
.borderless, table.borderless td, table.borderless th {
|
||||
border: 0 }
|
||||
|
||||
table.borderless td, table.borderless th {
|
||||
/* Override padding for "table.docutils td" with "! important".
|
||||
The right padding separates the table cells. */
|
||||
padding: 0 0.5em 0 0 ! important }
|
||||
|
||||
.first {
|
||||
/* Override more specific margin styles with "! important". */
|
||||
margin-top: 0 ! important }
|
||||
|
||||
.last, .with-subtitle {
|
||||
margin-bottom: 0 ! important }
|
||||
|
||||
.hidden {
|
||||
display: none }
|
||||
|
||||
.subscript {
|
||||
vertical-align: sub;
|
||||
font-size: smaller }
|
||||
|
||||
.superscript {
|
||||
vertical-align: super;
|
||||
font-size: smaller }
|
||||
|
||||
a.toc-backref {
|
||||
text-decoration: none ;
|
||||
color: black }
|
||||
|
||||
blockquote.epigraph {
|
||||
margin: 2em 5em ; }
|
||||
|
||||
dl.docutils dd {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Uncomment (and remove this text!) to get bold-faced definition list terms
|
||||
dl.docutils dt {
|
||||
font-weight: bold }
|
||||
*/
|
||||
|
||||
div.abstract {
|
||||
margin: 2em 5em }
|
||||
|
||||
div.abstract p.topic-title {
|
||||
font-weight: bold ;
|
||||
text-align: center }
|
||||
|
||||
div.admonition, div.attention, div.caution, div.danger, div.error,
|
||||
div.hint, div.important, div.note, div.tip, div.warning {
|
||||
margin: 2em ;
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.admonition p.admonition-title, div.hint p.admonition-title,
|
||||
div.important p.admonition-title, div.note p.admonition-title,
|
||||
div.tip p.admonition-title {
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
div.attention p.admonition-title, div.caution p.admonition-title,
|
||||
div.danger p.admonition-title, div.error p.admonition-title,
|
||||
div.warning p.admonition-title, .code .error {
|
||||
color: red ;
|
||||
font-weight: bold ;
|
||||
font-family: sans-serif }
|
||||
|
||||
/* Uncomment (and remove this text!) to get reduced vertical space in
|
||||
compound paragraphs.
|
||||
div.compound .compound-first, div.compound .compound-middle {
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
div.compound .compound-last, div.compound .compound-middle {
|
||||
margin-top: 0.5em }
|
||||
*/
|
||||
|
||||
div.dedication {
|
||||
margin: 2em 5em ;
|
||||
text-align: center ;
|
||||
font-style: italic }
|
||||
|
||||
div.dedication p.topic-title {
|
||||
font-weight: bold ;
|
||||
font-style: normal }
|
||||
|
||||
div.figure {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
div.footer, div.header {
|
||||
clear: both;
|
||||
font-size: smaller }
|
||||
|
||||
div.line-block {
|
||||
display: block ;
|
||||
margin-top: 1em ;
|
||||
margin-bottom: 1em }
|
||||
|
||||
div.line-block div.line-block {
|
||||
margin-top: 0 ;
|
||||
margin-bottom: 0 ;
|
||||
margin-left: 1.5em }
|
||||
|
||||
div.sidebar {
|
||||
margin: 0 0 0.5em 1em ;
|
||||
border: medium outset ;
|
||||
padding: 1em ;
|
||||
background-color: #ffffee ;
|
||||
width: 40% ;
|
||||
float: right ;
|
||||
clear: right }
|
||||
|
||||
div.sidebar p.rubric {
|
||||
font-family: sans-serif ;
|
||||
font-size: medium }
|
||||
|
||||
div.system-messages {
|
||||
margin: 5em }
|
||||
|
||||
div.system-messages h1 {
|
||||
color: red }
|
||||
|
||||
div.system-message {
|
||||
border: medium outset ;
|
||||
padding: 1em }
|
||||
|
||||
div.system-message p.system-message-title {
|
||||
color: red ;
|
||||
font-weight: bold }
|
||||
|
||||
div.topic {
|
||||
margin: 2em }
|
||||
|
||||
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
|
||||
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
|
||||
margin-top: 0.4em }
|
||||
|
||||
h1.title {
|
||||
text-align: center }
|
||||
|
||||
h2.subtitle {
|
||||
text-align: center }
|
||||
|
||||
hr.docutils {
|
||||
width: 75% }
|
||||
|
||||
img.align-left, .figure.align-left, object.align-left, table.align-left {
|
||||
clear: left ;
|
||||
float: left ;
|
||||
margin-right: 1em }
|
||||
|
||||
img.align-right, .figure.align-right, object.align-right, table.align-right {
|
||||
clear: right ;
|
||||
float: right ;
|
||||
margin-left: 1em }
|
||||
|
||||
img.align-center, .figure.align-center, object.align-center {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
table.align-center {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.align-left {
|
||||
text-align: left }
|
||||
|
||||
.align-center {
|
||||
clear: both ;
|
||||
text-align: center }
|
||||
|
||||
.align-right {
|
||||
text-align: right }
|
||||
|
||||
/* reset inner alignment in figures */
|
||||
div.align-right {
|
||||
text-align: inherit }
|
||||
|
||||
/* div.align-center * { */
|
||||
/* text-align: left } */
|
||||
|
||||
.align-top {
|
||||
vertical-align: top }
|
||||
|
||||
.align-middle {
|
||||
vertical-align: middle }
|
||||
|
||||
.align-bottom {
|
||||
vertical-align: bottom }
|
||||
|
||||
ol.simple, ul.simple {
|
||||
margin-bottom: 1em }
|
||||
|
||||
ol.arabic {
|
||||
list-style: decimal }
|
||||
|
||||
ol.loweralpha {
|
||||
list-style: lower-alpha }
|
||||
|
||||
ol.upperalpha {
|
||||
list-style: upper-alpha }
|
||||
|
||||
ol.lowerroman {
|
||||
list-style: lower-roman }
|
||||
|
||||
ol.upperroman {
|
||||
list-style: upper-roman }
|
||||
|
||||
p.attribution {
|
||||
text-align: right ;
|
||||
margin-left: 50% }
|
||||
|
||||
p.caption {
|
||||
font-style: italic }
|
||||
|
||||
p.credits {
|
||||
font-style: italic ;
|
||||
font-size: smaller }
|
||||
|
||||
p.label {
|
||||
white-space: nowrap }
|
||||
|
||||
p.rubric {
|
||||
font-weight: bold ;
|
||||
font-size: larger ;
|
||||
color: maroon ;
|
||||
text-align: center }
|
||||
|
||||
p.sidebar-title {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold ;
|
||||
font-size: larger }
|
||||
|
||||
p.sidebar-subtitle {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
p.topic-title {
|
||||
font-weight: bold }
|
||||
|
||||
pre.address {
|
||||
margin-bottom: 0 ;
|
||||
margin-top: 0 ;
|
||||
font: inherit }
|
||||
|
||||
pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
pre.code .literal.string, code .literal.string { color: #0C5404 }
|
||||
pre.code .name.builtin, code .name.builtin { color: #352B84 }
|
||||
pre.code .deleted, code .deleted { background-color: #DEB0A1}
|
||||
pre.code .inserted, code .inserted { background-color: #A3D289}
|
||||
|
||||
span.classifier {
|
||||
font-family: sans-serif ;
|
||||
font-style: oblique }
|
||||
|
||||
span.classifier-delimiter {
|
||||
font-family: sans-serif ;
|
||||
font-weight: bold }
|
||||
|
||||
span.interpreted {
|
||||
font-family: sans-serif }
|
||||
|
||||
span.option {
|
||||
white-space: nowrap }
|
||||
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
/* font-size relative to parent (h1..h6 element) */
|
||||
font-size: 80% }
|
||||
|
||||
table.citation {
|
||||
border-left: solid 1px gray;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docinfo {
|
||||
margin: 2em 4em }
|
||||
|
||||
table.docutils {
|
||||
margin-top: 0.5em ;
|
||||
margin-bottom: 0.5em }
|
||||
|
||||
table.footnote {
|
||||
border-left: solid 1px black;
|
||||
margin-left: 1px }
|
||||
|
||||
table.docutils td, table.docutils th,
|
||||
table.docinfo td, table.docinfo th {
|
||||
padding-left: 0.5em ;
|
||||
padding-right: 0.5em ;
|
||||
vertical-align: top }
|
||||
|
||||
table.docutils th.field-name, table.docinfo th.docinfo-name {
|
||||
font-weight: bold ;
|
||||
text-align: left ;
|
||||
white-space: nowrap ;
|
||||
padding-left: 0 }
|
||||
|
||||
/* "booktabs" style (no vertical lines) */
|
||||
table.docutils.booktabs {
|
||||
border: 0px;
|
||||
border-top: 2px solid;
|
||||
border-bottom: 2px solid;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.docutils.booktabs * {
|
||||
border: 0px;
|
||||
}
|
||||
table.docutils.booktabs th {
|
||||
border-bottom: thin solid;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
|
||||
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
|
||||
font-size: 100% }
|
||||
|
||||
ul.auto-toc {
|
||||
list-style-type: none }
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="document" id="product-brand-manager">
|
||||
<h1 class="title">Product Brand Manager</h1>
|
||||
|
||||
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/product-attribute/tree/12.0/product_brand"><img alt="OCA/product-attribute" src="https://img.shields.io/badge/github-OCA%2Fproduct--attribute-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_brand"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/135/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
|
||||
<p>This module allows odoo users to easily manage product brands.</p>
|
||||
<p><strong>Table of contents</strong></p>
|
||||
<div class="contents local topic" id="contents">
|
||||
<ul class="simple">
|
||||
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
|
||||
<li><a class="reference internal" href="#known-issues-roadmap" id="id2">Known issues / Roadmap</a></li>
|
||||
<li><a class="reference internal" href="#bug-tracker" id="id3">Bug Tracker</a></li>
|
||||
<li><a class="reference internal" href="#credits" id="id4">Credits</a><ul>
|
||||
<li><a class="reference internal" href="#authors" id="id5">Authors</a></li>
|
||||
<li><a class="reference internal" href="#contributors" id="id6">Contributors</a></li>
|
||||
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="usage">
|
||||
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
|
||||
<p>To create a new brand:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to <em>Sales > Configuration > Products > Product Brands</em>.</li>
|
||||
<li>You can set its logo, associate a partner and add a description.</li>
|
||||
</ol>
|
||||
<p>To add a product to a brand:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to the product itself and edit.</li>
|
||||
<li>Below the product’s name there is a Brand field where you can pick the one
|
||||
the product belongs to.</li>
|
||||
</ol>
|
||||
<p>To see the sales report based on brand dimension:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to <em>Sales > Reporting > Sales</em>.</li>
|
||||
<li>There you can <em>Group by</em> brand or add it as a dimension in the pivot view.</li>
|
||||
</ol>
|
||||
<p>To see the invoice report based on brand dimension:</p>
|
||||
<ol class="arabic simple">
|
||||
<li>Go to <em>Invoicing > Reporting > Management > Invoices</em>.</li>
|
||||
<li>There you can <em>Group by</em> brand or add it as a dimension in the pivot view.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#id2">Known issues / Roadmap</a></h1>
|
||||
<ul class="simple">
|
||||
<li>Add a field with brands associated to a Customer or Supplier on
|
||||
the Customers/Suppliers Form View.</li>
|
||||
<li>Fix smart button alignment in brand form view</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="bug-tracker">
|
||||
<h1><a class="toc-backref" href="#id3">Bug Tracker</a></h1>
|
||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/product-attribute/issues">GitHub Issues</a>.
|
||||
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
|
||||
<a class="reference external" href="https://github.com/OCA/product-attribute/issues/new?body=module:%20product_brand%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
|
||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||
</div>
|
||||
<div class="section" id="credits">
|
||||
<h1><a class="toc-backref" href="#id4">Credits</a></h1>
|
||||
<div class="section" id="authors">
|
||||
<h2><a class="toc-backref" href="#id5">Authors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>NetAndCo</li>
|
||||
<li>Akretion</li>
|
||||
<li>Prisnet Telecommunications SA</li>
|
||||
<li>MONK Software</li>
|
||||
<li>SerpentCS Pvt. Ltd.</li>
|
||||
<li>Tecnativa</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="contributors">
|
||||
<h2><a class="toc-backref" href="#id6">Contributors</a></h2>
|
||||
<ul class="simple">
|
||||
<li>Mathieu Lemercier <<a class="reference external" href="mailto:mathieu@netandco.net">mathieu@netandco.net</a>></li>
|
||||
<li>Franck Bret <<a class="reference external" href="mailto:franck@netandco.net">franck@netandco.net</a>></li>
|
||||
<li>Seraphine Lantible <<a class="reference external" href="mailto:s.lantible@gmail.com">s.lantible@gmail.com</a>></li>
|
||||
<li>Gunnar Wagner <<a class="reference external" href="mailto:vrms@netcologne.de">vrms@netcologne.de</a>></li>
|
||||
<li>Leonardo Donelli <<a class="reference external" href="mailto:donelli@webmonks.it">donelli@webmonks.it</a>></li>
|
||||
<li>Serpent Consulting Services Pvt. Ltd. <<a class="reference external" href="mailto:jay.vora@serpentcs.com">jay.vora@serpentcs.com</a>></li>
|
||||
<li>Marcelo Pickler <<a class="reference external" href="mailto:loxamir@gmail.com">loxamir@gmail.com</a>></li>
|
||||
<li>Andrius Laukavičius <<a class="reference external" href="mailto:ala@boolit.eu">ala@boolit.eu</a>> (Boolit)</li>
|
||||
<li>Daniel Campos <<a class="reference external" href="mailto:danielcampos@avanzosc.es">danielcampos@avanzosc.es</a>></li>
|
||||
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
|
||||
<li>David Vidal <<a class="reference external" href="mailto:david.vidal@tecnativa.com">david.vidal@tecnativa.com</a>></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||
mission is to support the collaborative development of Odoo features and
|
||||
promote its widespread use.</p>
|
||||
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/product-attribute/tree/12.0/product_brand">OCA/product-attribute</a> project on GitHub.</p>
|
||||
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
BIN
app_product_brand/static/img/icon_sunpop.png
Normal file
BIN
app_product_brand/static/img/icon_sunpop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
app_product_brand/static/img/logo_sunpop.png
Normal file
BIN
app_product_brand/static/img/logo_sunpop.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 30 KiB |
1
app_product_brand/tests/__init__.py
Normal file
1
app_product_brand/tests/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from . import test_product_brand
|
||||
25
app_product_brand/tests/test_product_brand.py
Normal file
25
app_product_brand/tests/test_product_brand.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# Copyright (c) 2018 Daniel Campos <danielcampos@avanzosc.es> - Avanzosc S.L.
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo.tests import common
|
||||
|
||||
|
||||
class TestProductBrand(common.TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.product = self.env.ref('product.product_product_4')
|
||||
self.supplier = self.ref('base.res_partner_2')
|
||||
self.product_brand_obj = self.env['product.brand']
|
||||
self.product_brand = self.product_brand_obj.create(
|
||||
{'name': 'Test Brand',
|
||||
'description': 'Test brand description',
|
||||
'partner_id': self.supplier
|
||||
})
|
||||
|
||||
def test_products_count(self):
|
||||
self.assertEqual(self.product_brand.products_count, 0,
|
||||
'Error product count does not match')
|
||||
self.product.product_brand_id = self.product_brand.id
|
||||
self.assertEqual(self.product_brand.products_count, 1,
|
||||
'Error product count does not match')
|
||||
117
app_product_brand/views/product_brand_views.xml
Normal file
117
app_product_brand/views/product_brand_views.xml
Normal file
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<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>
|
||||
|
||||
<act_window
|
||||
id="action_open_brand_products"
|
||||
name="Brand Products"
|
||||
res_model="product.template"
|
||||
view_mode="kanban,form,tree"
|
||||
domain="[('product_brand_id', '=', active_id)]"/>
|
||||
|
||||
<act_window
|
||||
id="action_open_single_product_brand"
|
||||
name="Product Brand"
|
||||
res_model="product.brand"
|
||||
view_mode="kanban,form,tree"
|
||||
target="current"
|
||||
domain="[('product_ids', 'in', active_id)]"/>
|
||||
|
||||
<record id="view_product_brand_form" model="ir.ui.view">
|
||||
<field name="name">product.brand.form</field>
|
||||
<field name="model">product.brand</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="%(action_open_brand_products)d"
|
||||
type="action"
|
||||
class="oe_stat_button"
|
||||
icon="fa-cubes">
|
||||
<field name="products_count" widget="statinfo" string="Products"/>
|
||||
</button>
|
||||
</div>
|
||||
<field name="logo" widget="image" class="oe_avatar"/>
|
||||
<div class="oe_title">
|
||||
<label for="name" string="Brand Name" class="oe_edit_only"/>
|
||||
<h1><field name="name"/></h1>
|
||||
</div>
|
||||
<group>
|
||||
<group>
|
||||
<field name="partner_id"/>
|
||||
</group>
|
||||
</group>
|
||||
<group string="Description">
|
||||
<field name="description" nolabel="1"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_brand_tree" model="ir.ui.view">
|
||||
<field name="name">product.brand.tree</field>
|
||||
<field name="model">product.brand</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="product.brand">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
<field name="partner_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_brand_kanban" model="ir.ui.view">
|
||||
<field name="name">product.brand.kanban</field>
|
||||
<field name="model">product.brand</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban>
|
||||
<field name="id"/>
|
||||
<field name="logo"/>
|
||||
<field name="products_count"/>
|
||||
<field name="description"/>
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<div class="oe_kanban_global_click">
|
||||
<div class="o_kanban_image">
|
||||
<img t-att-src="kanban_image('product.brand', 'logo', record.id.raw_value)" alt="Logo"/>
|
||||
</div>
|
||||
<div class="oe_kanban_details">
|
||||
<h4>
|
||||
<field name="name"/>
|
||||
</h4>
|
||||
<div>
|
||||
<a name="%(action_open_brand_products)d" type="action">
|
||||
<t t-esc="record.products_count.value"/> Products
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</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_mode">kanban,form,tree</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Product Brands"
|
||||
id="menu_product_brand"
|
||||
action="action_product_brand"
|
||||
parent="sale.prod_config_main"/>
|
||||
</odoo>
|
||||
32
app_product_brand/views/product_product_views.xml
Normal file
32
app_product_brand/views/product_product_views.xml
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--产品list,可调整显示顺序-->
|
||||
<record id="view_product_variant_tree_brand" model="ir.ui.view">
|
||||
<field name="name">product variant tree view add brand</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_product_tree_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="product_brand_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_variant_kanban_brand" model="ir.ui.view">
|
||||
<field name="name">product variant kanban view add brand</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_kanban_view" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('oe_kanban_details')]/strong[1]" position="after">
|
||||
<div>
|
||||
<a t-if="record.product_brand_id" type="open">
|
||||
<field name="product_brand_id"/>
|
||||
</a>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
59
app_product_brand/views/product_template_views.xml
Normal file
59
app_product_brand/views/product_template_views.xml
Normal file
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_product_template_search_brand" model="ir.ui.view">
|
||||
<field name="name">product.template.search.brand</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="product_brand_id"/>
|
||||
<filter string="Brand" name="groupby_brand" domain="[]"
|
||||
context="{'group_by': 'product_brand_id'}"/>
|
||||
<separator/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_template_form_brand_add" model="ir.ui.view">
|
||||
<field name="name">product.template.product.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="sale_ok" position="before">
|
||||
<field name="product_brand_id" placeholder="Brand"/>
|
||||
<div/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_template_kanban_brand" model="ir.ui.view">
|
||||
<field name="name">product kanban view add brand</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_kanban_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('oe_kanban_details')]/strong[1]" position="after">
|
||||
<div>
|
||||
<a t-if="record.product_brand_id" type="action"
|
||||
name="%(action_open_single_product_brand)d">
|
||||
<field name="product_brand_id"/>
|
||||
</a>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_template_tree_brand" model="ir.ui.view">
|
||||
<field name="name">product tree view add brand</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_tree_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="product_brand_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user