Skip to content

Commit

Permalink
[MERGE] forward port of branch 8.0 up to 34ce3e3
Browse files Browse the repository at this point in the history
  • Loading branch information
beledouxdenis committed Oct 1, 2015
2 parents e9f1ee4 + 34ce3e3 commit 0b678c6
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 49 deletions.
4 changes: 2 additions & 2 deletions addons/account/account_bank_statement.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,9 +600,9 @@ def get_reconciliation_proposition(self, cr, uid, st_line, excluded_ids=None, co
domain += [('reconcile_partial_id', '=', False)]
domain += [('account_id.type', 'in', ((amount > 0 and 'receivable' or 'payable'), 'liquidity'))] # Make sure we can't mix receivable and payable
if amount_field == 'amount_currency' and amount < 0:
domain += [(amount_field, '<', 0), (amount_field, '>', (sign * amount))]
domain += [(amount_field, '<', 0), (amount_field, '>=', (sign * amount))]
else:
domain += [(amount_field, '>', 0), (amount_field, '<', (sign * amount))]
domain += [(amount_field, '>', 0), (amount_field, '<=', (sign * amount))]
mv_lines = self.get_move_lines_for_reconciliation(cr, uid, st_line, excluded_ids=excluded_ids, limit=5, additional_domain=domain, context=context)
ret = []
total = 0
Expand Down
2 changes: 1 addition & 1 deletion addons/account/wizard/account_reconcile.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class account_move_line_reconcile_writeoff(osv.osv_memory):
'writeoff_acc_id': fields.many2one('account.account','Write-Off account', required=True),
'date_p': fields.date('Date'),
'comment': fields.char('Comment', required=True),
'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('parent_id', '!=', False)]),
'analytic_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('type', '!=', 'view')]),
}
_defaults = {
'date_p': lambda *a: time.strftime('%Y-%m-%d'),
Expand Down
10 changes: 8 additions & 2 deletions addons/payment_transfer/i18n/payment_transfer.pot
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-01-21 14:08+0000\n"
"PO-Revision-Date: 2015-01-21 14:08+0000\n"
"POT-Creation-Date: 2015-09-05 12:00+0000\n"
"PO-Revision-Date: 2015-09-05 12:00+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
Expand Down Expand Up @@ -43,3 +43,9 @@ msgstr ""
msgid "Payment Transaction"
msgstr ""

#. module: payment_transfer
#: code:addons/payment_transfer/models/payment_acquirer.py:19
#, python-format
msgid "Wire Transfer"
msgstr ""

2 changes: 1 addition & 1 deletion addons/payment_transfer/models/payment_acquirer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TransferPaymentAcquirer(osv.Model):

def _get_providers(self, cr, uid, context=None):
providers = super(TransferPaymentAcquirer, self)._get_providers(cr, uid, context=context)
providers.append(['transfer', 'Wire Transfer'])
providers.append(['transfer', _('Wire Transfer')])
return providers

def transfer_get_form_action_url(self, cr, uid, id, context=None):
Expand Down
8 changes: 3 additions & 5 deletions addons/sale/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,8 @@ def _prepare_invoice(self, cr, uid, order, lines, context=None):
"""
if context is None:
context = {}
journal_ids = self.pool.get('account.journal').search(cr, uid,
[('type', '=', 'sale'), ('company_id', '=', order.company_id.id)],
limit=1)
if not journal_ids:
journal_id = self.pool['account.invoice'].default_get(cr, uid, ['journal_id'], context=context)['journal_id']
if not journal_id:
raise UserError(_('Please define sales journal for this company: "%s" (id:%d).') % (order.company_id.name, order.company_id.id))
invoice_vals = {
'name': order.client_order_ref or '',
Expand All @@ -383,7 +381,7 @@ def _prepare_invoice(self, cr, uid, order, lines, context=None):
'reference': order.client_order_ref or order.name,
'account_id': order.partner_invoice_id.property_account_receivable.id,
'partner_id': order.partner_invoice_id.id,
'journal_id': journal_ids[0],
'journal_id': journal_id,
'invoice_line': [(6, 0, lines)],
'currency_id': order.pricelist_id.currency_id.id,
'comment': order.note,
Expand Down
16 changes: 16 additions & 0 deletions doc/cla/corporate/compassionCH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Switzerland, 2015-08-18

Compassion Switzerland agrees to the terms of the Odoo Corporate Contributor License
Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this
declaration.

Signed,

Emanuel Cino [email protected] https://github.com/CompassionCH


List of contributors:

Emanuel Cino [email protected] https://github.com/ecino
15 changes: 15 additions & 0 deletions doc/cla/corporate/openbig.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Germany, 9-30-2015

Big Consulting GmbH agrees to the terms of the Odoo Corporate Contributor License Agreement v1.0.

I declare that I am authorized and able to make this agreement and sign this declaration.

Signed,

Thorsten Vocks [email protected] https://github.com/tv-openbig

List of contributors:

Thorsten Vocks [email protected] https://github.com/tv-openbig
Heike Vocks [email protected] https://github.com/hv-openbig
Jan Dasenbrock [email protected] https://github.com/jd-openbig
11 changes: 11 additions & 0 deletions doc/cla/individual/MackZxh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
China, 2015-10-01

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,

钟小华 Zhong Xiaohua [email protected] or [email protected] https://github.com/MackZxh
2 changes: 1 addition & 1 deletion doc/reference/views.rst
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ calendar view are:
``date_stop`` is provided records become movable (via drag and drop)
directly in the calendar
``date_delay``
alternative to ``date_end``, provides the duration of the event instead of
alternative to ``date_stop``, provides the duration of the event instead of
its end date

.. todo:: what's the unit? Does it allow moving the record?
Expand Down
49 changes: 12 additions & 37 deletions openerp/addons/base/ir/ir_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,21 +422,8 @@ def write(self, cr, user, ids, vals, context=None):
# if set, *one* column can be renamed here
column_rename = None

# field patches {model: {field_name: {prop_name: prop_value, ...}, ...}, ...}
patches = defaultdict(lambda: defaultdict(dict))

# static table of properties
model_props = [ # (our-name, fields.prop, set_fn)
('field_description', 'string', tools.ustr),
('required', 'required', bool),
('readonly', 'readonly', bool),
('domain', 'domain', eval),
('size', 'size', int),
('on_delete', 'ondelete', str),
('translate', 'translate', bool),
('select_level', 'index', lambda x: bool(int(x))),
('selection', 'selection', eval),
]
# names of the models to patch
patched_models = set()

if vals and ids:
checked_selection = False # need only check it once, so defer
Expand Down Expand Up @@ -478,12 +465,7 @@ def write(self, cr, user, ids, vals, context=None):
# We don't check the 'state', because it might come from the context
# (thus be set for multiple fields) and will be ignored anyway.
if obj is not None and field is not None:
# find out which properties (per model) we need to update
for field_name, prop_name, func in model_props:
if field_name in vals:
prop_value = func(vals[field_name])
if getattr(field, prop_name) != prop_value:
patches[obj][final_name][prop_name] = prop_value
patched_models.add(obj._name)

# These shall never be written (modified)
for column_name in ('model_id', 'model', 'state'):
Expand All @@ -492,16 +474,17 @@ def write(self, cr, user, ids, vals, context=None):

res = super(ir_model_fields,self).write(cr, user, ids, vals, context=context)

self.pool.clear_manual_fields()

if column_rename:
obj, rename = column_rename
cr.execute('ALTER TABLE "%s" RENAME COLUMN "%s" TO "%s"' % rename)
# This is VERY risky, but let us have this feature:
# we want to change the key of field in obj._fields and obj._columns
field = obj._pop_field(rename[1])
obj._add_field(rename[2], field)

if column_rename or patched_models:
# setup models, this will reload all manual fields in registry
self.pool.setup_models(cr, partial=(not self.pool.ready))

if patches:
if patched_models:
# We have to update _columns of the model(s) and then call their
# _auto_init to sync the db with the model. Hopefully, since write()
# was called earlier, they will be in-sync before the _auto_init.
Expand All @@ -511,20 +494,12 @@ def write(self, cr, user, ids, vals, context=None):
select=vals.get('select_level', '0'),
update_custom_fields=True,
)

for obj, model_patches in patches.iteritems():
for field_name, field_patches in model_patches.iteritems():
# update field properties, and adapt corresponding column
field = obj._fields[field_name]
attrs = dict(field._attrs, **field_patches)
obj._add_field(field_name, field.new(**attrs))

# update database schema
self.pool.setup_models(cr, partial=(not self.pool.ready))
for model_name in patched_models:
obj = self.pool[model_name]
obj._auto_init(cr, ctx)
obj._auto_end(cr, ctx) # actually create FKs!

if column_rename or patches:
if column_rename or patched_models:
RegistryManager.signal_registry_change(cr.dbname)

return res
Expand Down

0 comments on commit 0b678c6

Please sign in to comment.