Skip to content

Commit

Permalink
[MERGE] forward port branch saas-15 up to 81003c8
Browse files Browse the repository at this point in the history
  • Loading branch information
KangOl committed Feb 5, 2018
2 parents 03d50e5 + 81003c8 commit b503e79
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 12 deletions.
19 changes: 14 additions & 5 deletions addons/account/models/res_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,23 @@ class AccountConfigSettings(models.TransientModel):

@api.model
def get_default_tax_fields(self, fields):
default_purchase_tax_id = self.env['ir.config_parameter'].sudo().get_param('account.default_purchase_tax_id', default=False)
default_sale_tax_id = self.env['ir.config_parameter'].sudo().get_param('account.default_sale_tax_id', default=False)
return dict(default_purchase_tax_id=int(default_purchase_tax_id), default_sale_tax_id=int(default_sale_tax_id))
# DO NOT FORWARDPORT, ONLY FOR SAAS-15
default_purchase_tax_id = (
self.env['ir.values'].sudo().get_default('product.template', 'supplier_taxes_id', company_id=self.env.user.company_id.id) or
self.env['ir.config_parameter'].sudo().get_param('account.default_purchase_tax_id', default=False)
)
default_sale_tax_id = (
self.env['ir.values'].sudo().get_default('product.template', 'taxes_id', company_id=self.env.user.company_id.id) or
self.env['ir.config_parameter'].sudo().get_param('account.default_sale_tax_id', default=False)
)
return {
'default_purchase_tax_id': int(default_purchase_tax_id[0]) if isinstance(default_purchase_tax_id, list) and default_purchase_tax_id else default_purchase_tax_id,
'default_sale_tax_id': int(default_sale_tax_id[0]) if isinstance(default_sale_tax_id, list) and default_sale_tax_id else default_sale_tax_id,
}

@api.multi
def set_default_tax_fields(self):
self.env['ir.config_parameter'].sudo().set_param("account.default_purchase_tax_id", self.default_purchase_tax_id.id)
self.env['ir.config_parameter'].sudo().set_param("account.default_sale_tax_id", self.default_sale_tax_id.id)
pass

@api.depends('company_id')
def _compute_has_chart_of_accounts(self):
Expand Down
4 changes: 2 additions & 2 deletions addons/calendar/views/calendar_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<field name="partner_ids"/>
<field name="location"/>
<field name="state" invisible="True"/>
<field name="duration"/>
<field name="duration" widget="float_time"/>
<field name="message_needaction" invisible="1"/>
</tree>
</field>
Expand Down Expand Up @@ -372,4 +372,4 @@
<field name="view_id" ref="view_calendar_event_form"/>
</record>

</odoo>
</odoo>
7 changes: 3 additions & 4 deletions addons/product/models/product_attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ def name_search(self, name='', args=None, operator='ilike', limit=100):
# search on a m2o and one on a m2m, probably this will quickly become
# difficult to compute - check if performance optimization is required
if name and operator in ('=', 'ilike', '=ilike', 'like', '=like'):
new_args = ['|', ('attribute_id', operator, name), ('value_ids', operator, name)]
else:
new_args = args
return super(ProductAttributeLine, self).name_search(name=name, args=new_args, operator=operator, limit=limit)
args = ['|', ('attribute_id', operator, name), ('value_ids', operator, name)]
return self.search(args, limit=limit).name_get()
return super(ProductAttributeLine, self).name_search(name=name, args=args, operator=operator, limit=limit)
37 changes: 37 additions & 0 deletions addons/product/tests/test_variants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,43 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import common
from odoo.tests.common import TransactionCase

class TestVariants(TransactionCase):

def setUp(self):
res = super(TestVariants, self).setUp()
self.size_attr = self.env['product.attribute'].create({'name': 'Size'})
self.size_attr_value_s = self.env['product.attribute.value'].create({'name': 'S', 'attribute_id': self.size_attr.id})
self.size_attr_value_m = self.env['product.attribute.value'].create({'name': 'M', 'attribute_id': self.size_attr.id})
self.size_attr_value_l = self.env['product.attribute.value'].create({'name': 'L', 'attribute_id': self.size_attr.id})
self.product_shirt_template = self.env['product.template'].create({
'name': 'Shirt',
'attribute_line_ids': [(0, 0, {
'attribute_id': self.size_attr.id,
'value_ids': [(6, 0, [self.size_attr_value_l.id])],
})]
})
return res

def test_attribute_line_search(self):
search_not_to_be_found = self.env['product.template'].search(
[('attribute_line_ids', '=', 'M')]
)
self.assertNotIn(self.product_shirt_template, search_not_to_be_found,
'Shirt should not be found searching M')

search_attribute = self.env['product.template'].search(
[('attribute_line_ids', '=', 'Size')]
)
self.assertIn(self.product_shirt_template, search_attribute,
'Shirt should be found searching Size')

search_value = self.env['product.template'].search(
[('attribute_line_ids', '=', 'L')]
)
self.assertIn(self.product_shirt_template, search_value,
'Shirt should be found searching L')


class TestVariants(common.TestProductCommon):
Expand Down
2 changes: 1 addition & 1 deletion addons/website_forum/views/website_forum.xml
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@

<!-- Edition: post a reply -->
<template id="post_reply">
<div class="css_editable_mode_hidden" groups="base.group_user">
<div class="css_editable_mode_hidden">
<form t-attf-id="reply#{ object._name.replace('.','') + '-' + str(object.id) }" class="collapse js_website_submit_form"
t-attf-action="/forum/#{ slug(forum) }/#{slug(object)}/reply" method="post" role="form">
<h3 class="mt8">Your Reply</h3>
Expand Down
1 change: 1 addition & 0 deletions odoo/cli/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def init(self, args):

def console(self, local_vars):
if not os.isatty(sys.stdin.fileno()):
local_vars['__name__'] = '__main__'
exec sys.stdin in local_vars
else:
if 'env' not in local_vars:
Expand Down

0 comments on commit b503e79

Please sign in to comment.