Delete reference to template_attribute_set field. Task 040129

This commit is contained in:
MarinaNico 2020-02-20 11:44:47 +01:00
parent 893e539ae8
commit 86189c0933
7 changed files with 105 additions and 180 deletions

View File

@ -9,14 +9,9 @@ from trytond.modules.company.model import CompanyValueMixin
__all__ = ['Configuration', 'ConfigurationProductESale']
template_attribute_set = fields.Many2One('product.attribute.set',
attribute_set = fields.Many2One('product.attribute.set',
'Template Attribute Set')
template_attribute_set_options = fields.Char('Template Attribute Set Options',
help=('Default attribute options when create new product:\n'
'key:value|key2:value2'))
product_attribute_set = fields.Many2One('product.attribute.set',
'Product Attribute Set')
product_attribute_set_options = fields.Char('Product Attribute Set Options',
attribute_set_options = fields.Char('Template Attribute Set Options',
help=('Default attribute options when create new product:\n'
'key:value|key2:value2'))
default_uom = fields.Many2One('product.uom', 'Default UOM')
@ -24,12 +19,9 @@ default_uom = fields.Many2One('product.uom', 'Default UOM')
class Configuration(metaclass=PoolMeta):
__name__ = 'product.configuration'
template_attribute_set = fields.MultiValue(template_attribute_set)
template_attribute_set_options = fields.MultiValue(
template_attribute_set_options)
product_attribute_set = fields.MultiValue(product_attribute_set)
product_attribute_set_options = fields.MultiValue(
product_attribute_set_options)
attribute_set = fields.MultiValue(attribute_set)
attribute_set_options = fields.MultiValue(
attribute_set_options)
default_uom = fields.MultiValue(default_uom)
check_slug = fields.Boolean('Check Slug',
help='Check slug exist in products and menus')
@ -41,10 +33,8 @@ class Configuration(metaclass=PoolMeta):
@classmethod
def multivalue_model(cls, field):
if field in [
'template_attribute_set',
'template_attribute_set_options',
'product_attribute_set',
'product_attribute_set_options',
'attribute_set',
'attribute_set_options',
'default_uom',
]:
return Pool().get('sale.configuration.product.esale')
@ -54,10 +44,8 @@ class Configuration(metaclass=PoolMeta):
class ConfigurationProductESale(ModelSQL, CompanyValueMixin):
"Product eSale Configuration Company Values"
__name__ = 'sale.configuration.product.esale'
template_attribute_set = template_attribute_set
template_attribute_set_options = template_attribute_set_options
product_attribute_set = product_attribute_set
product_attribute_set_options = product_attribute_set_options
attribute_set = attribute_set
attribute_set_options = attribute_set_options
default_uom = default_uom
@classmethod
@ -72,17 +60,13 @@ class ConfigurationProductESale(ModelSQL, CompanyValueMixin):
@classmethod
def _migrate_property(cls, field_names, value_names, fields):
field_names.extend([
'template_attribute_set',
'template_attribute_set_options',
'product_attribute_set',
'product_attribute_set_options',
'attribute_set',
'attribute_set_options',
'default_uom',
])
value_names.extend([
'template_attribute_set',
'template_attribute_set_options',
'product_attribute_set',
'product_attribute_set_options',
'attribute_set',
'attribute_set_options',
'default_uom',
])
migrate_property('sale.configuration', field_names, cls, value_names,

View File

@ -102,6 +102,14 @@ msgctxt "field:ir.attachment,esale_thumbnail:"
msgid "Thumbnail Image"
msgstr "Imatge miniatura"
msgctxt "field:product.configuration,attribute_set:"
msgid "Template Attribute Set"
msgstr "Grup atributs productes"
msgctxt "field:product.configuration,attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opcions grup atributs productes"
msgctxt "field:product.configuration,check_slug:"
msgid "Check Slug"
msgstr "Valida Slug"
@ -110,22 +118,6 @@ msgctxt "field:product.configuration,default_uom:"
msgid "Default UOM"
msgstr "UdM predeterminada"
msgctxt "field:product.configuration,product_attribute_set:"
msgid "Product Attribute Set"
msgstr "Grup atribut variant"
msgctxt "field:product.configuration,product_attribute_set_options:"
msgid "Product Attribute Set Options"
msgstr "Opcions grup atribut variant"
msgctxt "field:product.configuration,template_attribute_set:"
msgid "Template Attribute Set"
msgstr "Grup atributs productes"
msgctxt "field:product.configuration,template_attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opcions grup atributs productes"
msgctxt "field:product.configuration,thumb_size:"
msgid "Thumb Size"
msgstr "Miniatura tamany"
@ -398,6 +390,14 @@ msgctxt "field:product.template-product.upsell,write_uid:"
msgid "Write User"
msgstr "Usuari de modificació"
msgctxt "field:sale.configuration.product.esale,attribute_set:"
msgid "Template Attribute Set"
msgstr "Grup atributs producte"
msgctxt "field:sale.configuration.product.esale,attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opcions grup atributs productes"
msgctxt "field:sale.configuration.product.esale,company:"
msgid "Company"
msgstr "Empresa"
@ -418,28 +418,10 @@ msgctxt "field:sale.configuration.product.esale,id:"
msgid "ID"
msgstr "ID"
msgctxt "field:sale.configuration.product.esale,product_attribute_set:"
msgid "Product Attribute Set"
msgstr "Grup atribut variant"
msgctxt ""
"field:sale.configuration.product.esale,product_attribute_set_options:"
msgid "Product Attribute Set Options"
msgstr "Opcions grup atribut variant"
msgctxt "field:sale.configuration.product.esale,rec_name:"
msgid "Record Name"
msgstr "Nom del registre"
msgctxt "field:sale.configuration.product.esale,template_attribute_set:"
msgid "Template Attribute Set"
msgstr "Grup atributs productes"
msgctxt ""
"field:sale.configuration.product.esale,template_attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opcions grup atributs productes"
msgctxt "field:sale.configuration.product.esale,write_date:"
msgid "Write Date"
msgstr "Data de modificació"
@ -461,26 +443,18 @@ msgctxt "help:ir.attachment,esale_position:"
msgid "Image file position "
msgstr "Possició imatge"
msgctxt "help:product.configuration,attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opcions d'atribut per defecte quan es crea un nou producte: clau:valor | "
"clave2:valor2"
msgctxt "help:product.configuration,check_slug:"
msgid "Check slug exist in products and menus"
msgstr "Valida slug en productes i menús."
msgctxt "help:product.configuration,product_attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opcions per defecte dels atributs quan es crea un producte:\n"
"key:value|key2:value2"
msgctxt "help:product.configuration,template_attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opcions per defecte dels atributs quan es crea un producte:\n"
"key:value|key2:value2"
msgctxt "help:product.configuration,thumb_size:"
msgid "Thumbnail Product Image Size (width and height)"
msgstr "Tamany miniatura imatge (amplada i alçada)"
@ -539,22 +513,13 @@ msgstr ""
"Pot escriure amb els tags de wiki per formatejar contingut HTML. Pot "
"consultar la sintaxis Creole https://en.wikipedia.org/wiki/Creole_(markup)."
msgctxt "help:sale.configuration.product.esale,product_attribute_set_options:"
msgctxt "help:sale.configuration.product.esale,attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opcions per defecte dels atributs quan es crea un producte:\n"
"key:value|key2:value2"
msgctxt ""
"help:sale.configuration.product.esale,template_attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opcions per defecte dels atributs quan es crea un producte:\n"
"key:value|key2:value2"
"Opcions d'atribut per defecte quan es crea un nou producte: clau:valor | "
"clave2:valor2"
msgctxt "model:esale.catalog.menu,name:"
msgid "eSale Catalog Menu"
@ -584,6 +549,34 @@ msgctxt "model:ir.action,name:act_template_by_esale_catalog_menu"
msgid "Products by Menu"
msgstr "Productes per menú"
msgctxt "model:ir.message,text:delete_esale_attachment"
msgid ""
"Attachment %(attachment)s is esale active. Descheck exclude field to "
"dissable esale attachments"
msgstr ""
"L'adjunt %(attachment)s és un adjunt disponible a eSale. Desmarqueu l'opció "
"\"Actiu eSale\" per desactivar l'adjunt."
msgctxt "model:ir.message,text:delete_esale_template"
msgid ""
"Product %(product)s is esale active. Descheck active field to dissable esale"
" products."
msgstr ""
"El producte %(product)s és un producte disponible a eSale. Desmarqueu "
"l'opció \"Actiu eSale\" per desactivar el producte."
msgctxt "model:ir.message,text:not_copy"
msgid "Copy action is dissabled! Create new menu use New"
msgstr "L'acció d'exportar està desactivat. Crea un nou menú."
msgctxt "model:ir.message,text:slug_empty"
msgid "Slug field is empty!"
msgstr "El camp slug està buit."
msgctxt "model:ir.message,text:slug_exists"
msgid "Slug %(slug)s exists. Get another slug!"
msgstr " El slug %(slug)s ja existeix. Proveu amb un altre nom."
msgctxt "model:ir.ui.menu,name:menu_esale_product"
msgid "eSale Variants"
msgstr "eSale Variants"
@ -740,10 +733,6 @@ msgctxt "view:product.template:"
msgid "Prices"
msgstr "Preus"
msgctxt "view:product.template:"
msgid "Product Set"
msgstr "Grup atributs variant"
msgctxt "view:product.template:"
msgid "Relateds"
msgstr "Relacionats"

View File

@ -102,6 +102,14 @@ msgctxt "field:ir.attachment,esale_thumbnail:"
msgid "Thumbnail Image"
msgstr "Imagen miniatura"
msgctxt "field:product.configuration,attribute_set:"
msgid "Template Attribute Set"
msgstr "Grupo atributos producto"
msgctxt "field:product.configuration,attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opciones grupo atributos producto"
msgctxt "field:product.configuration,check_slug:"
msgid "Check Slug"
msgstr "Validar Slug"
@ -110,22 +118,6 @@ msgctxt "field:product.configuration,default_uom:"
msgid "Default UOM"
msgstr "UdM por defecto"
msgctxt "field:product.configuration,product_attribute_set:"
msgid "Product Attribute Set"
msgstr "Grupo atributos variante"
msgctxt "field:product.configuration,product_attribute_set_options:"
msgid "Product Attribute Set Options"
msgstr "Opciones grupo atributos variante"
msgctxt "field:product.configuration,template_attribute_set:"
msgid "Template Attribute Set"
msgstr "Grupo atributos producto"
msgctxt "field:product.configuration,template_attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opciones grupo atributos producto"
msgctxt "field:product.configuration,thumb_size:"
msgid "Thumb Size"
msgstr "Miniatura tamaño"
@ -398,6 +390,14 @@ msgctxt "field:product.template-product.upsell,write_uid:"
msgid "Write User"
msgstr "Usuario de modificación"
msgctxt "field:sale.configuration.product.esale,attribute_set:"
msgid "Template Attribute Set"
msgstr "Grupo atributos producto"
msgctxt "field:sale.configuration.product.esale,attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opciones grupo atributos producto"
msgctxt "field:sale.configuration.product.esale,company:"
msgid "Company"
msgstr "Empresa"
@ -418,28 +418,10 @@ msgctxt "field:sale.configuration.product.esale,id:"
msgid "ID"
msgstr "ID"
msgctxt "field:sale.configuration.product.esale,product_attribute_set:"
msgid "Product Attribute Set"
msgstr "Grupo de atributos de producto"
msgctxt ""
"field:sale.configuration.product.esale,product_attribute_set_options:"
msgid "Product Attribute Set Options"
msgstr "Opciones grupo atributos variante"
msgctxt "field:sale.configuration.product.esale,rec_name:"
msgid "Record Name"
msgstr "Nombre del registro"
msgctxt "field:sale.configuration.product.esale,template_attribute_set:"
msgid "Template Attribute Set"
msgstr "Grupo atributos producto"
msgctxt ""
"field:sale.configuration.product.esale,template_attribute_set_options:"
msgid "Template Attribute Set Options"
msgstr "Opciones grupo atributos producto"
msgctxt "field:sale.configuration.product.esale,write_date:"
msgid "Write Date"
msgstr "Fecha de modificación"
@ -461,26 +443,18 @@ msgctxt "help:ir.attachment,esale_position:"
msgid "Image file position "
msgstr "Posición de la imagen."
msgctxt "help:product.configuration,attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opciones de atributo predeterminadas cuando se crea un nuevo producto: "
"clave:valor | clave2:valor2"
msgctxt "help:product.configuration,check_slug:"
msgid "Check slug exist in products and menus"
msgstr "Validar Slugs en productos y menús."
msgctxt "help:product.configuration,product_attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opciones por defecto de los atributos cuando se crea un producto:\n"
"key:value|key2:value2"
msgctxt "help:product.configuration,template_attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opciones por defecto de los atributos cuando se crea un producto:\n"
"key:value|key2:value2"
msgctxt "help:product.configuration,thumb_size:"
msgid "Thumbnail Product Image Size (width and height)"
msgstr "Tamaño imagen miniatura (ancho y alto)"
@ -539,22 +513,13 @@ msgstr ""
"Puede escribir etiquetas wiki para el formateo del texto. Puede consultar la"
" sintaxis Creole a https://en.wikipedia.org/wiki/Creole_(markup)"
msgctxt "help:sale.configuration.product.esale,product_attribute_set_options:"
msgctxt "help:sale.configuration.product.esale,attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opciones por defecto de los atributos cuando se crea un producto:\n"
"key:value|key2:value2"
msgctxt ""
"help:sale.configuration.product.esale,template_attribute_set_options:"
msgid ""
"Default attribute options when create new product:\n"
"key:value|key2:value2"
msgstr ""
"Opciones por defecto de los atributos cuando se crea un producto:\n"
"key:value|key2:value2"
"Opciones de atributo predeterminadas cuando se crea un nuevo producto: "
"clave:valor | clave2:valor2"
msgctxt "model:esale.catalog.menu,name:"
msgid "eSale Catalog Menu"
@ -768,10 +733,6 @@ msgctxt "view:product.template:"
msgid "Prices"
msgstr "Precios"
msgctxt "view:product.template:"
msgid "Product Set"
msgstr "Grupo atributos variante"
msgctxt "view:product.template:"
msgid "Relateds"
msgstr "Relacionados"

View File

@ -95,20 +95,20 @@ class Template(metaclass=PoolMeta):
return 1
@staticmethod
def default_template_attribute_set():
def default_attribute_set():
'''Product Template Attribute'''
Config = Pool().get('product.configuration')
pconfig = Config(1)
if pconfig.template_attribute_set:
return pconfig.template_attribute_set.id
if pconfig.attribute_set:
return pconfig.attribute_set.id
@staticmethod
def default_template_attributes():
'''Product Template Attribute Options'''
Config = Pool().get('product.configuration')
pconfig = Config(1)
if pconfig.template_attribute_set_options:
return attribute2dict(pconfig.template_attribute_set_options)
if pconfig.attribute_set_options:
return attribute2dict(pconfig.attribute_set_options)
@staticmethod
def default_attribute_set():

View File

@ -3,14 +3,10 @@
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form" position="inside">
<label name="template_attribute_set"/>
<field name="template_attribute_set"/>
<label name="template_attribute_set_options"/>
<field name="template_attribute_set_options"/>
<label name="product_attribute_set"/>
<field name="product_attribute_set"/>
<label name="product_attribute_set_options"/>
<field name="product_attribute_set_options"/>
<label name="attribute_set"/>
<field name="attribute_set"/>
<label name="attribute_set_options"/>
<field name="attribute_set_options"/>
<label name="default_uom"/>
<field name="default_uom"/>
<label name="check_slug"/>

View File

@ -12,9 +12,6 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<label name="esale_sequence"/>
<field name="esale_sequence"/>
</page>
<page string="Attributes" id="attributes">
<field name="attributes" colspan="6"/>
</page>
<page string="General" id="general">
<label name="code"/>
<field name="code"/>

View File

@ -76,9 +76,7 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="cost_price"/>
</page>
<page string="Attributes" id="attributes">
<label name="template_attribute_set"/>
<field name="template_attribute_set"/>
<label string="Product Set" id="attribute_set"/>
<label name="attribute_set"/>
<field name="attribute_set"/>
<newline/>
<field name="template_attributes" colspan="6"/>