update common

This commit is contained in:
ivan deng
2022-12-29 14:23:34 +08:00
parent eaa5ccfad6
commit c9b5a6500c
13 changed files with 170 additions and 128 deletions

View File

@@ -1,120 +0,0 @@
=====================
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.

View File

@@ -1,2 +1,2 @@
from . import models
# from . import reports
from . import report

View File

@@ -41,7 +41,7 @@
{
'name': 'Product Brand Manager',
'version': '13.22.03.28',
'version': '13.22.12.29',
'author': 'Sunpop.cn',
'category': 'Product',
'website': 'https://www.sunpop.cn',
@@ -51,7 +51,8 @@
'currency': 'EUR',
'images': ['static/description/banner.png'],
'depends': [
'sale',
'app_sale_pro',
'app_purchase_pro',
],
'summary': """
Product brand manager. Odoo App of Sunpop.cn
@@ -71,7 +72,8 @@
5. Odoo 13, 12, 11, 企业版,社区版,多版本支持
""",
'depends': [
'sale',
'app_purchase_pro',
'app_sale_pro',
],
'data': [
'security/ir.model.access.csv',
@@ -79,7 +81,8 @@
'views/product_template_views.xml',
'views/product_product_views.xml',
# todo: update report
# 'reports/sale_report_view.xml',
'report/sale_report_views.xml',
'report/purchase_report_views.xml',
# 'reports/account_invoice_report_view.xml',
],
'qweb': [

View File

@@ -4,10 +4,10 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0+e\n"
"Project-Id-Version: Odoo Server 13.0+e-20220602\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"
"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"
@@ -97,6 +97,11 @@ msgstr "Logo文件"
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"
@@ -105,7 +110,11 @@ 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 "产品品牌"
@@ -125,6 +134,21 @@ msgstr "产品"
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

View File

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

View File

@@ -1,3 +1,5 @@
# -*- 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>

View File

@@ -1,3 +1,5 @@
# -*- 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>

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

@@ -1,2 +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>