add product brand

This commit is contained in:
Ivan x360
2023-08-03 12:17:40 +08:00
parent d5eeb4b02e
commit 62f229d65a
34 changed files with 1385 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
from . import models
from . import report

View File

@@ -0,0 +1,98 @@
# 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.odooai.cn
# email: 300883@qq.com
# resource of odooai
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
# Odoo12在线用户手册长期更新
# https://www.odooai.cn/documentation/user/12.0/zh_CN/index.html
# Odoo12在线开发者手册长期更新
# https://www.odooai.cn/documentation/12.0/index.html
# Odoo10在线中文用户手册长期更新
# https://www.odooai.cn/documentation/user/10.0/zh_CN/index.html
# Odoo10离线中文用户手册下载
# https://www.odooai.cn/odoo10_user_manual_document_offline/
# Odoo10离线开发手册下载-含python教程jquery参考Jinja2模板PostgresSQL参考odoo开发必备
# https://www.odooai.cn/odoo10_developer_document_offline/
##############################################################################
# Copyright (C) 2009-TODAY odooai.cn Ltd. https://www.odooai.cn
# Author: Ivan Deng300883@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': '16.23.12.29',
'author': 'odooai.cn',
'category': 'Product',
'website': 'https://www.odooai.cn',
'license': 'LGPL-3',
'sequence': 2,
'price': 0.00,
'currency': 'EUR',
'images': ['static/description/banner.png'],
'depends': [
'sale_stock',
'purchase',
],
'summary': """
Product brand manager. Odoo App of odooai.cn
""",
'description': """
Support Odoo 1312, 11, Enterprise and Community Edition
1.
2.
3. Multi-language Support.
4. Multi-Company Support.
5. Support Odoo 1312, 11, Enterprise and Community Edition
==========
1.
2.
3. 多语言支持
4. 多公司支持
5. Odoo 13, 12, 11, 企业版,社区版,多版本支持
""",
'depends': [
'app_purchase_pro',
'app_sale_pro',
],
'data': [
'security/ir.model.access.csv',
'views/product_brand_views.xml',
'views/product_template_views.xml',
'views/product_product_views.xml',
# todo: update report
'report/sale_report_views.xml',
'report/purchase_report_views.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,
}

View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Created on 2018-10-12
# author: 欧度智能https://www.odooai.cn
# email: 300883@qq.com
# resource of odooai
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
# Odoo在线中文用户手册长期更新
# https://www.odooai.cn/documentation/user/10.0/zh_CN/index.html
# Odoo10离线中文用户手册下载
# https://www.odooai.cn/odoo10_user_manual_document_offline/
# Odoo10离线开发手册下载-含python教程jquery参考Jinja2模板PostgresSQL参考odoo开发必备
# https://www.odooai.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("")

View File

@@ -0,0 +1,171 @@
# 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-20220602\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-09-06 11:10+0000\n"
"PO-Revision-Date: 2022-09-06 11:10+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,help:app_product_brand.field_product_brand__message_unread_counter
msgid "Number of unread messages"
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:ir.model.fields,field_description:app_product_brand.field_sale_report__product_brand_id
#: model:ir.model.fields,field_description:app_product_brand.field_purchase_report__product_brand_id
#: model_terms:ir.ui.view,arch_db:app_product_brand.app_view_order_product_search
#: model_terms:ir.ui.view,arch_db:app_product_brand.product_brand_search_form_view
#: model_terms:ir.ui.view,arch_db:app_product_brand.app_view_purchase_order_search
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,field_description:app_product_brand.field_product_brand__activity_user_id
msgid "Responsible User"
msgstr ""
#. module: app_product_brand
#: model:ir.model.fields,field_description:app_product_brand.field_product_brand__message_has_sms_error
msgid "SMS Delivery error"
msgstr ""
#. module: app_product_brand
#: model:ir.model,name:app_product_brand.model_sale_report
msgid "Sales Analysis Report"
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 "产品.品牌"

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import product_brand
from . import product_template

