diff --git a/app_product_brand/README.rst b/app_product_brand/README.rst deleted file mode 100644 index c35b9c07..00000000 --- a/app_product_brand/README.rst +++ /dev/null @@ -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 `_. -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 `_. - -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 -* Franck Bret -* Seraphine Lantible -* Gunnar Wagner -* Leonardo Donelli -* Serpent Consulting Services Pvt. Ltd. -* Marcelo Pickler -* Andrius Laukavičius (Boolit) -* Daniel Campos -* `Tecnativa `_ - - * David Vidal - -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 `_ project on GitHub. - -You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/app_product_brand/__init__.py b/app_product_brand/__init__.py index 30988763..bf588bc8 100644 --- a/app_product_brand/__init__.py +++ b/app_product_brand/__init__.py @@ -1,2 +1,2 @@ from . import models -# from . import reports +from . import report diff --git a/app_product_brand/__manifest__.py b/app_product_brand/__manifest__.py index d010a60f..636953c4 100644 --- a/app_product_brand/__manifest__.py +++ b/app_product_brand/__manifest__.py @@ -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': [ diff --git a/app_product_brand/i18n/zh_CN.po b/app_product_brand/i18n/zh_CN.po index 2df1c16d..77b1c580 100644 --- a/app_product_brand/i18n/zh_CN.po +++ b/app_product_brand/i18n/zh_CN.po @@ -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 diff --git a/app_product_brand/models/__init__.py b/app_product_brand/models/__init__.py index 166b9881..a476e455 100644 --- a/app_product_brand/models/__init__.py +++ b/app_product_brand/models/__init__.py @@ -1,2 +1,4 @@ +# -*- coding: utf-8 -*- + from . import product_brand from . import product_template diff --git a/app_product_brand/models/product_brand.py b/app_product_brand/models/product_brand.py index 0bc30654..754cf597 100644 --- a/app_product_brand/models/product_brand.py +++ b/app_product_brand/models/product_brand.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2009 NetAndCo (). # Copyright 2011 Akretion Benoît Guillot # Copyright 2014 prisnet.ch Seraphine Lantible diff --git a/app_product_brand/models/product_template.py b/app_product_brand/models/product_template.py index b1510037..94347ae5 100644 --- a/app_product_brand/models/product_template.py +++ b/app_product_brand/models/product_template.py @@ -1,3 +1,5 @@ +# -*- coding: utf-8 -*- + # Copyright 2009 NetAndCo (). # Copyright 2011 Akretion Benoît Guillot # Copyright 2014 prisnet.ch Seraphine Lantible diff --git a/app_product_brand/models/sale_order_line.py b/app_product_brand/models/sale_order_line.py new file mode 100644 index 00000000..7ac39bf3 --- /dev/null +++ b/app_product_brand/models/sale_order_line.py @@ -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') + # }) + + \ No newline at end of file diff --git a/app_product_brand/report/__init__.py b/app_product_brand/report/__init__.py index 633f8661..57cd84a7 100644 --- a/app_product_brand/report/__init__.py +++ b/app_product_brand/report/__init__.py @@ -1,2 +1,4 @@ # -*- coding: utf-8 -*- +from . import sale_report +from . import purchase_report diff --git a/app_product_brand/report/purchase_report.py b/app_product_brand/report/purchase_report.py new file mode 100644 index 00000000..f50639eb --- /dev/null +++ b/app_product_brand/report/purchase_report.py @@ -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" diff --git a/app_product_brand/report/purchase_report_views.xml b/app_product_brand/report/purchase_report_views.xml new file mode 100644 index 00000000..6cc69904 --- /dev/null +++ b/app_product_brand/report/purchase_report_views.xml @@ -0,0 +1,30 @@ + + + + + app.product.brand.purchase.report.tree + purchase.report + + + + + + + + + + app.purchase.report.search + purchase.report + + + + + + + + + + + + diff --git a/app_product_brand/report/sale_report.py b/app_product_brand/report/sale_report.py new file mode 100644 index 00000000..5416e610 --- /dev/null +++ b/app_product_brand/report/sale_report.py @@ -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) diff --git a/app_product_brand/report/sale_report_views.xml b/app_product_brand/report/sale_report_views.xml new file mode 100644 index 00000000..e863ba9b --- /dev/null +++ b/app_product_brand/report/sale_report_views.xml @@ -0,0 +1,29 @@ + + + + + app.product.brand.sale.report.tree + sale.report + + + + + + + + + + app.sale.report.search + sale.report + + + + + + + + + + + +