Move product_template_attribute module to extra_depends. (#1)

Task #060498
This commit is contained in:
juanjo-nan 2022-07-27 12:50:49 +02:00 committed by Juanjo Garcia
parent 46fd5a344d
commit 9852334153
7 changed files with 27 additions and 9 deletions

View File

@ -9,8 +9,6 @@ from . import product
def register():
Pool.register(
configuration.Configuration,
configuration.ConfigurationProductESale,
attachment.Attachment,
menu.CatalogMenu,
product.Template,
@ -20,3 +18,8 @@ def register():
product.ProductUpSell,
product.ProductCrossSell,
module='product_esale', type_='model')
Pool.register(
configuration.Configuration,
configuration.ConfigurationProductESale,
module='product_esale', type_='model',
depends=['product_template_attribute'])

View File

@ -2,7 +2,7 @@
<!-- This file is part product_esale module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<data depends="product_template_attribute">
<record model="ir.ui.view" id="product_configuration_view_form">
<field name="model">product.configuration</field>
<field name="inherit" ref="product.product_configuration_view_form"/>

View File

@ -99,7 +99,7 @@ class Template(metaclass=PoolMeta):
'''Product Template Attribute'''
Config = Pool().get('product.configuration')
pconfig = Config(1)
if pconfig.attribute_set:
if hasattr(pconfig, 'attribute_set') and pconfig.attribute_set:
return pconfig.attribute_set.id
@staticmethod
@ -107,7 +107,7 @@ class Template(metaclass=PoolMeta):
'''Default UOM'''
Config = Pool().get('product.configuration')
config = Config(1)
if config.default_uom:
if hasattr(config, 'default_uom') and config.default_uom:
return config.default_uom.id
@fields.depends('name', 'esale_slug')
@ -361,7 +361,8 @@ class Product(metaclass=PoolMeta):
'''Product Attribute Options'''
Config = Pool().get('product.configuration')
pconfig = Config(1)
if pconfig.attribute_set_options:
if (hasattr(pconfig, 'attribute_set_options') and
pconfig.attribute_set_options):
return attribute2dict(pconfig.attribute_set_options)
@classmethod

View File

@ -166,4 +166,11 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="name">esale_template_purchase_form</field>
</record>
</data>
<data depends="product_template_attribute">
<record model="ir.ui.view" id="esale_template_template_attributes">
<field name="model">product.template</field>
<field name="inherit" ref="esale_template_view_form"/>
<field name="name">esale_template_template_attributes_form</field>
</record>
</data>
</tryton>

View File

@ -4,13 +4,13 @@ depends:
ir
product_attachments
product
product_template_attribute
product_variant_unique
esale
sale
extras_depend:
product_manufacturer
product_review
product_template_attribute
xml:
configuration.xml
attachment.xml

View File

@ -78,8 +78,6 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<page string="Attributes" id="attributes">
<label name="attribute_set"/>
<field name="attribute_set"/>
<newline/>
<field name="template_attributes" colspan="6"/>
</page>
<page string="General" id="general">
<label name="type"/>

View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part product_esale module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook/page[@id='attributes']/field[@name='attribute_set']" position="before">
<newline/>
<field name="template_attributes" colspan="6"/>
</xpath>
</data>