opt superbar, add m2o

This commit is contained in:
ivan deng
2020-04-09 19:05:39 +08:00
parent f9ad3dcc49
commit a872645ca2
8 changed files with 22 additions and 43 deletions

View File

@@ -1,14 +0,0 @@
# 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)]},
)

View File

@@ -1,16 +0,0 @@
# 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)

View File

@@ -1 +1,2 @@
from . import product_brand from . import product_brand
from . import product_template

View File

@@ -39,12 +39,3 @@ class ProductBrand(models.Model):
for brand in self: for brand in self:
brand.products_count = len(brand.product_ids) 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'
)

View File

@@ -0,0 +1,19 @@
# 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 ProductTemplate(models.Model):
_inherit = 'product.template'
product_brand_id = fields.Many2one(
'product.brand',
string='Brand',
help='Select a brand for this product'
)

View File

@@ -1,2 +0,0 @@
# -*- coding: utf-8 -*-

View File

@@ -8,7 +8,7 @@ class AccountInvoiceReport(models.Model):
_inherit = "account.invoice.report" _inherit = "account.invoice.report"
product_brand_id = fields.Many2one( product_brand_id = fields.Many2one(
comodel_name='product.brand', comodel_name='product.product_brand_id',
string='Brand', string='Brand',
) )

View File

@@ -7,7 +7,7 @@
<field name="inherit_id" ref="product.product_template_search_view"/> <field name="inherit_id" ref="product.product_template_search_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<xpath expr="//search"> <xpath expr="//search">
<searchpanel> <searchpanel view_types="tree,kanban,search">
<field name="categ_id" widget="ztree_select" text="name"/> <field name="categ_id" widget="ztree_select" text="name"/>
<field name="type"/> <field name="type"/>
</searchpanel> </searchpanel>