[MERGE] forward port branch 9.0 up to caf78d22e1

This commit is contained in:
Christophe Simonis
2017-08-22 13:55:05 +02:00
14 changed files with 53 additions and 29 deletions
+1 -1
View File
@@ -608,7 +608,7 @@ class AccountInvoice(models.Model):
credit_aml = self.pool.get('account.move.line').browse(cr, uid, credit_aml_id, context=context)
inv = self.browse(cr, uid, id, context=context)
if not credit_aml.currency_id and inv.currency_id != inv.company_id.currency_id:
credit_aml.with_context(allow_amount_currency=True).write({
credit_aml.with_context(allow_amount_currency=True, check_move_validity=False).write({
'amount_currency': inv.company_id.currency_id.with_context(date=credit_aml.date).compute(credit_aml.balance, inv.currency_id),
'currency_id': inv.currency_id.id})
if credit_aml.payment_id:
+2 -4
View File
@@ -232,10 +232,8 @@ class AccountConfigSettings(models.TransientModel):
def set_product_taxes(self):
""" Set the product taxes if they have changed """
ir_values_obj = self.env['ir.values']
if self.default_sale_tax_id:
ir_values_obj.sudo().set_default('product.template', "taxes_id", [self.default_sale_tax_id.id], for_all_users=True, company_id=self.company_id.id)
if self.default_purchase_tax_id:
ir_values_obj.sudo().set_default('product.template', "supplier_taxes_id", [self.default_purchase_tax_id.id], for_all_users=True, company_id=self.company_id.id)
ir_values_obj.sudo().set_default('product.template', "taxes_id", [self.default_sale_tax_id.id] if self.default_sale_tax_id else False, for_all_users=True, company_id=self.company_id.id)
ir_values_obj.sudo().set_default('product.template', "supplier_taxes_id", [self.default_purchase_tax_id.id] if self.default_purchase_tax_id else False, for_all_users=True, company_id=self.company_id.id)
@api.multi
def set_chart_of_accounts(self):
@@ -74,7 +74,7 @@ class AccountInvoiceRefund(models.TransientModel):
for tmpline in refund.move_id.line_ids:
if tmpline.account_id.id == inv.account_id.id:
to_reconcile_lines += tmpline
to_reconcile_lines.filtered(lambda l: l.reconciled == False).reconcile()
to_reconcile_lines.filtered(lambda l: l.reconciled == False).reconcile()
if mode == 'modify':
invoice = inv.read(
['name', 'type', 'number', 'reference',
@@ -60,11 +60,16 @@ class analytic_account_budget_report(report_sxw.rml_parse):
'theo':0.00,
'pln':0.00,
'prac':0.00,
'perc':0.00
'perc':0.00,
'date_from': budget_name[0].date_from,
'date_to': budget_name[0].date_to,
}
result.append(res)
line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])])
domain_lines = [('id', 'in', b_line_ids),
('crossovered_budget_id', '=', budget_ids[i][0]),
('date_from', '<=', d_to),
('date_to', '>=', d_from)]
line_ids = c_b_lines_obj.search(self.cr, self.uid, domain_lines)
line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
tot_theo = tot_pln = tot_prac = tot_perc = 0
@@ -66,8 +66,11 @@ class budget_report(report_sxw.rml_parse):
'perc': 0.00
}
result.append(res)
line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
domain_lines = [('id', 'in', budget_ids),
('analytic_account_id','=',an_ids[i][0]),
('date_from', '<=', d_to),
('date_to', '>=', d_from)]
line_ids = c_b_lines_obj.search(self.cr, self.uid, domain_lines)
line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
tot_theo = tot_pln = tot_prac = tot_perc = 0.00
@@ -32,6 +32,8 @@
<th class="text-right">Planned Amt</th>
<th class="text-right">Practical Amt</th>
<th class="text-right">Perc(%)</th>
<th class="text-right">Start date</th>
<th class="text-right">End Date</th>
</tr>
</thead>
<tbody>
@@ -42,6 +44,8 @@
<td class="text-right"><strong t-esc="formatLang(line['pln'], dp='Account', currency_obj=res_company.currency_id)"/></td>
<td class="text-right"><strong t-esc="formatLang(line['prac'], dp='Account', currency_obj=res_company.currency_id)"/></td>
<td class="text-right"><strong t-esc="formatLang(line['perc'], digits=2)"/> %</td>
<td class="text-right"><strong t-esc="formatLang(line.get('date_from') or '', date=True)"/></td>
<td class="text-right"><strong t-esc="formatLang(line.get('date_to') or '', date=True)"/></td>
</tr>
<tr t-if="line['status'] != 1">
<td><span style="color: white;" t-esc="'.....'*(line['status'] - 1)"/><span t-esc="line['name']"/></td>
+2 -2
View File
@@ -365,7 +365,7 @@ class account_voucher_line(models.Model):
if product.description_purchase:
values['name'] += '\n' + product.description_purchase
else:
values['price_unit'] = product.lst_price
values['price_unit'] = price_unit or product.lst_price
taxes = product.taxes_id or account.tax_ids
if product.description_sale:
values['name'] += '\n' + product.description_sale
@@ -375,7 +375,7 @@ class account_voucher_line(models.Model):
if company and currency:
if company.currency_id != currency:
if type == 'purchase':
values['price_unit'] = product.standard_price
values['price_unit'] = price_unit or product.standard_price
values['price_unit'] = values['price_unit'] * currency.rate
return {'value': values, 'domain': {}}
@@ -8,6 +8,7 @@ import urllib2
import werkzeug.urls
from odoo import api, fields, models, registry, _
from odoo.exceptions import UserError
from odoo.http import request
@@ -124,6 +125,9 @@ class GoogleService(models.TransientModel):
client_id = Parameters.get_param('google_%s_client_id' % (service,), default=False)
client_secret = Parameters.get_param('google_%s_client_secret' % (service,), default=False)
if not client_id or not client_secret:
raise UserError(_("The account for the Google service '%s' is not configured") % service)
headers = {"content-type": "application/x-www-form-urlencoded"}
data = werkzeug.url_encode({
'refresh_token': refresh_token,
+1 -1
View File
@@ -73,7 +73,7 @@ class SaleOrder(models.Model):
@api.multi
def action_cancel(self):
self.order_line.mapped('procurement_ids').cancel()
self.mapped('order_line').mapped('procurement_ids').cancel()
super(SaleOrder, self).action_cancel()
@api.multi
+4 -3
View File
@@ -157,7 +157,8 @@ class StockMove(models.Model):
@api.depends('product_id', 'product_uom', 'product_uom_qty')
def _compute_product_qty(self):
if self.product_uom:
self.product_qty = self.env['product.uom']._compute_qty_obj(self.product_uom, self.product_uom_qty, self.product_id.uom_id)
rounding_method = self._context.get('rounding_method', 'UP')
self.product_qty = self.env['product.uom']._compute_qty_obj(self.product_uom, self.product_uom_qty, self.product_id.uom_id, rounding_method=rounding_method)
def _set_product_qty(self):
""" The meaning of product_qty field changed lately and is now a functional field computing the quantity
@@ -980,12 +981,12 @@ class StockMove(models.Model):
# TDE CLEANME: remove context key + add as parameter
if self.env.context.get('source_location_id'):
defaults['location_id'] = self.env.context['source_location_id']
new_move = self.copy(defaults)
new_move = self.with_context(rounding_method='HALF-UP').copy(defaults)
# ctx = context.copy()
# TDE CLEANME: used only in write in this file, to clean
# ctx['do_not_propagate'] = True
self.with_context(do_not_propagate=True).write({'product_uom_qty': self.product_uom_qty - uom_qty})
self.with_context(do_not_propagate=True, rounding_method='HALF-UP').write({'product_uom_qty': self.product_uom_qty - uom_qty})
if self.move_dest_id and self.propagate and self.move_dest_id.state not in ('done', 'cancel'):
new_move_prop = self.move_dest_id.split(qty)
+9
View File
@@ -0,0 +1,9 @@
Vietnam, 2017-08-15
I hereby agree to the terms of the Odoo Individual Contributor License Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this declaration.
Signed,
Duong Bao Thang nothingctrl@gmail.com https://github.com/NothingCtrl
+2 -6
View File
@@ -838,17 +838,13 @@ attributes:
Possible children of the view element are:
``field``
declares fields to aggregate or to use in kanban *logic*. If the field is
simply displayed in the kanban view, it does not need to be pre-declared.
declares fields to use in kanban *logic*. If the field is simply displayed in
the kanban view, it does not need to be pre-declared.
Possible attributes are:
``name`` (required)
the name of the field to fetch
``sum``, ``avg``, ``min``, ``max``, ``count``
displays the corresponding aggregation at the top of a kanban column, the
field's value is the label of the aggregation (a string). Only one
aggregate operation per field is supported.
``templates``
defines a list of :ref:`reference/qweb` templates. Cards definition may be
+2 -1
View File
@@ -384,7 +384,8 @@ class IrModelFields(models.Model):
if field.state == 'manual' and field.ttype == 'many2many':
rel_name = field.relation_table or model._fields[field.name].relation
tables_to_drop.add(rel_name)
model._pop_field(field.name)
if field.state == 'manual':
model._pop_field(field.name)
if tables_to_drop:
# drop the relation tables that are not used by other fields
+8 -5
View File
@@ -6034,13 +6034,16 @@ class BaseModel(object):
return RecordCache(self)
@api.model
def _in_cache_without(self, field):
""" Make sure ``self`` is present in cache (for prefetching), and return
the records of model ``self`` in cache that have no value for ``field``
(:class:`Field` instance).
def _in_cache_without(self, field, limit=PREFETCH_MAX):
""" Return records to prefetch that have no value in cache for ``field``
(:class:`Field` instance), including ``self``.
Return at most ``limit`` records.
"""
ids = filter(None, self._prefetch[self._name] - set(self.env.cache[field]))
return self.browse(ids)
recs = self.browse(ids)
if limit and len(recs) > limit:
recs = self + (recs - self)[:(limit - len(self))]
return recs
@api.model
def refresh(self):