Skip to content

Commit

Permalink
Добавлена тема клиента, YA Market, исправлен CountDown
Browse files Browse the repository at this point in the history
  • Loading branch information
VbossEkat committed May 10, 2016
1 parent 286b15c commit 1d8f4f4
Show file tree
Hide file tree
Showing 28 changed files with 459 additions and 5 deletions.
8 changes: 8 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ encoding//pofatt/__openerp__.py=utf-8
encoding//pofatt/models/models.py=utf-8
encoding//pofatt_work_rezerve20160122/__openerp__.py=utf-8
encoding//pofatt_work_rezerve20160122/models/models.py=utf-8
encoding//product_image_from_url/__openerp__.py=utf-8
encoding//product_image_from_url/models/product.py=utf-8
encoding//sba_client_theme/__init__.py=utf-8
encoding//sba_client_theme/__openerp__.py=utf-8
encoding//sba_countdown/__init__.py=utf-8
Expand All @@ -12,10 +14,15 @@ encoding//sba_countdown/models/__init__.py=utf-8
encoding//sba_countdown/models/countdown.py=utf-8
encoding//sba_mail_send/mail_mail_inh.py=utf-8
encoding//sba_resurce/__openerp__.py=utf-8
encoding//sba_resurce/models/models.py=utf-8
encoding//sba_snippet_contact/__init__.py=utf-8
encoding//sba_snippet_contact/__openerp__.py=utf-8
encoding//sba_snippet_contact/controllers/__init__.py=utf-8
encoding//sba_snippet_contact/controllers/main.py=utf-8
encoding//sba_ya/__init__.py=utf-8
encoding//sba_ya/__openerp__.py=utf-8
encoding//sba_ya/models/__init__.py=utf-8
encoding//sba_ya/models/models.py=utf-8
encoding//sba_ya_connect/__init__.py=utf-8
encoding//sba_ya_connect/__openerp__.py=utf-8
encoding//sba_ya_connect/backend.py=utf-8
Expand All @@ -32,5 +39,6 @@ encoding//sba_ya_connect/unit/backend_adapter.py=utf-8
encoding//sba_ya_connect/unit/binder.py=utf-8
encoding//sba_ya_connect/unit/import_synchronizer.py=utf-8
encoding//sba_ya_connect/unit/mapper.py=utf-8
encoding//se_attrib1/__openerp__.py=utf-8
encoding//se_attrib1/models.py=utf-8
encoding//se_attrib1/se_partner_tst.py=utf-8
3 changes: 3 additions & 0 deletions product_image_from_url/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# -*- coding: utf-8 -*-
import models
#import import_product_images
Binary file added product_image_from_url/__init__.pyc
Binary file not shown.
35 changes: 35 additions & 0 deletions product_image_from_url/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
{
'name': "Import Product Images From URL",
'summary': """
Get product images from url""",
'description': """
This module offers a way to import product images from urls.
Simply import the url of the product image in the Image Url field.
Then select the images and download images. This supports batch processing.
""",
'author': "Explore Data Systems",
'website': "http://www.exploredatasystems.com",
'category': 'Extra Tools',
#Change the version every release for apps.
'version': '0.1',
#the cost of the module in EUR
'price' : 20,
'currency': 'EUR',
# any module necessary for this one to work correctly
'depends': [
'product',
],
# always loaded
'data': [
'views/product_view.xml',
'views/product_actions.xml',
],
# only loaded in demonstration mode
'demo': [
#'demo/demo.xml',
],
# only loaded in test
'test': [
],
}
2 changes: 2 additions & 0 deletions product_image_from_url/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
import product
Binary file added product_image_from_url/models/__init__.pyc
Binary file not shown.
65 changes: 65 additions & 0 deletions product_image_from_url/models/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -*- coding: utf-8 -*-
##############################################################################
#
##############################################################################
import base64#file encode
import urllib2 #file download from url
import httplib

from openerp.osv import fields, osv
import openerp.addons.decimal_precision as dp
import logging

_logger = logging.getLogger(__name__)

class product_template(osv.osv):
_inherit = "product.template"
_columns = {
'web':fields.char('Image url', help='Automatically sanitized HTML contents'),
}
def onchange_image(self,cr,uid,ids,web,context=None):
link=web
if link and link!='':
try:
photo = base64.encodestring(urllib2.urlopen(link, timeout=10).read())
val={
'image_medium':photo,
}
return {'value': val}
except urllib2.HTTPError, e:
_logger.error('HTTPError = ' + str(e.code)+' when processing this request')
except urllib2.URLError, e:
_logger.error('URLError = ' + str(e.reason)+' when processing this request')
except httplib.HTTPException, e:
_logger.error('HTTPException'+' when processing product id this request')
except Exception:
import traceback
_logger.error('generic exception: ' + traceback.format_exc()+' when processing this request')
return True

