Add esale category menu in galatea website

task-030701
This commit is contained in:
Raimon Esteve 2018-04-17 11:23:56 +02:00
commit b16df8f93c
9 changed files with 75 additions and 23 deletions

View File

@ -2,22 +2,24 @@
# The COPYRIGHT file at the top level of this repository contains
# the full copyright notices and license terms.
from trytond.pool import Pool
from .galatea import *
from .menu import *
from .sale import *
from .shop import *
from .product import *
from .payment_type import *
from . import galatea
from . import menu
from . import sale
from . import shop
from . import product
from . import payment_type
def register():
Pool.register(
CatalogMenu,
GalateaWebSite,
GalateaUser,
PaymentType,
Sale,
SaleLine,
SaleShop,
Template,
Product,
menu.CatalogMenu,
galatea.GalateaWebSite,
galatea.GalateaUser,
payment_type.PaymentType,
sale.Sale,
sale.SaleLine,
shop.SaleShop,
product.Category,
product.Template,
product.Product,
module='galatea_esale', type_='model')

View File

@ -13,7 +13,7 @@ class GalateaWebSite:
__metaclass__ = PoolMeta
__name__ = "galatea.website"
esale_menu = fields.Many2One('esale.catalog.menu', 'Main Menu', required=True,
help='Main menu product catalog')
help='Main menu of product catalog')
esale_stock = fields.Boolean('Stock',
help='Manage Stock')
esale_stock_qty = fields.Selection([
@ -23,6 +23,10 @@ class GalateaWebSite:
'invisible': ~Eval('esale_stock', True),
},
help='Manage Stock is Product Quantity or Product Forecast Quantity')
esale_category_menu = fields.Many2One('product.category',
'Catalog Category Menu', domain=[
('esale_active', '=', True),
], help='Main menu of catalog category')
@staticmethod
def default_esale_stock_qty():
@ -51,7 +55,7 @@ class GalateaUser:
Product = pool.get('product.product')
Shop = pool.get('sale.shop')
SaleLine = pool.get('sale.line')
user = User(user)
# not filter by shop. Update all current carts
@ -59,7 +63,7 @@ class GalateaUser:
('sale', '=', None),
]
if session: # login user. Filter sid or user
domain.append(['OR',
domain.append(['OR',
('sid', '=', session),
('galatea_user', '=', user),
])

View File

@ -7,19 +7,19 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<record model="ir.ui.view" id="website_view_form">
<field name="model">galatea.website</field>
<field name="inherit" ref="galatea.website_view_form"/>
<field name="name">website_form</field>
<field name="name">website_form</field>
</record>
<!-- User -->
<record model="ir.ui.view" id="galatea_user_form2">
<field name="model">galatea.user</field>
<field name="inherit" ref="galatea.galatea_user_form2"/>
<field name="name">galatea_user_form</field>
<field name="name">galatea_user_form</field>
</record>
<record model="ir.ui.view" id="galatea_user_tree">
<field name="model">galatea.user</field>
<field name="inherit" ref="galatea.galatea_user_tree"/>
<field name="name">galatea_user_tree</field>
<field name="name">galatea_user_tree</field>
</record>
<!-- Access -->
@ -86,4 +86,11 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="perm_delete" eval="False"/>
</record>
</data>
<data depends="product_esale_categories">
<record model="ir.ui.view" id="website_category_view_form">
<field name="model">galatea.website</field>
<field name="inherit" ref="galatea.website_view_form"/>
<field name="name">website_category_form</field>
</record>
</data>
</tryton>

View File

@ -7,11 +7,22 @@ from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.config import config as config_
__all__ = ['Template', 'Product']
__all__ = ['Category', 'Template', 'Product']
DIGITS = config_.getint('product', 'price_decimal', default=4)
class Category:
__metaclass__ = PoolMeta
__name__ = "product.category"
@classmethod
def __setup__(cls):
super(Category, cls).__setup__()
if hasattr(cls, 'esale_active'):
cls.website = fields.Many2One('galatea.website', 'Website')
class Template:
__metaclass__ = PoolMeta
__name__ = 'product.template'

View File

@ -24,4 +24,11 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<field name="name">esale_product_form</field>
</record>
</data>
<data depends="product_esale_categories">
<record model="ir.ui.view" id="category_view_form">
<field name="model">product.category</field>
<field name="inherit" ref="product.category_view_form"/>
<field name="name">category_form</field>
</record>
</data>
</tryton>

View File

@ -5,7 +5,6 @@ The COPYRIGHT file at the top level of this repository contains the full copyrig
<data>
<record model="ir.ui.view" id="sale_view_form">
<field name="model">sale.sale</field>
<field name="type" eval="None"/>
<field name="inherit" ref="sale.sale_view_form"/>
<field name="name">sale_form</field>
</record>

View File

@ -7,6 +7,7 @@ depends:
product_esale
sale_line_standalone
extras_depend:
product_esale_categories
sale_pos
xml:
galatea.xml

11
view/category_form.xml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<!-- This file is part of 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='esale']/notebook/page[@id='esale-general']/field[@name='include_in_menu']"
position="after">
<label name="website"/>
<field name="website"/>
</xpath>
</data>

View File

@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!-- This file is part of galatea_esale module for Tryton.
The COPYRIGHT file at the top level of this repository contains the full
copyright notices and license types. -->
<data>
<xpath expr="/form/notebook/page[@id='configuration']" position="inside">
<label name="esale_category_menu"/>
<field name="esale_category_menu"/>
</xpath>
</data>