View File

@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# 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 odooai.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'
_inherit = ['mail.thread', 'mail.activity.mixin']
_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='set null'
)
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", default=10)
@api.depends('product_ids')
def _compute_products_count(self):
for brand in self:
brand.products_count = len(brand.product_ids)

View File

@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# 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 odooai.cn <guohuadeng@hotmail.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo import api, fields, models, _
class ProductTemplate(models.Model):
_inherit = 'product.template'
product_brand_id = fields.Many2one(
'product.brand',
string='Brand',
help='Select a brand for this product'
)

View File

@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
import logging
from odoo import fields, models, api, _
_logger = logging.getLogger(__name__)
class SaleOrderLine(models.Model):
_inherit = "sale.order.line"
product_brand_id = fields.Many2one(
'product.brand',
string='Brand',
compute='_compute_product_code',
readonly=True, store=True,
help='Select a brand for this product'
)
@api.depends('product_id')
def _compute_product_code(self):
# 直接覆盖 app_sale_pro
data = self.env['product.product'].search_read([('id', 'in', self.mapped('product_id').ids)],
fields=['id', 'default_code', 'product_brand_id'])
for rec in self:
rec.product_code = rec.product_id.default_code
rec.categ_id = rec.product_id.categ_id
rec.product_brand_id = rec.product_id.product_brand_id
# for rec in self:
# rec.update({
# 'product_code': data[rec.product_id.id].get('default_code'),
# 'product_brand_id': data[rec.product_id.id].get('product_brand_id')
# })

View 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>

View File

@@ -0,0 +1 @@
This module allows odoo users to easily manage product brands.

View 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

View 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.

View File

@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-
from . import sale_report
from . import purchase_report

View File

@@ -0,0 +1,17 @@
# -*- coding: utf-8 -*-
from odoo import tools
from odoo import api, fields, models
class PurchaseReport(models.Model):
_inherit = "purchase.report"
product_brand_id = fields.Many2one('product.brand', string='Product Brand', readonly=True)
def _select(self):
return super(PurchaseReport, self)._select() + \
", t.product_brand_id as product_brand_id"
def _group_by(self):
return super(PurchaseReport, self)._group_by() + ",t.product_brand_id"

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="app_product_brand_purchase_report_tree" model="ir.ui.view">
<field name="name">app.product.brand.purchase.report.tree</field>
<field name="model">purchase.report</field>
<field name="inherit_id" ref="app_purchase_pro.app_purchase_report_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name="category_id" optional="hide"/>
<field name="product_brand_id" optional="hide"/>
</xpath>
</field>
</record>
<record id="app_view_purchase_order_search" model="ir.ui.view">
<field name="name">app.purchase.report.search</field>
<field name="model">purchase.report</field>
<field name="inherit_id" ref="purchase.view_purchase_order_search"/>
<field name="arch" type="xml">
<xpath expr="//search//field[@name='category_id']" position="after">
<field name="product_brand_id"/>
</xpath>
<xpath expr="//filter[@name='group_category_id']" position="after">
<filter string="Product Brand" name="groupby_product_brand_id"
context="{'group_by':'product_brand_id'}"/>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from odoo import tools
from odoo import api, fields, models
class SaleReport(models.Model):
_inherit = "sale.report"
product_brand_id = fields.Many2one('product.brand', string='Product Brand', readonly=True)
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)

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="app_product_brand_sale_report_tree" model="ir.ui.view">
<field name="name">app.product.brand.sale.report.tree</field>
<field name="model">sale.report</field>
<field name="inherit_id" ref="app_sale_pro.app_sale_report_tree"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='product_id']" position="after">
<field name="categ_id" optional="hide"/>
<field name="product_brand_id" optional="hide"/>
</xpath>
</field>
</record>
<record id="app_view_order_product_search" model="ir.ui.view">
<field name="name">app.sale.report.search</field>
<field name="model">sale.report</field>
<field name="inherit_id" ref="sale.view_order_product_search"/>
<field name="arch" type="xml">
<xpath expr="//search//field[@name='categ_id']" position="after">
<field name="product_brand_id" optional="hide"/>
</xpath>
<xpath expr="//filter[@name='Category']" position="after">
<filter string="Product Brand" name="groupby_product_brand_id" context="{'group_by':'product_brand_id'}"/>
</xpath>
</field>
</record>
</data>
</odoo>

