[MERGE] forward port branch 9.0 up to f3491a27a5
This commit is contained in:
@@ -419,12 +419,11 @@ class AccountBankStatementLine(models.Model):
|
||||
|
||||
@api.multi
|
||||
def button_cancel_reconciliation(self):
|
||||
moves_to_unbind = self.env['account.move']
|
||||
moves_to_cancel = self.env['account.move']
|
||||
payment_to_unreconcile = self.env['account.payment']
|
||||
payment_to_cancel = self.env['account.payment']
|
||||
for st_line in self:
|
||||
moves_to_unbind |= st_line.journal_entry_ids
|
||||
moves_to_unbind = st_line.journal_entry_ids
|
||||
for move in st_line.journal_entry_ids:
|
||||
for line in move.line_ids:
|
||||
payment_to_unreconcile |= line.payment_id
|
||||
@@ -432,13 +431,15 @@ class AccountBankStatementLine(models.Model):
|
||||
#there can be several moves linked to a statement line but maximum one created by the line itself
|
||||
moves_to_cancel |= st_line.journal_entry_ids
|
||||
payment_to_cancel |= line.payment_id
|
||||
moves_to_unbind = moves_to_unbind - moves_to_cancel
|
||||
payment_to_unreconcile = payment_to_unreconcile - payment_to_cancel
|
||||
|
||||
if moves_to_unbind:
|
||||
moves_to_unbind.write({'statement_line_id': False})
|
||||
for move in moves_to_unbind:
|
||||
move.line_ids.filtered(lambda x:x.statement_id == st_line.statement_id).write({'statement_id': False})
|
||||
moves_to_unbind = moves_to_unbind - moves_to_cancel
|
||||
|
||||
if moves_to_unbind:
|
||||
moves_to_unbind.write({'statement_line_id': False})
|
||||
for move in moves_to_unbind:
|
||||
move.line_ids.filtered(lambda x: x.statement_id == st_line.statement_id).write({'statement_id': False})
|
||||
|
||||
payment_to_unreconcile = payment_to_unreconcile - payment_to_cancel
|
||||
if payment_to_unreconcile:
|
||||
payment_to_unreconcile.unreconcile()
|
||||
|
||||
|
||||
@@ -456,7 +456,9 @@ class hr_payslip(osv.osv):
|
||||
def _sum_salary_rule_category(localdict, category, amount):
|
||||
if category.parent_id:
|
||||
localdict = _sum_salary_rule_category(localdict, category.parent_id, amount)
|
||||
localdict['categories'].dict[category.code] = category.code in localdict['categories'].dict and localdict['categories'].dict[category.code] + amount or amount
|
||||
if category.code in localdict['categories'].dict:
|
||||
amount += localdict['categories'].dict[category.code]
|
||||
localdict['categories'].dict[category.code] = amount
|
||||
return localdict
|
||||
|
||||
class BrowsableObject(object):
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="bank_account_code_prefix">1</field>
|
||||
<field name="cash_account_code_prefix">1</field>
|
||||
<field name="code_digits">6</field>
|
||||
<field name="currency_id" ref="base.EGP"/>
|
||||
<field name="currency_id" ref="base.SAR"/>
|
||||
<field name="transfer_account_id" ref="transfer_account"/>
|
||||
<field name="spoken_languages" eval="'en_US;ar_EG;ar_SY'"/>
|
||||
</record>
|
||||
|
||||
@@ -8,7 +8,7 @@ from lxml import html
|
||||
from urllib2 import urlopen
|
||||
from urlparse import urljoin
|
||||
from urlparse import urlparse
|
||||
from werkzeug import url_encode
|
||||
from werkzeug import url_encode, unescape
|
||||
|
||||
from openerp import models, fields, api, _
|
||||
from openerp.tools import ustr
|
||||
@@ -54,7 +54,7 @@ class link_tracker(models.Model):
|
||||
href = match[0]
|
||||
long_url = match[1]
|
||||
|
||||
vals['url'] = long_url
|
||||
vals['url'] = unescape(long_url)
|
||||
|
||||
if not blacklist or not [s for s in blacklist if s in long_url] and not long_url.startswith(short_schema):
|
||||
link = self.create(vals)
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 357 B |
Binary file not shown.
|
After Width: | Height: | Size: 303 B |
@@ -17,14 +17,19 @@ class SaleOrderLine(models.Model):
|
||||
PricelistItem = self.env['product.pricelist.item']
|
||||
field_name = 'lst_price'
|
||||
currency_id = None
|
||||
product_currency = None
|
||||
rule_id = pricelist_dict[pricelist_id][1] if pricelist_dict.get(pricelist_id) else False
|
||||
if rule_id:
|
||||
pricelist_item = PricelistItem.browse(rule_id)
|
||||
if pricelist_item.base == 'standard_price':
|
||||
field_name = 'standard_price'
|
||||
if pricelist_item.base == 'pricelist' and pricelist_item.base_pricelist_id:
|
||||
field_name = 'price'
|
||||
product = product.with_context(pricelist=pricelist_item.base_pricelist_id.id)
|
||||
product_currency = pricelist_item.base_pricelist_id.currency_id
|
||||
currency_id = pricelist_item.pricelist_id.currency_id
|
||||
|
||||
product_currency = (product.company_id and product.company_id.currency_id) or self.env.user.company_id.currency_id
|
||||
product_currency = product_currency or (product.company_id and product.company_id.currency_id) or self.env.user.company_id.currency_id
|
||||
if not currency_id:
|
||||
currency_id = product_currency
|
||||
cur_factor = 1.0
|
||||
|
||||
@@ -641,7 +641,7 @@ class PurchaseOrderLine(models.Model):
|
||||
diff_quantity = line.product_qty
|
||||
for procurement in line.procurement_ids:
|
||||
procurement_qty = procurement.product_uom._compute_qty_obj(procurement.product_uom, procurement.product_qty, line.product_uom)
|
||||
if float_compare(diff_quantity, 0.0, precision_rounding=line.product_uom.rounding) > 0:
|
||||
if float_compare(procurement_qty, 0.0, precision_rounding=procurement.product_uom.rounding) > 0 and float_compare(diff_quantity, 0.0, precision_rounding=line.product_uom.rounding) > 0:
|
||||
tmp = template.copy()
|
||||
tmp.update({
|
||||
'product_uom_qty': min(procurement_qty, diff_quantity),
|
||||
|
||||
+1
-1
@@ -1011,7 +1011,7 @@ class ProductTemplate(models.Model):
|
||||
def action_view_sales(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('sale.action_product_sale_list')
|
||||
product_ids = self.product_variant_ids.ids
|
||||
product_ids = self.with_context(active_test=False).product_variant_ids.ids
|
||||
|
||||
return {
|
||||
'name': action.name,
|
||||
|
||||
@@ -1,5 +1,20 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import models
|
||||
import report
|
||||
from functools import partial
|
||||
import openerp
|
||||
from openerp import api, SUPERUSER_ID
|
||||
|
||||
import models # noqa
|
||||
import report # noqa
|
||||
|
||||
|
||||
def uninstall_hook(cr, registry):
|
||||
def recreate_view(dbname):
|
||||
db_registry = openerp.modules.registry.RegistryManager.new(dbname)
|
||||
with api.Environment.manage(), db_registry.cursor() as cr:
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
if 'sale.report' in env:
|
||||
env['sale.report'].init()
|
||||
|
||||
cr.after("commit", partial(recreate_view, cr.dbname))
|
||||
|
||||
@@ -15,4 +15,5 @@ Price and Cost Price.
|
||||
'depends':['sale'],
|
||||
'demo':['data/sale_margin_demo.xml'],
|
||||
'data':['security/ir.model.access.csv','views/sale_margin_view.xml'],
|
||||
'uninstall_hook': "uninstall_hook",
|
||||
}
|
||||
|
||||
@@ -581,7 +581,6 @@ class WebsiteSale(http.Controller):
|
||||
partner = Partner.sudo().create(billing_info)
|
||||
order.write({'partner_id': partner.id})
|
||||
order.onchange_partner_id()
|
||||
order.write({'partner_invoice_id': partner.id})
|
||||
|
||||
# create a new shipping partner
|
||||
if checkout.get('shipping_id') == -1:
|
||||
@@ -590,11 +589,10 @@ class WebsiteSale(http.Controller):
|
||||
shipping_info['lang'] = partner_lang
|
||||
shipping_info['parent_id'] = partner.id
|
||||
checkout['shipping_id'] = Partner.sudo().create(shipping_info).id
|
||||
if checkout.get('shipping_id'):
|
||||
order.write({'partner_shipping_id': checkout['shipping_id']})
|
||||
|
||||
order_info = {
|
||||
'message_partner_ids': [(4, partner.id), (3, request.website.partner_id.id)],
|
||||
'partner_shipping_id': checkout.get('shipping_id') or partner.id,
|
||||
}
|
||||
order.write(order_info)
|
||||
|
||||
@@ -630,9 +628,6 @@ class WebsiteSale(http.Controller):
|
||||
|
||||
self.checkout_form_save(values["checkout"])
|
||||
|
||||
if not int(post.get('shipping_id', 0)):
|
||||
order.partner_shipping_id = order.partner_invoice_id
|
||||
|
||||
order.onchange_partner_shipping_id()
|
||||
order.order_line._compute_tax_id()
|
||||
|
||||
|
||||
@@ -673,8 +673,6 @@ class IrModelRelation(models.Model):
|
||||
self._cr.execute('DROP TABLE %s CASCADE' % table,)
|
||||
_logger.info('Dropped table %s', table)
|
||||
|
||||
self._cr.commit()
|
||||
|
||||
|
||||
class IrModelAccess(models.Model):
|
||||
_name = 'ir.model.access'
|
||||
@@ -1206,7 +1204,6 @@ class IrModelData(models.Model):
|
||||
|
||||
unlink_if_refcount(item for item in to_unlink if item[0] == 'ir.model')
|
||||
|
||||
self._cr.commit()
|
||||
|
||||
datas.unlink()
|
||||
|
||||
|
||||
+6
-5
@@ -1170,13 +1170,14 @@ class Monetary(Field):
|
||||
_column_currency_field = property(attrgetter('currency_field'))
|
||||
_column_group_operator = property(attrgetter('group_operator'))
|
||||
|
||||
def _setup_regular_base(self, model):
|
||||
super(Monetary, self)._setup_regular_base(model)
|
||||
if not self.currency_field:
|
||||
self.currency_field = 'currency_id'
|
||||
|
||||
def _setup_regular_full(self, model):
|
||||
super(Monetary, self)._setup_regular_full(model)
|
||||
if not self.currency_field:
|
||||
# pick a default, trying in order: 'currency_id', 'x_currency_id'
|
||||
if 'currency_id' in model._fields:
|
||||
self.currency_field = 'currency_id'
|
||||
elif 'x_currency_id' in model._fields:
|
||||
self.currency_field = 'x_currency_id'
|
||||
assert self.currency_field in model._fields, \
|
||||
"Field %s with unknown currency_field %r" % (self, self.currency_field)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user