[MERGE] merged a branch with several fixes, related to the new patch applied on server fo 1) osv/orm: call the fct_inv for functional fields that are stored=True 2) tools/yamp_import: on record creation, do not consider fields that wouldn't be returned by the client because readonly in the view

bzr revid: qdp-launchpad@openerp.com-20121022130156-ki47is4opjex9d79
This commit is contained in:
Quentin (OpenERP) 2012-10-22 15:01:56 +02:00
commit b2de4d421c
15 changed files with 31 additions and 35 deletions

View File

@ -1431,6 +1431,9 @@ class account_move(osv.osv):
if 'line_id' in vals:
c = context.copy()
c['novalidate'] = True
c['period_id'] = vals['period_id']
c['journal_id'] = vals['journal_id']
c['date'] = vals['date']
result = super(account_move, self).create(cr, uid, vals, c)
self.validate(cr, uid, [result], context)
else:

View File

@ -1234,16 +1234,16 @@ class account_move_line(osv.osv):
vals['company_id'] = company_id[0]
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
raise osv.except_osv(_('Bad Account!'), _('You cannot use an inactive account.'))
if 'journal_id' in vals:
if 'journal_id' in vals and vals['journal_id']:
context['journal_id'] = vals['journal_id']
if 'period_id' in vals:
if 'period_id' in vals and vals['period_id']:
context['period_id'] = vals['period_id']
if ('journal_id' not in context) and ('move_id' in vals) and vals['move_id']:
m = move_obj.browse(cr, uid, vals['move_id'])
context['journal_id'] = m.journal_id.id
context['period_id'] = m.period_id.id
#we need to treat the case where a value is given in the context for period_id as a string
if 'period_id' not in context or not isinstance(context.get('period_id', ''), (int, long)):
if 'period_id' in context and not isinstance(context.get('period_id', ''), (int, long)):
period_candidate_ids = self.pool.get('account.period').name_search(cr, uid, name=context.get('period_id',''))
if len(period_candidate_ids) != 1:
raise osv.except_osv(_('Error!'), _('No period found or more than one period found for the given date.'))
@ -1253,6 +1253,9 @@ class account_move_line(osv.osv):
self._update_journal_check(cr, uid, context['journal_id'], context['period_id'], context)
move_id = vals.get('move_id', False)
journal = journal_obj.browse(cr, uid, context['journal_id'], context=context)
vals['journal_id'] = vals.get('journal_id') or context.get('journal_id')
vals['period_id'] = vals.get('period_id') or context.get('period_id')
vals['date'] = vals.get('date') or context.get('date')
if not move_id:
if journal.centralisation:
#Check for centralisation

View File

@ -129,7 +129,7 @@
</td>
<td>
<para style="terp_default_9">[[ o.title.name or '' ]] [[ o.name ]]</para>
<para style="terp_default_9">[[ display_address(o.partner_id) ]]</para>
<para style="terp_default_9">[[ display_address(o) ]]</para>
<para style="terp_default_9">
<font color="white"> </font>
</para>

View File

@ -11,21 +11,18 @@
-
!record {model: account.move, id: account_move_0}:
date: !eval time.strftime('%Y-%m-%d')
period_id: account.period_6
journal_id: account.bank_journal
line_id:
- account_id: account.cash
amount_currency: 0.0
credit: 2000.0
date: !eval time.strftime('%Y-%m-%d')
debit: 0.0
journal_id: account.bank_journal
name: Basic Computer
partner_id: base.res_partner_12
period_id: account.period_6
ref: '2011010'
tax_amount: 0.0
name: /
period_id: account.period_6
ref: '2011010'
state: draft
-
@ -110,4 +107,4 @@
partial_reconcile = self.trans_rec_reconcile_partial_reconcile(cr, uid, [ref('account_move_line_reconcile0')], {'lang': u'en_US',
'active_model': 'account.move.line', 'active_ids': ids, 'tz': False, 'active_id': ids[0]})
move_line = move_line_obj.browse(cr, uid, ids)
assert move_line[0].reconcile_partial_id, "Partial reconcilation is not done"
assert move_line[0].reconcile_partial_id, "Partial reconcilation is not done"

View File

@ -1422,7 +1422,7 @@ class account_voucher_line(osv.osv):
}
def onchange_reconcile(self, cr, uid, ids, reconcile, amount, amount_unreconciled, context=None):
vals = { 'amount': 0.0}
vals = {'amount': 0.0}
if reconcile:
vals = { 'amount': amount_unreconciled}
return {'value': vals}

View File

@ -53,7 +53,6 @@
account_id: account.cash
amount: 1000.0
company_id: base.main_company
currency_id: base.EUR
journal_id: account.bank_journal
name: Voucher Axelor
narration: PC Assemble SC234

View File

@ -45,7 +45,6 @@
'account_id': ref('account.cash'),
'amount': 450.0,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
'partner_id': ref('base.res_partner_19'),
'period_id': ref('account.period_8'),
@ -53,6 +52,10 @@
}
if not res['value']['line_cr_ids']:
res['value']['line_cr_ids'] = [{'type': 'cr', 'account_id': ref('account.a_recv'),}]
#clients aren't sending value of readonly fields in the view, and there is a good reason for that, so here the
#create should only use values of fields that are not readonly. That's why i'm removing some of these values
del(res['value']['line_cr_ids'][0]['date_original'])
del(res['value']['line_cr_ids'][0]['date_due'])
res['value']['line_cr_ids'][0]['amount'] = 450.0
vals['line_cr_ids'] = [(0,0,i) for i in res['value']['line_cr_ids']]
id = self.create(cr, uid, vals)

View File

