From 65cd88d2167fe855ba941bedafe903c791883bc8 Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Sat, 17 May 2014 09:08:25 +0200 Subject: [PATCH 01/10] [IMP] Added quantity as type and variable_factor + sequence for flexibility to delivery grid line --- addons/delivery/delivery.py | 14 +++++++++----- addons/delivery/delivery_view.xml | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index b5c8bae429e..1d3bc14d5e6 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -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,9 +229,10 @@ 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), 'max_value': fields.float('Maximum Value', required=True), @@ -239,12 +242,13 @@ class delivery_grid_line(osv.osv): '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: diff --git a/addons/delivery/delivery_view.xml b/addons/delivery/delivery_view.xml index 31c0e08b093..ffb7146e04a 100644 --- a/addons/delivery/delivery_view.xml +++ b/addons/delivery/delivery_view.xml @@ -179,6 +179,7 @@
+ From e7e4f8cefaf440ea8a59793b221b376a50cac690 Mon Sep 17 00:00:00 2001 From: xmo-odoo Date: Sat, 17 May 2014 11:44:09 +0200 Subject: [PATCH 02/10] [IMP] remove setting of color.ui After further considering PR #21's arguments, the setup script should not go around setting `color.ui`: * it shouldn't be needed for recent gits with default compile settings[0] * it may override advanced users's own colour configuration/ customisations (or disabling) * it forces default colours on users for which it may be useless (colour- blind) or even detrimental (other vision impairments) * some linux distributions apparently default to idiotic pagers which can't handle ANSI colour codes by default and spew garbage to the terminal [0] https://github.com/git/git/blob/master/Documentation/RelNotes/1.8.4.txt#L178-L180 --- checkout.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/checkout.sh b/checkout.sh index 5a51dd0e4da..0955508a178 100755 --- a/checkout.sh +++ b/checkout.sh @@ -57,7 +57,6 @@ cd $copyname git config user.name "$name" git config user.email "$email" -git config color.ui auto # pre-push script preventing push to odoo repo by default. Git just execs # them, so they need a correct shebang and exec bit From fd223b1d5d3efcb076db6bee308233f587814584 Mon Sep 17 00:00:00 2001 From: Wolfgang Taferner Date: Sat, 17 May 2014 15:53:49 +0200 Subject: [PATCH 03/10] Add quantity in variable factor too... I forgot to add the changes before committing --- addons/delivery/delivery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 1d3bc14d5e6..362703bccb7 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -237,7 +237,7 @@ class delivery_grid_line(osv.osv): '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), } From b283f8d5b113e11d8e36da1939d267e7c8367f3f Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Thu, 22 May 2014 12:13:34 +0200 Subject: [PATCH 04/10] [FIX] base_gengo: use supported/up-to-date library --- .../wizard/base_gengo_translations.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/base_gengo/wizard/base_gengo_translations.py b/addons/base_gengo/wizard/base_gengo_translations.py index f565b520d6c..08dfb0182ae 100644 --- a/addons/base_gengo/wizard/base_gengo_translations.py +++ b/addons/base_gengo/wizard/base_gengo_translations.py @@ -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: From 0b0f74861eb77d6974f3c8736fab069fbabae907 Mon Sep 17 00:00:00 2001 From: Richard Mathot Date: Thu, 22 May 2014 13:29:07 +0200 Subject: [PATCH 05/10] [DOC] base_gengo: add changelog --- addons/base_gengo/doc/changelog.rst | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 addons/base_gengo/doc/changelog.rst diff --git a/addons/base_gengo/doc/changelog.rst b/addons/base_gengo/doc/changelog.rst new file mode 100644 index 00000000000..fe343069a38 --- /dev/null +++ b/addons/base_gengo/doc/changelog.rst @@ -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). From 2649beba979e7cfbe3f5ed26639c2046ae1f5a81 Mon Sep 17 00:00:00 2001 From: --global Date: Thu, 22 May 2014 13:49:41 +0200 Subject: [PATCH 06/10] [IMP] website_forum: make forum;forum inherit from mail.thread. This way we add the possibility to users to follow a forum and be automatically followers of new questions, using some new subtypes on the forum.forum model that do the auto subscription. Also added a profile link on the forum, when logged. Also added a subscribe button on the forum. --- addons/website_forum/data/forum_data.xml | 17 +++++++++++++++++ addons/website_forum/models/forum.py | 4 +--- addons/website_forum/views/forum.xml | 4 ++++ addons/website_forum/views/website_forum.xml | 16 +++++++++++++++- 4 files changed, 37 insertions(+), 4 deletions(-) diff --git a/addons/website_forum/data/forum_data.xml b/addons/website_forum/data/forum_data.xml index 2db99477f61..a3c9b470537 100644 --- a/addons/website_forum/data/forum_data.xml +++ b/addons/website_forum/data/forum_data.xml @@ -53,6 +53,23 @@ Question Edited + + + New Answer + forum.forum + + + + forum_id + + + New Question + forum.forum + + + + forum_id + diff --git a/addons/website_forum/models/forum.py b/addons/website_forum/models/forum.py index 8d56d416223..1a7f68eb32a 100644 --- a/addons/website_forum/models/forum.py +++ b/addons/website_forum/models/forum.py @@ -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 diff --git a/addons/website_forum/views/forum.xml b/addons/website_forum/views/forum.xml index 233aeae40be..3d10ad4fad1 100644 --- a/addons/website_forum/views/forum.xml +++ b/addons/website_forum/views/forum.xml @@ -27,6 +27,10 @@ +
+ + +
diff --git a/addons/website_forum/views/website_forum.xml b/addons/website_forum/views/website_forum.xml index 3f5ec33ac71..4a96899e98e 100644 --- a/addons/website_forum/views/website_forum.xml +++ b/addons/website_forum/views/website_forum.xml @@ -71,6 +71,9 @@
  • Badges
  • +
  • + My Profile +