mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
opt superbar, add m2o
This commit is contained in:
@@ -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)]},
|
|
||||||
)
|
|
||||||
@@ -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)
|
|
||||||
@@ -1 +1,2 @@
|
|||||||
from . import product_brand
|
from . import product_brand
|
||||||
|
from . import product_template
|
||||||
|
|||||||
@@ -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'
|
|
||||||
)
|
|
||||||
|
|||||||
19
app_product_brand/models/product_template.py
Normal file
19
app_product_brand/models/product_template.py
Normal 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'
|
||||||
|
)
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
|
|
||||||
@@ -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',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
Reference in New Issue
Block a user