@ -53,7 +53,6 @@
'account_id': ref('account.cash'),
'amount': 30000.0,
'company_id': ref('base.main_company'),
'currency_id': ref('base.EUR'),
'journal_id': ref('account.bank_journal'),
'partner_id': ref('base.res_partner_19'),
'period_id': ref('account.period_8'),

View File

@ -140,18 +140,20 @@ class users(osv.osv):
# Add handlers for 'input_pw' field.
def set_pw(self, cr, uid, id, name, value, args, context):
if not value:
raise osv.except_osv(_('Error!'), _("You have to specify a password."))
if value:
obj = pooler.get_pool(cr.dbname).get('res.users')
if not hasattr(obj, "_salt_cache"):
obj._salt_cache = {}
obj = pooler.get_pool(cr.dbname).get('res.users')
if not hasattr(obj, "_salt_cache"):
obj._salt_cache = {}
salt = obj._salt_cache[id] = gen_salt()
encrypted = encrypt_md5(value, salt)
salt = obj._salt_cache[id] = gen_salt()
encrypted = encrypt_md5(value, salt)
else:
#setting a password to '' is allowed. It can be used to inactivate the classic log-in of the user
#while the access can still be granted by another login method (openid...)
encrypted = ''
cr.execute('update res_users set password=%s where id=%s',
(encrypted.encode('utf-8'), int(id)))
cr.commit()
del value
def get_pw( self, cr, uid, ids, name, args, context ):

View File

@ -40,7 +40,7 @@ class sale_order_line(osv.osv):
'event_id': fields.many2one('event.event', 'Event', help="Choose an event and it will automatically create a registration for this event."),
#those 2 fields are used for dynamic domains and filled by onchange
'event_type_id': fields.related('event_type_id', type='many2one', relation="event.type", string="Event Type"),
'event_ok': fields.related('event_ok', string='event_ok', type='boolean'),
'event_ok': fields.related('product_id', 'event_ok', string='event_ok', type='boolean'),
}
def product_id_change(self, cr, uid, ids,

View File

@ -17,7 +17,6 @@
priority: '3'
user_id: base.user_demo
partner_name: 'Marie Justine'
state: 'open'
partner_mobile: '9988774455'
job_id: hr.job_developer
stage_id: stage_job4
@ -41,7 +40,6 @@
type_id: degree_bac5
user_id: base.user_root
partner_name: 'Sandra Elvis'
state: 'cancel'
stage_id: stage_job6
name: 'More than 5 yrs Experience in PHP'
-
@ -50,7 +48,6 @@
type_id: degree_licenced
user_id: base.user_demo
partner_name: 'John Bruno'
state: 'done'
job_id: hr.job_developer
color: 5
stage_id: stage_job5
@ -61,8 +58,6 @@
type_id: degree_licenced
priority: '4'
partner_name: 'David Armstrong'
state: 'pending'
state: open
partner_mobile: '9966332214'
job_id: hr.job_developer
stage_id: stage_job2
@ -73,7 +68,6 @@
date: !eval time.strftime('%Y-%m-12 17:49:19')
type_id: degree_bac5
partner_name: 'Tina Augustie'
state: 'open'
partner_mobile: '9898745745'
job_id: hr.job_developer
stage_id: stage_job4
@ -85,7 +79,6 @@
date: !eval time.strftime('%Y-%m-12 17:49:19')
type_id: degree_bac5
partner_name: 'Shane Williams'
state: 'open'
partner_mobile: '9812398524'
stage_id: stage_job4
name: 'Programmer'

View File

@ -23,7 +23,7 @@
import time
uid = ref('base.user_demo')
new_id = self.create(cr, uid, {'emp_id': ref('hr.employee_qdp'), 'name': 'Quentin Paolino',
'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'present'})
'server_date': time.strftime('%Y-%m-%d %H:%M:%S')})
self.sign_in_result(cr, uid, [new_id], context)
-
I change my project "Thymbra" and I click on the "Change Work" button of this wizard

View File

@ -194,7 +194,7 @@
<para style="terp_tblheader_General_Right">Total:</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang(pos_payment_user_total(data['form'], currency_obj = company.currency_id)) or removeParentNode('blockTable')]]</para>
<para style="terp_default_Right_9">[[ formatLang(pos_payment_user_total(data['form']), currency_obj = company.currency_id) or removeParentNode('blockTable')]]</para>
</td>
</tr>
</blockTable>

View File

@ -777,7 +777,6 @@ class task(base_stage, osv.osv):
_defaults = {
'stage_id': _get_default_stage_id,
'project_id': _get_default_project_id,
'state': 'draft',
'kanban_state': 'normal',
'priority': '2',
'progress': 0,
@ -1030,7 +1029,6 @@ class task(base_stage, osv.osv):
'user_id': delegate_data['user_id'] and delegate_data['user_id'][0] or False,
'planned_hours': delegate_data['planned_hours'] or 0.0,
'parent_ids': [(6, 0, [task.id])],
'state': 'draft',
'description': delegate_data['new_task_description'] or '',
'child_ids': [],
'work_ids': []

View File

@ -275,7 +275,6 @@ class project_issue(base_stage, osv.osv):
'active': 1,
'partner_id': lambda s, cr, uid, c: s._get_default_partner(cr, uid, c),
'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c),
'state': 'draft',
'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c),
'section_id': lambda s, cr, uid, c: s._get_default_section_id(cr, uid, c),
'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c),
@ -332,7 +331,7 @@ class project_issue(base_stage, osv.osv):
})
vals = {
'task_id': new_task_id,
'state':'pending'
'stage_id': self.stage_find(cr, uid, [bug], bug.project_id.id, [('state', '=', 'pending')], context=context),
}
self.convert_to_task_send_note(cr, uid, [bug.id], context=context)
case_obj.write(cr, uid, [bug.id], vals, context=context)