def download_product_image(self,cr,uid,ids,context=None):
for product in self.browse(cr, uid, ids, context=context):
link = product.web
if link and link!='':
try:
photo = base64.encodestring(urllib2.urlopen(link, timeout=10).read())
val={
'image_medium':photo,
}
product.write(val)
except urllib2.HTTPError, e:
_logger.error('HTTPError = ' + str(e.code)+' when processing product id: '+str(product.id))
continue
except urllib2.URLError, e:
_logger.error('URLError = ' + str(e.reason)+' when processing product id: '+str(product.id))
continue
except httplib.HTTPException, e:
_logger.error('HTTPException'+' when processing product id: '+str(product.id))
continue
except Exception:
import traceback
_logger.error('generic exception: ' + traceback.format_exc()+' when processing product id: '+str(product.id))
continue
return True

product_template()
Binary file added product_image_from_url/models/product.pyc
Binary file not shown.
33 changes: 33 additions & 0 deletions product_image_from_url/static/description/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<div class="oe_span12">
<h2 class="oe_slogan">Import Product Images From URL</h2>
<h3 class="oe_slogan">download and import product images from url</h3>
</div>
<div class="oe_span6">
<div class="oe_demo oe_picture oe_screenshot">
<img src="screenshot1.png">
<div class="oe_demo_footer oe_centeralign">Select Images, More> Download Image</div>
</div>
</div>
<div class="oe_span6">
<p class="oe_mt32">
Many times you will want to import products from other systems using the odoo import feature. Odoo however does
not offer an out-of-the-box feature to import image urls in url.
Using this module you can import the image urls of your products and then download them in batch.
Simply
<ol class="simple">
<li>Add 'Image URL' column in your csv/excel import file</li>
<li>Import your products</li>
<li>Select all products in products list view</li>
<li>Click on More>Download Images</li>
</ol>
</p>
<div class="oe_centeralign oe_websiteonly">
Feel Free to <a href="mailto:[email protected]" class="oe_button oe_big oe_tacky">Contact Us</a> for support.
</div>
</div>
</div>
</section>


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added product_image_from_url/static/src/img/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions product_image_from_url/views/menu.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record model="ir.ui.menu" id="menu_database_cleanup">
<field name="name">Database cleanup</field>
<field name="sequence" eval="10" />
<!-- attach to Settings -> Technical -->
<field name="parent_id" ref="base.menu_custom"/>
</record>

<record model="ir.ui.menu" id="menu_purge_modules">
<field name="name">Purge obsolete modules</field>
<field name="sequence" eval="10" />
<field name="action" ref="action_purge_modules" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>

<record model="ir.ui.menu" id="menu_purge_models">
<field name="name">Purge obsolete models</field>
<field name="sequence" eval="20" />
<field name="action" ref="action_purge_models" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>

<record model="ir.ui.menu" id="menu_purge_columns">
<field name="name">Purge obsolete columns</field>
<field name="sequence" eval="30" />
<field name="action" ref="action_purge_columns" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>

<record model="ir.ui.menu" id="menu_purge_tables">
<field name="name">Purge obsolete tables</field>
<field name="sequence" eval="40" />
<field name="action" ref="action_purge_tables" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>

<record model="ir.ui.menu" id="menu_purge_data">
<field name="name">Purge obsolete data entries</field>
<field name="sequence" eval="50" />
<field name="action" ref="action_purge_data" />
<field name="parent_id" ref="menu_database_cleanup"/>
</record>

</data>
</openerp>
23 changes: 23 additions & 0 deletions product_image_from_url/views/product_actions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<record id="action_download_product_image" model="ir.actions.server">
<field name="name">Download Image</field>
<field name="model_id" ref="product.model_product_template"/>
<field name="state">code</field>
<field name="code">
if context.get('active_model') == 'product.template' and context.get('active_ids'):
self.download_product_image(cr,uid,context.get('active_ids', []), context=context)
</field>
</record>

<record id="ir_download_product_image" model="ir.values">
<field eval="'client_action_multi'" name="key2"/>
<field eval="'product.template'" name="model"/>
<field name="name">Download Image</field>
<field eval="'ir.actions.server,%d'%action_download_product_image" name="value"/>
</record>

</data>
</openerp>
20 changes: 20 additions & 0 deletions product_image_from_url/views/product_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>

<!-- Product view modification -->
<record model="ir.ui.view" id="product_template_url_field">
<field name="name">product.template.url</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<field name="list_price" position="after">
<field name="web" widget="url" on_change="onchange_image(web,context)"/>
</field>
</field>
</record>


</data>
</openerp>

2 changes: 1 addition & 1 deletion sba_client_theme/__openerp__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"website" : "sba.ralstore.ru",
"category" : "Custom",
"licence" : "AGPL-3",
"description": """
"summary": """
Sba_Client_Theme
====================================
Настройка внешнего вида клиента
Expand Down
64 changes: 64 additions & 0 deletions sba_client_theme/static/src/css/sba_client_style.css
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,67 @@
margin-left: 8px;
color: #413F98;
}


/* верхний заголовок*/
.openerp .oe_view_manager_current > .oe_view_manager_header {
background-color: #ededed;
background-image: linear-gradient(to bottom, #fcfcfc, #ccd95e); //linear-gradient(to bottom, #fcfcfc, #dedede);
border-bottom: 1px solid #cacaca;
box-shadow: 0 1px 0 rgba(255, 255, 255, 0.4), 0 0 9px rgba(0, 0, 0, 0.1);
}
/*Левое меню*/
.openerp .oe_leftbar {
background: #e0e89d none repeat scroll 0 0; // #f0eeee none repeat scroll 0 0;
border-right: 1px solid #afafb6;
display: none;
text-shadow: none;
width: 220px;
}
/* Основное поле*/
.openerp .oe_searchview {
cursor: text;
position: relative;
float: right;
padding: 1px 0;
line-height: 18px;
min-width: 400px;
border: 1px solid #ababab;
background: rgba(246, 253, 187, 0.54); //white;
-moz-border-radius: 13px;
-webkit-border-radius: 13px;
border-radius: 13px;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) inset;
}

.openerp .oe_mail .oe_msg.oe_msg_composer_compact .oe_compact_inbox {
border: 1px solid #CCC;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
background: rgba(246, 253, 187, 0.54); //white;
font-size: 14px;
font-style: italic;
}

.openerp .oe_application > div > .oe_view_manager > .oe_view_manager_wrapper {
display: table-row;
height: 100%;
background: rgba(246, 253, 187, 0.54);
}
/* форма редактирования*/

.openerp .oe_form_sheet {
background: rgba(246, 253, 187, 0.54); // white;
min-height: 330px;
padding: 16px;
}

/* web_kanban/static/src/css/kanban.css отсюда не работает */
.openerp .oe_kanban_view {
background: rgba(246, 253, 187, 0.54) none repeat scroll 0 0; //white none repeat scroll 0 0;
height: inherit;
}

2 changes: 1 addition & 1 deletion sba_countdown/models/countdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ class Countdown(orm.AbstractModel):
def record_to_html(self, cr, uid, field_name, record, options=None, context=None):
if context is None:
context = {}
html = self.pool["ir.ui.view"].render(cr, uid, "website_countdown.front_countdown", {'countdown_date':record[field_name], 'options':options}, engine='ir.qweb', context=context).decode('utf8')
html = self.pool["ir.ui.view"].render(cr, uid, "sba_countdown.front_countdown", {'countdown_date':record[field_name], 'options':options}, engine='ir.qweb', context=context).decode('utf8')
return HTMLSafe(html)
Binary file modified sba_countdown/models/countdown.pyc
100755 → 100644
Binary file not shown.
6 changes: 3 additions & 3 deletions sba_countdown/views/templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<data>
<template id="head" inherit_id="website.assets_frontend" name="Timer">
<xpath expr="/t" position="inside">
<script type="text/javascript" src="/website_countdown/static/src/js/jquery.downCount.js"/>
<script type="text/javascript" src="/website_countdown/static/src/js/countdown.js"/>
<link rel='stylesheet' href="/website_countdown/static/src/css/styles.css"/>
<script type="text/javascript" src="/sba_countdown/static/src/js/jquery.downCount.js"/>
<script type="text/javascript" src="/sba_countdown/static/src/js/countdown.js"/>
<link rel='stylesheet' href="/sba_countdown/static/src/css/styles.css"/>
</xpath>
</template>
</data>
Expand Down
22 changes: 22 additions & 0 deletions sba_ya/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from . import models
Binary file added sba_ya/__init__.pyc
Binary file not shown.
Loading

0 comments on commit 1d8f4f4

Please sign in to comment.