From 2c46e9e8d16ed0d4ad3eae37b89ee45672f1dcc6 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 17 Oct 2012 13:57:18 +0200 Subject: [PATCH 01/15] [FIX] base_crypt: allow empty password to be set on res.users bzr revid: qdp-launchpad@openerp.com-20121017115718-y5wln78yq6097qt6 --- addons/base_crypt/crypt.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/addons/base_crypt/crypt.py b/addons/base_crypt/crypt.py index 81a60a5dd5f..3accc2740e9 100644 --- a/addons/base_crypt/crypt.py +++ b/addons/base_crypt/crypt.py @@ -140,15 +140,18 @@ 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() From d0c38a833ce7955b548ec46c7b17ca9c480fedfe Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Wed, 17 Oct 2012 14:38:14 +0200 Subject: [PATCH 02/15] [FIX] event_sale: fix stupid recursion error in definition of fields.related bzr revid: qdp-launchpad@openerp.com-20121017123814-qjcee8z1ftgzouqq --- addons/event_sale/event_sale.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/event_sale/event_sale.py b/addons/event_sale/event_sale.py index f37dea3f075..2dd40a7c285 100644 --- a/addons/event_sale/event_sale.py +++ b/addons/event_sale/event_sale.py @@ -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, From 4dfb95b46e7bdb0573a7631bf86c490e01039227 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 10:49:27 +0200 Subject: [PATCH 03/15] [FIX] mail: attempt to fix crazy bug bzr revid: qdp-launchpad@openerp.com-20121018084927-yr1mp6svwq55eayn --- addons/mail/mail_group.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py index 3febe34be51..eb53cf96078 100644 --- a/addons/mail/mail_group.py +++ b/addons/mail/mail_group.py @@ -61,7 +61,7 @@ class mail_group(osv.Model): 'image_medium': fields.function(_get_image, fnct_inv=_set_image, string="Medium-sized photo", type="binary", multi="_get_image", store={ - 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), + 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image', 'image_medium'], 10), }, help="Medium-sized photo of the group. It is automatically "\ "resized as a 128x128px image, with aspect ratio preserved. "\ @@ -69,7 +69,7 @@ class mail_group(osv.Model): 'image_small': fields.function(_get_image, fnct_inv=_set_image, string="Small-sized photo", type="binary", multi="_get_image", store={ - 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), + 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image', 'image_small'], 10), }, help="Small-sized photo of the group. It is automatically "\ "resized as a 64x64px image, with aspect ratio preserved. "\ From 47bed5e14f717f36e35e89d7e56b39ac74c008c6 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 12:02:22 +0200 Subject: [PATCH 04/15] [FIX] removing a cr.commit() bzr revid: qdp-launchpad@openerp.com-20121018100222-jttfkv4e8rq7a4pa --- addons/base_crypt/crypt.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/base_crypt/crypt.py b/addons/base_crypt/crypt.py index 3accc2740e9..14e029eb988 100644 --- a/addons/base_crypt/crypt.py +++ b/addons/base_crypt/crypt.py @@ -154,7 +154,6 @@ class users(osv.osv): 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 ): From 5795a34ec4e65980e7229fbfeb274cb5428df149 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 14:49:49 +0200 Subject: [PATCH 05/15] [FIX] project: state is not draft by default, but given by the stage bzr revid: qdp-launchpad@openerp.com-20121018124949-97x6tc5tlvskfh3f --- addons/project/project.py | 1 - addons/project/project_demo.xml | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index 9a022fffa90..8aa09065705 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -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, diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index cd22bad67d4..c9b6dce7cd8 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -129,6 +129,7 @@ Budget Planning + pending 4 From 3555be5c5630f5b29c6be925a0207a91b6ff4546 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 14:54:23 +0200 Subject: [PATCH 06/15] [FIX] project: when delegating a task, do copy the task state too bzr revid: qdp-launchpad@openerp.com-20121018125423-8qj0j380j7odvaz0 --- addons/project/project.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index 8aa09065705..56d7fef0e49 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -1029,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': [] From ed7ea104b87bd767e6aee14d06a2a0024698844d Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 15:00:26 +0200 Subject: [PATCH 07/15] [FIX] account, overdue report: fixed error 'partner has no attribute named partner_id' bzr revid: qdp-launchpad@openerp.com-20121018130026-m76e7xja21v1stbm --- addons/account/report/account_print_overdue.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 8b8238030fe..1755f0a334d 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -129,7 +129,7 @@ [[ o.title.name or '' ]] [[ o.name ]] - [[ display_address(o.partner_id) ]] + [[ display_address(o.id) ]] From e25d11022f24c76f9c9903bdc9572ead018de423 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 15:42:12 +0200 Subject: [PATCH 08/15] [FIX] hr_recruitment: fixed yaml test that was creating records with inconsistent data (stage & state should be syncro as state is a fields.related) bzr revid: qdp-launchpad@openerp.com-20121018134212-z4o0qmuleubx70zt --- addons/hr_recruitment/hr_recruitment_demo.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment_demo.yml b/addons/hr_recruitment/hr_recruitment_demo.yml index 3f00c7e643b..2554c690c15 100644 --- a/addons/hr_recruitment/hr_recruitment_demo.yml +++ b/addons/hr_recruitment/hr_recruitment_demo.yml @@ -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' From a292f894ef68fbd8efac9b492635f91e607aef68 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 15:57:28 +0200 Subject: [PATCH 09/15] [FIX] project_issue: fix inconsistent data (stage & state should be syncro as state is a fields.related) bzr revid: qdp-launchpad@openerp.com-20121018135728-jaynrxb88550ydgt --- addons/project_issue/project_issue.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index 9e434078d2f..1cb5b20edbd 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -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) From e5ea70b4c26b9e7d45339c42ef391f41ac1ff1f0 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 15:59:49 +0200 Subject: [PATCH 10/15] [FIX] point_of_sale: typo in report bzr revid: qdp-launchpad@openerp.com-20121018135949-b08zihsoo7s0km05 --- addons/point_of_sale/report/pos_payment_report_user.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/report/pos_payment_report_user.rml b/addons/point_of_sale/report/pos_payment_report_user.rml index 1d89d28c5f9..3671408b760 100644 --- a/addons/point_of_sale/report/pos_payment_report_user.rml +++ b/addons/point_of_sale/report/pos_payment_report_user.rml @@ -194,7 +194,7 @@ Total: - [[ formatLang(pos_payment_user_total(data['form'], currency_obj = company.currency_id)) or removeParentNode('blockTable')]] + [[ formatLang(pos_payment_user_total(data['form']), currency_obj = company.currency_id) or removeParentNode('blockTable')]] From b4fbe43de11dfc4801d34fd5f3bbfcf15b08b24f Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 16:26:01 +0200 Subject: [PATCH 11/15] [REV] reverting some useless patches before merge in feature branch bzr revid: qdp-launchpad@openerp.com-20121018142601-trgb2kbgrvzl4jk2 --- addons/mail/mail_group.py | 4 ++-- addons/project/project_demo.xml | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py index eb53cf96078..3febe34be51 100644 --- a/addons/mail/mail_group.py +++ b/addons/mail/mail_group.py @@ -61,7 +61,7 @@ class mail_group(osv.Model): 'image_medium': fields.function(_get_image, fnct_inv=_set_image, string="Medium-sized photo", type="binary", multi="_get_image", store={ - 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image', 'image_medium'], 10), + 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Medium-sized photo of the group. It is automatically "\ "resized as a 128x128px image, with aspect ratio preserved. "\ @@ -69,7 +69,7 @@ class mail_group(osv.Model): 'image_small': fields.function(_get_image, fnct_inv=_set_image, string="Small-sized photo", type="binary", multi="_get_image", store={ - 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image', 'image_small'], 10), + 'mail.group': (lambda self, cr, uid, ids, c={}: ids, ['image'], 10), }, help="Small-sized photo of the group. It is automatically "\ "resized as a 64x64px image, with aspect ratio preserved. "\ diff --git a/addons/project/project_demo.xml b/addons/project/project_demo.xml index c9b6dce7cd8..cd22bad67d4 100644 --- a/addons/project/project_demo.xml +++ b/addons/project/project_demo.xml @@ -129,7 +129,6 @@ Budget Planning - pending 4 From 4b426887fff69340bcd79e0e4d4a024f9b51dd06 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Thu, 18 Oct 2012 16:33:32 +0200 Subject: [PATCH 12/15] [FIX] account: print overdue report bzr revid: qdp-launchpad@openerp.com-20121018143332-rwbydw558m1jgp13 --- addons/account/report/account_print_overdue.rml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account/report/account_print_overdue.rml b/addons/account/report/account_print_overdue.rml index 1755f0a334d..3e8b9b04b62 100644 --- a/addons/account/report/account_print_overdue.rml +++ b/addons/account/report/account_print_overdue.rml @@ -129,7 +129,7 @@ [[ o.title.name or '' ]] [[ o.name ]] - [[ display_address(o.id) ]] + [[ display_address(o) ]] From 8ca8f50656740a3204e85358683f6c93671182a8 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 19 Oct 2012 13:07:20 +0200 Subject: [PATCH 13/15] [FIX] account_voucher: fixed yaml test in order to reflect what the client are really sending as information bzr revid: qdp-launchpad@openerp.com-20121019110720-xhkhzd04caczsz41 --- addons/account_voucher/account_voucher.py | 2 +- addons/account_voucher/test/account_voucher.yml | 1 - addons/account_voucher/test/sales_payment.yml | 5 ++++- addons/account_voucher/test/sales_receipt.yml | 1 - 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 648576443a0..3ae421308b5 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -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} diff --git a/addons/account_voucher/test/account_voucher.yml b/addons/account_voucher/test/account_voucher.yml index f8e20f496e5..c9270dc695c 100644 --- a/addons/account_voucher/test/account_voucher.yml +++ b/addons/account_voucher/test/account_voucher.yml @@ -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 diff --git a/addons/account_voucher/test/sales_payment.yml b/addons/account_voucher/test/sales_payment.yml index 88f10e55918..b71e42add0b 100644 --- a/addons/account_voucher/test/sales_payment.yml +++ b/addons/account_voucher/test/sales_payment.yml @@ -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) diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index 7cd82eecaff..cf4bc5c46d3 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -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'), From b5f8932458fb35c51e26c090df0fad6f50f2acd5 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 19 Oct 2012 13:54:25 +0200 Subject: [PATCH 14/15] [FIX] hr_timesheet: fixed yaml test that as giving a value for a related readonly field bzr revid: qdp-launchpad@openerp.com-20121019115425-97fxn854e3icp3dm --- addons/hr_timesheet/test/test_hr_timesheet.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet/test/test_hr_timesheet.yml b/addons/hr_timesheet/test/test_hr_timesheet.yml index cc04bed734d..59d688f183b 100644 --- a/addons/hr_timesheet/test/test_hr_timesheet.yml +++ b/addons/hr_timesheet/test/test_hr_timesheet.yml @@ -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 From 5b4fde2485f7c4f1b93dc1634c7929404fdcdaeb Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 19 Oct 2012 15:30:50 +0200 Subject: [PATCH 15/15] [FIX] account: the readonly fields aren't send to the server at the record creation bzr revid: qdp-launchpad@openerp.com-20121019133050-7h8gx3beir992xlw --- addons/account/account.py | 3 +++ addons/account/account_move_line.py | 9 ++++++--- addons/account/test/account_validate_account_move.yml | 7 ++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index fa2b10a7478..3e07f151de3 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -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: diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index f9388706e97..67a55d8f451 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -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 diff --git a/addons/account/test/account_validate_account_move.yml b/addons/account/test/account_validate_account_move.yml index 65ae2877125..df58da6dfea 100644 --- a/addons/account/test/account_validate_account_move.yml +++ b/addons/account/test/account_validate_account_move.yml @@ -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" \ No newline at end of file + assert move_line[0].reconcile_partial_id, "Partial reconcilation is not done"