View File

@@ -0,0 +1,2 @@
from . import account_invoice_report
from . import sale_report

View File

@@ -0,0 +1,29 @@
# 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('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

View 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>

View File

@@ -0,0 +1,18 @@
# 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('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
)

View 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>

View 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>

View 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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_product_brand_product_manager product.brand model_product_brand base.group_partner_manager 1 1 1 1
3 access_product_brand_public product.brand.public model_product_brand 1 0 0 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -0,0 +1,471 @@
<?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>
<h2 class="title">Base on OCA product brand manager</h2>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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 &gt; Configuration &gt; Products &gt; 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 products 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 &gt; Reporting &gt; 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 &gt; Reporting &gt; Management &gt; 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 &lt;<a class="reference external" href="mailto:mathieu&#64;netandco.net">mathieu&#64;netandco.net</a>&gt;</li>
<li>Franck Bret &lt;<a class="reference external" href="mailto:franck&#64;netandco.net">franck&#64;netandco.net</a>&gt;</li>
<li>Seraphine Lantible &lt;<a class="reference external" href="mailto:s.lantible&#64;gmail.com">s.lantible&#64;gmail.com</a>&gt;</li>
<li>Gunnar Wagner &lt;<a class="reference external" href="mailto:vrms&#64;netcologne.de">vrms&#64;netcologne.de</a>&gt;</li>
<li>Leonardo Donelli &lt;<a class="reference external" href="mailto:donelli&#64;webmonks.it">donelli&#64;webmonks.it</a>&gt;</li>
<li>Serpent Consulting Services Pvt. Ltd. &lt;<a class="reference external" href="mailto:jay.vora&#64;serpentcs.com">jay.vora&#64;serpentcs.com</a>&gt;</li>
<li>Marcelo Pickler &lt;<a class="reference external" href="mailto:loxamir&#64;gmail.com">loxamir&#64;gmail.com</a>&gt;</li>
<li>Andrius Laukavičius &lt;<a class="reference external" href="mailto:ala&#64;boolit.eu">ala&#64;boolit.eu</a>&gt; (Boolit)</li>
<li>Daniel Campos &lt;<a class="reference external" href="mailto:danielcampos&#64;avanzosc.es">danielcampos&#64;avanzosc.es</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a><ul>
<li>David Vidal &lt;<a class="reference external" href="mailto:david.vidal&#64;tecnativa.com">david.vidal&#64;tecnativa.com</a>&gt;</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>

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1 @@
from . import test_product_brand

View 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')

View File

@@ -0,0 +1,125 @@
<?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>
<!--action-->
<record id="action_open_brand_products" model="ir.actions.act_window">
<field name="name">Brand Products</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.template</field>
<field name="view_mode">kanban,form,tree</field>
<field name="domain">[('product_brand_id', '=', active_id)]</field>
</record>
<record id="action_open_single_product_brand" model="ir.actions.act_window">
<field name="name">Product Brand</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.brand</field>
<field name="view_mode">kanban,form,tree</field>
<field name="target">current</field>
<field name="domain">[('product_ids', 'in', active_id)]</field>
</record>
<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>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"/>
<field name="activity_ids" widget="mail_activity"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</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">tree,kanban,form</field>
</record>
<menuitem
name="Product Brands"
id="menu_product_brand"
action="action_product_brand"
parent="sale.prod_config_main"/>
</odoo>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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>
</odoo>

View File

@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<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="categ_id" position="after">
<field name="product_brand_id" placeholder="Brand"/>
</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>
</odoo>