parent
3871dc7e2e
commit
0386c6ab37
32
__init__.py
32
__init__.py
|
@ -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')
|
||||
|
|
|
@ -7,10 +7,10 @@ from trytond.transaction import Transaction
|
|||
from trytond.pyson import Eval
|
||||
|
||||
__all__ = ['GalateaWebSite', 'GalateaUser']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class GalateaWebSite:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = "galatea.website"
|
||||
esale_menu = fields.Many2One('esale.catalog.menu', 'Main Menu', required=True,
|
||||
help='Main menu product catalog')
|
||||
|
@ -30,6 +30,7 @@ class GalateaWebSite:
|
|||
|
||||
|
||||
class GalateaUser:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = "galatea.user"
|
||||
invoice_address = fields.Many2One('party.address', 'Invoice Address',
|
||||
domain=[('party', '=', Eval('party')), ('invoice', '=', True)],
|
||||
|
@ -50,7 +51,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
|
||||
|
@ -58,7 +59,7 @@ class GalateaUser:
|
|||
('sale', '=', None),
|
||||
]
|
||||
if session: # login user. Filter sid or user
|
||||
domain.append(['OR',
|
||||
domain.append(['OR',
|
||||
('sid', '=', session),
|
||||
('galatea_user', '=', user),
|
||||
])
|
||||
|
|
2
menu.py
2
menu.py
|
@ -5,10 +5,10 @@ from trytond.model import fields
|
|||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['CatalogMenu']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class CatalogMenu:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'esale.catalog.menu'
|
||||
website = fields.Many2One('galatea.website', 'Website')
|
||||
|
||||
|
|
|
@ -6,10 +6,10 @@ from trytond.pool import PoolMeta
|
|||
from trytond.pyson import Eval
|
||||
|
||||
__all__ = ['PaymentType']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class PaymentType:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'account.payment.type'
|
||||
esale_payment = fields.Boolean('Virtual Payment')
|
||||
esale_code = fields.Char('Code App Payment', states={
|
||||
|
|
16
product.py
16
product.py
|
@ -7,13 +7,24 @@ from trytond.pyson import Eval
|
|||
from trytond.transaction import Transaction
|
||||
from trytond.config import config as config_
|
||||
|
||||
__all__ = ['Template', 'Product']
|
||||
__metaclass__ = PoolMeta
|
||||
__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'
|
||||
esale_new = fields.Boolean('New', help='Icon New product')
|
||||
esale_hot = fields.Boolean('Hot', help='Icon Hot product')
|
||||
|
@ -52,6 +63,7 @@ class Template:
|
|||
|
||||
|
||||
class Product:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'product.product'
|
||||
add_cart = fields.Boolean('Add Cart', states={
|
||||
'readonly': ~Eval('active', True),
|
||||
|
|
|
@ -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>
|
||||
|
|
3
sale.py
3
sale.py
|
@ -6,10 +6,10 @@ from trytond.model import fields
|
|||
from trytond.pyson import Eval, Not, Bool, And
|
||||
|
||||
__all__ = ['Sale', 'SaleLine']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class Sale:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'sale.sale'
|
||||
galatea_user = fields.Many2One('galatea.user', 'Galatea User',
|
||||
readonly=True)
|
||||
|
@ -25,6 +25,7 @@ class Sale:
|
|||
|
||||
|
||||
class SaleLine:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'sale.line'
|
||||
sid = fields.Char('Session')
|
||||
galatea_user = fields.Many2One('galatea.user', 'Galatea User', readonly=True)
|
||||
|
|
2
shop.py
2
shop.py
|
@ -4,10 +4,10 @@
|
|||
from trytond.pool import PoolMeta
|
||||
|
||||
__all__ = ['SaleShop']
|
||||
__metaclass__ = PoolMeta
|
||||
|
||||
|
||||
class SaleShop:
|
||||
__metaclass__ = PoolMeta
|
||||
__name__ = 'sale.shop'
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -7,6 +7,7 @@ depends:
|
|||
product_esale
|
||||
sale_line_standalone
|
||||
extras_depend:
|
||||
product_esale_categories
|
||||
sale_pos
|
||||
xml:
|
||||
galatea.xml
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue