Merge remote-tracking branch 'odoo/master'
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
========================
|
||||
``base_gengo`` changelog
|
||||
========================
|
||||
|
||||
******
|
||||
saas-5
|
||||
******
|
||||
|
||||
- Library update: ``mygengo`` (https://pypi.python.org/pypi/mygengo/1.3.3) was outdated and has been replaced by ``gengo`` (https://pypi.python.org/pypi/gengo).
|
||||
@@ -30,9 +30,9 @@ from openerp.tools.translate import _
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
from mygengo import MyGengo
|
||||
from gengo import Gengo
|
||||
except ImportError:
|
||||
_logger.warning('Gengo library not found, Gengo features disabled. If you plan to use it, please install the mygengo library from http://pypi.python.org/pypi/mygengo')
|
||||
_logger.warning('Gengo library not found, Gengo features disabled. If you plan to use it, please install the gengo library from http://pypi.python.org/pypi/gengo')
|
||||
|
||||
GENGO_DEFAULT_LIMIT = 20
|
||||
|
||||
@@ -50,21 +50,21 @@ class base_gengo_translations(osv.osv_memory):
|
||||
'sync_limit' : 20
|
||||
}
|
||||
def gengo_authentication(self, cr, uid, context=None):
|
||||
'''
|
||||
'''
|
||||
This method tries to open a connection with Gengo. For that, it uses the Public and Private
|
||||
keys that are linked to the company (given by Gengo on subscription). It returns a tuple with
|
||||
* as first element: a boolean depicting if the authentication was a success or not
|
||||
* as second element: the connection, if it was a success, or the error message returned by
|
||||
* as second element: the connection, if it was a success, or the error message returned by
|
||||
Gengo when the connection failed.
|
||||
This error message can either be displayed in the server logs (if the authentication was called
|
||||
by the cron) or in a dialog box (if requested by the user), thus it's important to return it
|
||||
This error message can either be displayed in the server logs (if the authentication was called
|
||||
by the cron) or in a dialog box (if requested by the user), thus it's important to return it
|
||||
translated.
|
||||
'''
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
if not user.company_id.gengo_public_key or not user.company_id.gengo_private_key:
|
||||
return (False, _("Gengo `Public Key` or `Private Key` are missing. Enter your Gengo authentication parameters under `Settings > Companies > Gengo Parameters`."))
|
||||
try:
|
||||
gengo = MyGengo(
|
||||
gengo = Gengo(
|
||||
public_key=user.company_id.gengo_public_key.encode('ascii'),
|
||||
private_key=user.company_id.gengo_private_key.encode('ascii'),
|
||||
sandbox=user.company_id.gengo_sandbox,
|
||||
@@ -208,10 +208,10 @@ class base_gengo_translations(osv.osv_memory):
|
||||
def _sync_request(self, cr, uid, limit=GENGO_DEFAULT_LIMIT, context=None):
|
||||
"""
|
||||
This scheduler will send a job request to the gengo , which terms are
|
||||
waiing to be translated and for which gengo_translation is enabled.
|
||||
waiing to be translated and for which gengo_translation is enabled.
|
||||
|
||||
A special key 'gengo_language' can be passed in the context in order to
|
||||
request only translations of that language only. Its value is the language
|
||||
A special key 'gengo_language' can be passed in the context in order to
|
||||
request only translations of that language only. Its value is the language
|
||||
ID in openerp.
|
||||
"""
|
||||
if context is None:
|
||||
|
||||
@@ -191,21 +191,23 @@ class delivery_grid(osv.osv):
|
||||
total = 0
|
||||
weight = 0
|
||||
volume = 0
|
||||
quantity = 0
|
||||
for line in order.order_line:
|
||||
if not line.product_id or line.is_delivery:
|
||||
continue
|
||||
weight += (line.product_id.weight or 0.0) * line.product_uom_qty
|
||||
volume += (line.product_id.volume or 0.0) * line.product_uom_qty
|
||||
quantity += line.product_uom_qty
|
||||
total = order.amount_total or 0.0
|
||||
|
||||
|
||||
return self.get_price_from_picking(cr, uid, id, total,weight, volume, context=context)
|
||||
return self.get_price_from_picking(cr, uid, id, total,weight, volume, quantity, context=context)
|
||||
|
||||
def get_price_from_picking(self, cr, uid, id, total, weight, volume, context=None):
|
||||
def get_price_from_picking(self, cr, uid, id, total, weight, volume, quantity, context=None):
|
||||
grid = self.browse(cr, uid, id, context=context)
|
||||
price = 0.0
|
||||
ok = False
|
||||
price_dict = {'price': total, 'volume':volume, 'weight': weight, 'wv':volume*weight}
|
||||
price_dict = {'price': total, 'volume':volume, 'weight': weight, 'wv':volume*weight, 'quantity': quantity}
|
||||
for line in grid.line_ids:
|
||||
test = eval(line.type+line.operator+str(line.max_value), price_dict)
|
||||
if test:
|
||||
@@ -227,24 +229,26 @@ class delivery_grid_line(osv.osv):
|
||||
_description = "Delivery Grid Line"
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True),
|
||||
'sequence': fields.integer('Sequence', size=64, required=True, help="Gives the sequence order when calculating delivery grid."),
|
||||
'grid_id': fields.many2one('delivery.grid', 'Grid',required=True, ondelete='cascade'),
|
||||
'type': fields.selection([('weight','Weight'),('volume','Volume'),\
|
||||
('wv','Weight * Volume'), ('price','Price')],\
|
||||
('wv','Weight * Volume'), ('price','Price'), ('quantity','Quantity')],\
|
||||
'Variable', required=True),
|
||||
'operator': fields.selection([('==','='),('<=','<='),('>=','>=')], 'Operator', required=True),
|
||||
'operator': fields.selection([('==','='),('<=','<='),('<','<'),('>=','>='),('>','>')], 'Operator', required=True),
|
||||
'max_value': fields.float('Maximum Value', required=True),
|
||||
'price_type': fields.selection([('fixed','Fixed'),('variable','Variable')], 'Price Type', required=True),
|
||||
'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price')], 'Variable Factor', required=True),
|
||||
'variable_factor': fields.selection([('weight','Weight'),('volume','Volume'),('wv','Weight * Volume'), ('price','Price'), ('quantity','Quantity')], 'Variable Factor', required=True),
|
||||
'list_price': fields.float('Sale Price', digits_compute= dp.get_precision('Product Price'), required=True),
|
||||
'standard_price': fields.float('Cost Price', digits_compute= dp.get_precision('Product Price'), required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'sequence': lambda *args: 10,
|
||||
'type': lambda *args: 'weight',
|
||||
'operator': lambda *args: '<=',
|
||||
'price_type': lambda *args: 'fixed',
|
||||
'variable_factor': lambda *args: 'weight',
|
||||
}
|
||||
_order = 'list_price'
|
||||
_order = 'sequence, list_price'
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -179,6 +179,7 @@
|
||||
<form string="Grid Lines" version="7.0">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="sequence"/>
|
||||
</group>
|
||||
<group>
|
||||
<group>
|
||||
@@ -208,6 +209,7 @@
|
||||
<field name="model">delivery.grid.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Grid Lines">
|
||||
<field name="sequence" widget="handle" />
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="operator"/>
|
||||
|
||||
@@ -53,6 +53,23 @@
|
||||
<field name="default" eval="False"/>
|
||||
<field name="description">Question Edited</field>
|
||||
</record>
|
||||
<!-- Forum subtypes, to follow all answers or questions -->
|
||||
<record id="mt_forum_answer_new" model="mail.message.subtype">
|
||||
<field name="name">New Answer</field>
|
||||
<field name="res_model">forum.forum</field>
|
||||
<field name="default" eval="False"/>
|
||||
<field name="hidden" eval="False"/>
|
||||
<field name="parent_id" eval="ref('mt_answer_new')"/>
|
||||
<field name="relation_field">forum_id</field>
|
||||
</record>
|
||||
<record id="mt_forum_question_new" model="mail.message.subtype">
|
||||
<field name="name">New Question</field>
|
||||
<field name="res_model">forum.forum</field>
|
||||
<field name="default" eval="True"/>
|
||||
<field name="hidden" eval="False"/>
|
||||
<field name="parent_id" eval="ref('mt_question_new')"/>
|
||||
<field name="relation_field">forum_id</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
<data noupdate="1">
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from urlparse import urljoin
|
||||
|
||||
import openerp
|
||||
from openerp import SUPERUSER_ID
|
||||
from openerp.addons.website.models.website import slug
|
||||
@@ -13,7 +11,7 @@ class Forum(osv.Model):
|
||||
"""TDE TODO: set karma values for actions dynamic for a given forum"""
|
||||
_name = 'forum.forum'
|
||||
_description = 'Forums'
|
||||
_inherit = ['website.seo.metadata']
|
||||
_inherit = ['mail.thread', 'website.seo.metadata']
|
||||
# karma values
|
||||
_karma_upvote = 5 # done
|
||||
_karma_downvote = 50 # done
|
||||
|
||||
@@ -27,6 +27,10 @@
|
||||
<field name="description"/>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
|
||||
<field name="message_ids" widget="mail_thread" options='{"thread_level": 1}' placeholder="Send a message to the group"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -71,6 +71,9 @@
|
||||
<li t-att-class="searches.get('badges') and 'active' or '' ">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/badge">Badges</a>
|
||||
</li>
|
||||
<li t-if="not is_public_user" t-att-class="searches.get('my_profile') and 'active' or '' ">
|
||||
<a t-attf-href="/forum/#{ slug(forum) }/user/#{user.id}">My Profile</a>
|
||||
</li>
|
||||
</ul>
|
||||
<form class="navbar-form navbar-right" role="search" t-attf-action="/forum/#{ slug(forum) }" method="get">
|
||||
<div class="form-group">
|
||||
@@ -96,12 +99,23 @@
|
||||
</div>
|
||||
<div class="col-sm-3" id="right-column">
|
||||
<a t-if="not header.get('ask_hide')" class="btn btn-primary btn-lg btn-block mb16" t-attf-href="/forum/#{slug(forum)}/ask">Ask a Question</a>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">Keep Informed</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<t t-call="website_mail.follow">
|
||||
<t t-set="email" t-value="user.email"/>
|
||||
<t t-set="object" t-value="forum"/>
|
||||
</t>
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel panel-default" id="about_forum">
|
||||
<div class="panel-heading">
|
||||
<h3 class="panel-title">About This Forum</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<t t-raw="forum.description"/><br/>
|
||||
<t t-raw="forum.description"/>
|
||||
<a t-if="not header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}/faq" class="fa fa-arrow-right"> Read Guidelines</a>
|
||||
<a t-if="header.get('is_guidelines')" t-attf-href="/forum/#{slug(forum)}" class="fa fa-arrow-right"> Back to <span t-field="forum.name"/></a>
|
||||
</div>
|
||||
|
||||
@@ -255,7 +255,8 @@ class website_sale(http.Controller):
|
||||
|
||||
# must have a draft sale order with lines at this point, otherwise reset
|
||||
if not order or order.state != 'draft':
|
||||
request.website_sale_reset(cr, uid, context=context)
|
||||
request.session['sale_order_id'] = None
|
||||
request.session['sale_transaction_id'] = None
|
||||
return request.redirect('/shop')
|
||||
|
||||
# if transaction pending / done: redirect to confirmation
|
||||
|
||||
Reference in New Issue
Block a user