Task #034573: Split from product_brand to add more esale related fields
This commit is contained in:
parent
8c1c3deeb7
commit
a76654db39
2
README
2
README
|
@ -14,7 +14,7 @@ questions on the NaN·tic bug tracker, mailing list,
|
|||
wiki or IRC channel:
|
||||
|
||||
* http://doc.tryton-erp.es/
|
||||
* http://bitbucket.org/nantic/trytond-product_brand
|
||||
* http://bitbucket.org/nantic/trytond-product_brand_esale
|
||||
* http://groups.tryton.org/
|
||||
* http://wiki.tryton.org/
|
||||
* irc://irc.freenode.net/tryton
|
||||
|
|
|
@ -7,5 +7,4 @@ from . import product
|
|||
def register():
|
||||
Pool.register(
|
||||
product.Brand,
|
||||
product.Template,
|
||||
module='product_brand', type_='model')
|
||||
module='product_brand_esale', type_='model')
|
||||
|
|
44
locale/ca.po
44
locale/ca.po
|
@ -2,6 +2,14 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "error:product.brand:"
|
||||
msgid ""
|
||||
"There is another brand with the same slug. The slug of the active brands "
|
||||
"must be unique!"
|
||||
msgstr ""
|
||||
"Hi ha una altre marca amb el mateix slug. L'slug de les marques actives ha "
|
||||
"de ser únic!"
|
||||
|
||||
msgctxt "field:product.brand,create_date:"
|
||||
msgid "Create Date"
|
||||
msgstr "Data creació"
|
||||
|
@ -10,10 +18,26 @@ msgctxt "field:product.brand,create_uid:"
|
|||
msgid "Create User"
|
||||
msgstr "Usuari creació"
|
||||
|
||||
msgctxt "field:product.brand,description:"
|
||||
msgid "Brand Description"
|
||||
msgstr "Descripció de la marca"
|
||||
|
||||
msgctxt "field:product.brand,id:"
|
||||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "field:product.brand,metadescription:"
|
||||
msgid "Meta Description"
|
||||
msgstr "Meta Description"
|
||||
|
||||
msgctxt "field:product.brand,metakeywords:"
|
||||
msgid "Meta Keywords"
|
||||
msgstr "Meta Keywords"
|
||||
|
||||
msgctxt "field:product.brand,metatitle:"
|
||||
msgid "Meta Title"
|
||||
msgstr "Meta Title"
|
||||
|
||||
msgctxt "field:product.brand,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
@ -22,6 +46,14 @@ msgctxt "field:product.brand,rec_name:"
|
|||
msgid "Name"
|
||||
msgstr "Nom"
|
||||
|
||||
msgctxt "field:product.brand,slug:"
|
||||
msgid "Slug"
|
||||
msgstr "Slug"
|
||||
|
||||
msgctxt "field:product.brand,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "field:product.brand,write_date:"
|
||||
msgid "Write Date"
|
||||
msgstr "Data modificació"
|
||||
|
@ -34,11 +66,19 @@ msgctxt "field:product.template,brand:"
|
|||
msgid "Brand"
|
||||
msgstr "Marca"
|
||||
|
||||
msgctxt "model:ir.action,name:act_product_brand"
|
||||
msgctxt "help:product.brand,metadescription:"
|
||||
msgid ""
|
||||
"Almost all search engines recommend it to be shorter than 155 characters of "
|
||||
"plain text"
|
||||
msgstr ""
|
||||
"La majoria de motors de cerca recomanen que sigui menor de 155 caracters de "
|
||||
"text plà"
|
||||
|
||||
msgctxt "model:ir.action,name:"
|
||||
msgid "Brands"
|
||||
msgstr "Marques"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_product_brand"
|
||||
msgctxt "model:ir.ui.menu,name:"
|
||||
msgid "Brands"
|
||||
msgstr "Marques"
|
||||
|
||||
|
|
40
locale/es.po
40
locale/es.po
|
@ -2,6 +2,14 @@
|
|||
msgid ""
|
||||
msgstr "Content-Type: text/plain; charset=utf-8\n"
|
||||
|
||||
msgctxt "error:product.brand:"
|
||||
msgid ""
|
||||
"There is another brand with the same slug. The slug of the active brands "
|
||||
"must be unique!"
|
||||
msgstr ""
|
||||
"Hay otra marca con el mismo slug. El slug de las marcas activas debe ser "
|
||||
"único!"
|
||||
|
||||
msgctxt "field:product.brand,create_date:"
|
||||
msgid "Create Date"
|
||||
msgstr "Fecha creación"
|
||||
|
@ -14,6 +22,18 @@ msgctxt "field:product.brand,id:"
|
|||
msgid "ID"
|
||||
msgstr "ID"
|
||||
|
||||
msgctxt "field:product.brand,metadescription:"
|
||||
msgid "Meta Description"
|
||||
msgstr "Meta Description"
|
||||
|
||||
msgctxt "field:product.brand,metakeywords:"
|
||||
msgid "Meta Keywords"
|
||||
msgstr "Meta Keywords"
|
||||
|
||||
msgctxt "field:product.brand,metatitle:"
|
||||
msgid "Meta Title"
|
||||
msgstr "Meta Title"
|
||||
|
||||
msgctxt "field:product.brand,name:"
|
||||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
@ -22,6 +42,14 @@ msgctxt "field:product.brand,rec_name:"
|
|||
msgid "Name"
|
||||
msgstr "Nombre"
|
||||
|
||||
msgctxt "field:product.brand,slug:"
|
||||
msgid "Slug"
|
||||
msgstr "Slug"
|
||||
|
||||
msgctxt "field:product.brand,url:"
|
||||
msgid "URL"
|
||||
msgstr "URL"
|
||||
|
||||
msgctxt "field:product.brand,write_date:"
|
||||
msgid "Write Date"
|
||||
msgstr "Fecha modificación"
|
||||
|
@ -34,11 +62,19 @@ msgctxt "field:product.template,brand:"
|
|||
msgid "Brand"
|
||||
msgstr "Marca"
|
||||
|
||||
msgctxt "model:ir.action,name:act_product_brand"
|
||||
msgctxt "help:product.brand,metadescription:"
|
||||
msgid ""
|
||||
"Almost all search engines recommend it to be shorter than 155 characters of "
|
||||
"plain text"
|
||||
msgstr ""
|
||||
"La mayoría de los motores de búsqueda recomiendan un texto plano de no más "
|
||||
"de 155 caracteres."
|
||||
|
||||
msgctxt "model:ir.action,name:"
|
||||
msgid "Brands"
|
||||
msgstr "Marcas"
|
||||
|
||||
msgctxt "model:ir.ui.menu,name:menu_product_brand"
|
||||
msgctxt "model:ir.ui.menu,name:"
|
||||
msgid "Brands"
|
||||
msgstr "Marcas"
|
||||
|
||||
|
|
32
product.py
32
product.py
|
@ -1,22 +1,23 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
from trytond.model import ModelView, ModelSQL, fields, Unique
|
||||
from trytond.model import fields, Unique
|
||||
from trytond.pool import PoolMeta
|
||||
|
||||
from trytond.modules.product.product import STATES, DEPENDS
|
||||
from slug import slug
|
||||
|
||||
__all__ = ['Brand', 'Template']
|
||||
__all__ = ['Brand']
|
||||
|
||||
|
||||
class Brand(ModelSQL, ModelView):
|
||||
'''Brand'''
|
||||
class Brand:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'product.brand'
|
||||
name = fields.Char('Name', required=True, translate=True)
|
||||
active = fields.Boolean('Active')
|
||||
url = fields.Char('URL', translate=True)
|
||||
slug = fields.Char('Slug', translate=True)
|
||||
products = fields.One2Many('product.template', 'brand', 'Products')
|
||||
metadescription = fields.Char('Meta Description', translate=True,
|
||||
help=('Almost all search engines recommend it to be shorter than 155 '
|
||||
'characters of plain text'))
|
||||
metakeywords = fields.Char('Meta Keywords', translate=True)
|
||||
metatitle = fields.Char('Meta Title', translate=True)
|
||||
|
||||
@classmethod
|
||||
def __setup__(cls):
|
||||
|
@ -24,24 +25,13 @@ class Brand(ModelSQL, ModelView):
|
|||
t = cls.__table__()
|
||||
cls._sql_constraints += [
|
||||
('slug_uniq', Unique(t, t.active, t.slug),
|
||||
'There is another brand with the same slug.\n'
|
||||
'The slug of the active brands must be unique!'),
|
||||
('There is another brand with the same slug. The slug of the '
|
||||
'active brands must be unique!')),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def default_active():
|
||||
return True
|
||||
|
||||
@fields.depends('name', 'slug', 'active')
|
||||
def on_change_with_slug(self):
|
||||
if self.name and not self.slug and self.active:
|
||||
return slug(self.name)
|
||||
else:
|
||||
return self.slug
|
||||
|
||||
|
||||
class Template:
|
||||
__name__ = 'product.template'
|
||||
__metaclass__ = PoolMeta
|
||||
brand = fields.Many2One('product.brand', 'Brand', states=STATES,
|
||||
depends=DEPENDS)
|
||||
|
|
50
product.xml
50
product.xml
|
@ -3,58 +3,10 @@
|
|||
copyright notices and license terms. -->
|
||||
<tryton>
|
||||
<data>
|
||||
<!-- product.template -->
|
||||
<record model="ir.ui.view" id="template_view_form">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit" ref="product.template_view_form"/>
|
||||
<field name="name">template_form</field>
|
||||
</record>
|
||||
|
||||
<!-- product.brand -->
|
||||
<record model="ir.ui.view" id="product_brand_view_form">
|
||||
<field name="model">product.brand</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit" ref="product_brand.product_brand_view_form"/>
|
||||
<field name="name">product_brand_form</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="product_brand_view_list">
|
||||
<field name="model">product.brand</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="name">product_brand_list</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.action.act_window" id="act_product_brand">
|
||||
<field name="name">Brands</field>
|
||||
<field name="res_model">product.brand</field>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_product_brand_view1">
|
||||
<field name="sequence" eval="10"/>
|
||||
<field name="view" ref="product_brand_view_list"/>
|
||||
<field name="act_window" ref="act_product_brand"/>
|
||||
</record>
|
||||
<record model="ir.action.act_window.view" id="act_product_brand_view2">
|
||||
<field name="sequence" eval="20"/>
|
||||
<field name="view" ref="product_brand_view_form"/>
|
||||
<field name="act_window" ref="act_product_brand"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.model.access" id="access_product_brand">
|
||||
<field name="model" search="[('model', '=', 'product.brand')]"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="False"/>
|
||||
<field name="perm_create" eval="False"/>
|
||||
<field name="perm_delete" eval="False"/>
|
||||
</record>
|
||||
<record model="ir.model.access" id="access_product_brand_admin">
|
||||
<field name="model" search="[('model', '=', 'product.brand')]"/>
|
||||
<field name="group" ref="product.group_product_admin"/>
|
||||
<field name="perm_read" eval="True"/>
|
||||
<field name="perm_write" eval="True"/>
|
||||
<field name="perm_create" eval="True"/>
|
||||
<field name="perm_delete" eval="True"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="act_product_brand" id="menu_product_brand"
|
||||
parent="product.menu_configuration" sequence="50"/>
|
||||
</data>
|
||||
</tryton>
|
||||
|
|
2
setup.py
2
setup.py
|
@ -10,7 +10,7 @@ try:
|
|||
except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
MODULE = 'product_brand'
|
||||
MODULE = 'product_brand_esale'
|
||||
PREFIX = 'nantic'
|
||||
MODULE2PREFIX = {}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
# The COPYRIGHT file at the top level of this repository contains the full
|
||||
# copyright notices and license terms.
|
||||
try:
|
||||
from trytond.modules.product_brand.tests.test_product_brand import suite
|
||||
from trytond.modules.product_brand_esale.tests.test_product_brand_esale import suite
|
||||
except ImportError:
|
||||
from .test_product_brand import suite
|
||||
from .test_product_brand_esale import suite
|
||||
|
||||
__all__ = ['suite']
|
||||
|
|
|
@ -8,7 +8,7 @@ from trytond.tests.test_tryton import ModuleTestCase
|
|||
|
||||
class TestCase(ModuleTestCase):
|
||||
'Test module'
|
||||
module = 'product_brand'
|
||||
module = 'product_brand_esale'
|
||||
|
||||
|
||||
def suite():
|
|
@ -1,6 +1,6 @@
|
|||
[tryton]
|
||||
version=4.9.0
|
||||
depends:
|
||||
product
|
||||
product_brand
|
||||
xml:
|
||||
product.xml
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<form>
|
||||
<label name="name"/>
|
||||
<field name="name"/>
|
||||
<label name="active"/>
|
||||
<field name="active"/>
|
||||
<label name="url"/>
|
||||
<field name="url"/>
|
||||
<label name="slug"/>
|
||||
<field name="slug"/>
|
||||
<field name="products" colspan="4" widget="many2many"/>
|
||||
</form>
|
||||
<data>
|
||||
<xpath expr="//field[@name='active']" position="after">
|
||||
<label name="url"/>
|
||||
<field name="url"/>
|
||||
<label name="slug"/>
|
||||
<field name="slug"/>
|
||||
<label name="metatitle"/>
|
||||
<field name="metatitle"/>
|
||||
<label name="metakeywords"/>
|
||||
<field name="metakeywords"/>
|
||||
<label name="metadescription"/>
|
||||
<field name="metadescription" colspan="3"/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- The COPYRIGHT file at the top level of this repository contains the full
|
||||
copyright notices and license terms. -->
|
||||
<tree>
|
||||
<field name="active"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!-- 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='general']/field[@name='cost_price_method']"
|
||||
position="after">
|
||||
<label name="brand"/>
|
||||
<field name="brand"/>
|
||||
</xpath>
|
||||
</data>
|
Loading…
Reference in New Issue