Catalog Menu. Add website

This commit is contained in:
resteve 2014-10-06 09:22:02 +02:00
parent 8ee5cd2af4
commit 6089af9c0b
7 changed files with 73 additions and 0 deletions

View File

@ -3,6 +3,7 @@
#the full copyright notices and license terms.
from trytond.pool import Pool
from .galatea import *
from .menu import *
from .sale_cart import *
from .shop import *
from .product import *
@ -10,6 +11,7 @@ from .payment_type import *
def register():
Pool.register(
CatalogMenu,
GalateaWebSite,
GalateaUser,
PaymentType,

20
menu.py Normal file
View File

@ -0,0 +1,20 @@
#This file is part galatea_esale module for Tryton.
#The COPYRIGHT file at the top level of this repository contains
#the full copyright notices and license terms.
from trytond.model import fields
from trytond.pool import PoolMeta
__all__ = ['CatalogMenu']
__metaclass__ = PoolMeta
class CatalogMenu:
__name__ = 'esale.catalog.menu'
website = fields.Many2One('galatea.website', 'Website')
@fields.depends('parent')
def on_change_with_website(self):
"""Add website from parent"""
if self.parent and self.parent.website:
return self.parent.website.id
return None

25
menu.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!-- This file is part galatea_esale module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="ir.ui.view" id="menu_view_list">
<field name="model">esale.catalog.menu</field>
<field name="type">tree</field>
<field name="inherit" ref="product_esale.menu_view_list"/>
<field name="name">menu_list</field>
</record>
<record model="ir.ui.view" id="menu_view_tree">
<field name="model">esale.catalog.menu</field>
<field name="type">tree</field>
<field name="inherit" ref="product_esale.menu_view_tree"/>
<field name="name">menu_tree</field>
</record>
<record model="ir.ui.view" id="menu_view_form">
<field name="model">esale.catalog.menu</field>
<field name="type">form</field>
<field name="inherit" ref="product_esale.menu_view_form"/>
<field name="name">menu_form</field>
</record>
</data>
</tryton>

View File

@ -9,5 +9,6 @@ depends:
sale_payment_web
xml:
galatea.xml
menu.xml
payment_type.xml
product.xml

9
view/menu_form.xml Normal file
View File

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part galatea_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/field[@name=&quot;rec_name&quot;]" position="after">
<label name="website"/>
<field name="website"/>
</xpath>
</data>

8
view/menu_list.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part galatea_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="/tree/field[@name=&quot;active&quot;]" position="after">
<field name="website"/>
</xpath>
</data>

8
view/menu_tree.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0"?>
<!-- This file is part galatea_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="/tree/field[@name=&quot;default_sort_by&quot;]" position="after">
<field name="website"/>
</xpath>
</data>