From f33ede7c6fc5c1321644a906f74bd2a9e5a15e2b Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Fri, 12 Aug 2011 15:47:42 +0530 Subject: [PATCH 001/373] [IMP] Project time shoudl consider it;s parents also bzr revid: jam@tinyerp.com-20110812101742-njb0418if0uhgbbw --- addons/project/project.py | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index b1461da424c..c474bb620ba 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -80,6 +80,16 @@ class project(osv.osv): pricelist_id = pricelist.get('property_product_pricelist', False) and pricelist.get('property_product_pricelist')[0] or False return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}} + def get_childs(self, cr, uid, ids, context=None): + cr.execute("""SELECT id FROM project_project WHERE analytic_account_id IN ( + SELECT id FROM account_analytic_account WHERE parent_id = ( + SELECT id FROM account_analytic_account WHERE id = ( + SELECT analytic_account_id FROM project_project WHERE id = %s + ) + ) + )"""%(ids)) + return cr.fetchall() + def _progress_rate(self, cr, uid, ids, names, arg, context=None): res = {}.fromkeys(ids, 0.0) if not ids: @@ -93,14 +103,31 @@ class project(osv.osv): state<>'cancelled' GROUP BY project_id''', (tuple(ids),)) - progress = dict(map(lambda x: (x[0], (x[1],x[2],x[3],x[4])), cr.fetchall())) + progress = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) for project in self.browse(cr, uid, ids, context=context): - s = progress.get(project.id, (0.0,0.0,0.0,0.0)) + childs = self.get_childs( cr, uid, project.id, context) + project_ids = [project.id] + if childs: + project_ids += [ child[0] for child in childs ] res[project.id] = { - 'planned_hours': s[0], - 'effective_hours': s[2], - 'total_hours': s[1], - 'progress_rate': s[1] and round(100.0*s[2]/s[1],2) or 0.0 + 'planned_hours':0.0, + 'effective_hours': 0.0, + 'total_hours': 0.0, + 'progress_rate':0.0 + } + planned_hours, effective_hours, total_hours= 0.0, 0.0,0.0 + for child in project_ids: + s = progress.get(child, (0.0,0.0,0.0,0.0)) + planned_hours, effective_hours, total_hours = planned_hours+s[0] or 0.0, effective_hours+s[2] or 0.0, total_hours+s[1] or 0.0 + if planned_hours == 0: + rnd = 0.0 + else: + rnd = round((effective_hours/planned_hours)*100,2) or 0.0 + res[project.id] = { + 'planned_hours': res.get(project.id).get('planned_hours')+ planned_hours, + 'effective_hours': res.get(project.id).get('effective_hours')+ effective_hours, + 'total_hours': res.get(project.id).get('total_hours')+ total_hours, + 'progress_rate': rnd } return res From aad408531416354fafbedce2ff883382bce2a51d Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Fri, 12 Aug 2011 16:03:54 +0530 Subject: [PATCH 002/373] imporved injection sql bzr revid: jam@tinyerp.com-20110812103354-0mo9szu5u7wzr3zn --- addons/project/project.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index c474bb620ba..762ad6add8c 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -82,12 +82,12 @@ class project(osv.osv): def get_childs(self, cr, uid, ids, context=None): cr.execute("""SELECT id FROM project_project WHERE analytic_account_id IN ( - SELECT id FROM account_analytic_account WHERE parent_id = ( - SELECT id FROM account_analytic_account WHERE id = ( - SELECT analytic_account_id FROM project_project WHERE id = %s - ) - ) - )"""%(ids)) + SELECT id FROM account_analytic_account WHERE parent_id = ( + SELECT analytic_account_id FROM project_project project + LEFT JOIN account_analytic_account account ON account.id = project.analytic_account_id + WHERE project.id = %s + ) + )"""%(ids)) return cr.fetchall() def _progress_rate(self, cr, uid, ids, names, arg, context=None): From 65051f36952efe2997b9d5e6e306ce657ec34739 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Tue, 27 Sep 2011 15:55:14 +0530 Subject: [PATCH 003/373] [FIX] project - returnof the store bzr revid: jam@tinyerp.com-20110927102514-rge1jer11yyznttx --- addons/project/project.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index 136008aef79..1b728b538d1 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -133,7 +133,12 @@ class project(osv.osv): def _get_project_task(self, cr, uid, ids, context=None): result = {} for task in self.pool.get('project.task').browse(cr, uid, ids, context=context): - if task.project_id: result[task.project_id.id] = True + if task.project_id: + result[task.project_id.id] = True + if task.project_id.parent_id: + cr.execute('''SELECT id FROM project_project WHERE analytic_account_id = '%s' '''%task.project_id.parent_id.id) + for parent in cr.fetchall(): + result[parent[0]] = True return result.keys() def _get_project_work(self, cr, uid, ids, context=None): From 1a4a2b4dd8feb0e7d861eae0656b60e0d6e4cdcf Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Wed, 28 Sep 2011 18:30:33 +0530 Subject: [PATCH 004/373] [FIX] project - calcaulting parent child caluesonchnage of task and parent_id bzr revid: jam@tinyerp.com-20110928130033-el7n8edu0erp95b6 --- addons/project/project.py | 81 ++++++++++++++++++++++++++------------- 1 file changed, 54 insertions(+), 27 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 1b728b538d1..99ec9df8db5 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -79,20 +79,37 @@ class project(osv.osv): pricelist_id = pricelist.get('property_product_pricelist', False) and pricelist.get('property_product_pricelist')[0] or False return {'value':{'contact_id': addr['contact'], 'pricelist_id': pricelist_id}} - def get_childs(self, cr, uid, ids, context=None): + def _get_childs(self, cr, uid, ids, childs,context=None): cr.execute("""SELECT id FROM project_project WHERE analytic_account_id IN ( SELECT id FROM account_analytic_account WHERE parent_id = ( SELECT analytic_account_id FROM project_project project LEFT JOIN account_analytic_account account ON account.id = project.analytic_account_id WHERE project.id = %s ) - )"""%(ids)) - return cr.fetchall() + )"""%(ids)) + for child in cr.fetchall(): + if child: + if child[0] not in childs: childs.append(child[0]) + self._get_childs( cr, uid, child[0], childs,context) + return childs + + + def _get_parents(self, cr, uid, ids, parents,context=None): + for project in self.read(cr, uid, ids, ['id', 'parent_id'],context): + if project.get('parent_id'): + cr.execute('''SELECT id FROM project_project WHERE analytic_account_id = '%s' '''%project.get('parent_id')[0]) + for child in cr.fetchall(): + if child[0] not in parents: parents.append(child[0]) + child_rec= self.read(cr, uid, child[0], ['id', 'parent_id'],context) + if child_rec.get('parent_id'): + parents = self._get_parents(cr, uid, [child[0]], parents,context) + return parents def _progress_rate(self, cr, uid, ids, names, arg, context=None): res = {}.fromkeys(ids, 0.0) if not ids: return res + parents = self._get_parents(cr, uid, ids, ids,context) cr.execute('''SELECT project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours) FROM @@ -103,31 +120,41 @@ class project(osv.osv): GROUP BY project_id''', (tuple(ids),)) progress = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) - for project in self.browse(cr, uid, ids, context=context): - childs = self.get_childs( cr, uid, project.id, context) - project_ids = [project.id] - if childs: - project_ids += [ child[0] for child in childs ] + for project in self.browse(cr, uid, parents, context=context): + childs = [] + childs = self._get_childs(cr, uid, project.id, childs,context) + s = progress.get(project.id, (0.0,0.0,0.0,0.0)) res[project.id] = { - 'planned_hours':0.0, - 'effective_hours': 0.0, - 'total_hours': 0.0, - 'progress_rate':0.0 + 'planned_hours': s[0], + 'effective_hours': s[2], + 'total_hours': s[1], + 'progress_rate': s[1] and round(100.0*s[2]/s[1],2) or 0.0 } planned_hours, effective_hours, total_hours= 0.0, 0.0,0.0 - for child in project_ids: - s = progress.get(child, (0.0,0.0,0.0,0.0)) - planned_hours, effective_hours, total_hours = planned_hours+s[0] or 0.0, effective_hours+s[2] or 0.0, total_hours+s[1] or 0.0 - if planned_hours == 0: - rnd = 0.0 - else: - rnd = round((effective_hours/planned_hours)*100,2) or 0.0 - res[project.id] = { - 'planned_hours': res.get(project.id).get('planned_hours')+ planned_hours, - 'effective_hours': res.get(project.id).get('effective_hours')+ effective_hours, - 'total_hours': res.get(project.id).get('total_hours')+ total_hours, - 'progress_rate': rnd - } + if childs: + cr.execute('''SELECT + project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours) + FROM + project_task + WHERE + project_id in %s AND + state<>'cancelled' + GROUP BY + project_id''', (tuple(childs),)) + progress2 = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) + for child in childs: + s2 = progress2.get(child, (0.0,0.0,0.0,0.0)) + planned_hours, effective_hours, total_hours = planned_hours+s2[0], effective_hours+s2[2] , total_hours+s2[1] + if planned_hours == 0: + rnd = 0.0 + else: + rnd = round((effective_hours/planned_hours)*100,2) or 0.0 + res[project.id] = { + 'planned_hours': res.get(project.id).get('planned_hours')+ planned_hours, + 'effective_hours': res.get(project.id).get('effective_hours')+ effective_hours, + 'total_hours': res.get(project.id).get('total_hours')+ total_hours, + 'progress_rate': res.get(project.id).get('progress_rate')+ rnd + } return res def _get_project_task(self, cr, uid, ids, context=None): @@ -166,13 +193,13 @@ class project(osv.osv): 'tasks': fields.one2many('project.task', 'project_id', "Project tasks"), 'planned_hours': fields.function(_progress_rate, multi="progress", string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.", store = { - 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 10), + 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks', 'parent_id'], 10), 'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours','state'], 10), }), 'effective_hours': fields.function(_progress_rate, multi="progress", string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects."), 'total_hours': fields.function(_progress_rate, multi="progress", string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.", store = { - 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks'], 10), + 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks','parent_id'], 10), 'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours','state'], 10), }), 'progress_rate': fields.function(_progress_rate, multi="progress", string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo."), From 66f7f0ac91b9419c959e19a927bd2e91630692ca Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 3 Oct 2011 11:44:54 +0530 Subject: [PATCH 005/373] [FIX] project added child in fields.function trigger bzr revid: jam@tinyerp.com-20111003061454-aoakxovqrw9uxtl8 --- addons/project/project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index e8c1d96be89..8b13955b803 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -193,13 +193,13 @@ class project(osv.osv): 'tasks': fields.one2many('project.task', 'project_id', "Project tasks"), 'planned_hours': fields.function(_progress_rate, multi="progress", string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects.", store = { - 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks', 'parent_id'], 10), + 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks', 'parent_id', 'child_ids'], 10), 'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours','state'], 10), }), 'effective_hours': fields.function(_progress_rate, multi="progress", string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects."), 'total_hours': fields.function(_progress_rate, multi="progress", string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects.", store = { - 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks','parent_id'], 10), + 'project.project': (lambda self, cr, uid, ids, c={}: ids, ['tasks','parent_id', 'child_ids'], 10), 'project.task': (_get_project_task, ['planned_hours', 'effective_hours', 'remaining_hours', 'total_hours', 'progress', 'delay_hours','state'], 10), }), 'progress_rate': fields.function(_progress_rate, multi="progress", string='Progress', type='float', group_operator="avg", help="Percent of tasks closed according to the total of tasks todo."), From eb0dfa2555ed939468d32e230d9f19850657371b Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 3 Oct 2011 15:17:19 +0530 Subject: [PATCH 006/373] [FIX] cide usabality bzr revid: jam@tinyerp.com-20111003094719-c3tepdje2wd81xyb --- addons/project/project.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 8b13955b803..1fb828c78d4 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -88,9 +88,8 @@ class project(osv.osv): ) )"""%(ids)) for child in cr.fetchall(): - if child: - if child[0] not in childs: childs.append(child[0]) - self._get_childs( cr, uid, child[0], childs,context) + if child[0] not in childs: childs.append(child[0]) + self._get_childs( cr, uid, child[0], childs,context) return childs @@ -130,7 +129,7 @@ class project(osv.osv): 'total_hours': s[1], 'progress_rate': s[1] and round(100.0*s[2]/s[1],2) or 0.0 } - planned_hours, effective_hours, total_hours= 0.0, 0.0,0.0 + if childs: cr.execute('''SELECT project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours) @@ -141,19 +140,18 @@ class project(osv.osv): state<>'cancelled' GROUP BY project_id''', (tuple(childs),)) - progress2 = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) + child_progress = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) + planned_hours, effective_hours, total_hours, rnd= 0.0, 0.0,0.0, 0.0 for child in childs: - s2 = progress2.get(child, (0.0,0.0,0.0,0.0)) - planned_hours, effective_hours, total_hours = planned_hours+s2[0], effective_hours+s2[2] , total_hours+s2[1] - if planned_hours == 0: - rnd = 0.0 - else: - rnd = round((effective_hours/planned_hours)*100,2) or 0.0 + ch_vals = child_progress.get(child, (0.0,0.0,0.0,0.0)) + planned_hours, effective_hours, total_hours = planned_hours+ch_vals[0], effective_hours+ch_vals[2] , total_hours+ch_vals[1] + if res.get(project.id).get('planned_hours')+ planned_hours > 0: + rnd = round(( res.get(project.id).get('effective_hours')+effective_hours)/(res.get(project.id).get('planned_hours')+ planned_hours)*100,2) or 0.0 res[project.id] = { 'planned_hours': res.get(project.id).get('planned_hours')+ planned_hours, 'effective_hours': res.get(project.id).get('effective_hours')+ effective_hours, 'total_hours': res.get(project.id).get('total_hours')+ total_hours, - 'progress_rate': res.get(project.id).get('progress_rate')+ rnd + 'progress_rate': rnd } return res From 21bc53d02392a06137ab5e637b6efa7bafa7592d Mon Sep 17 00:00:00 2001 From: "Dhara (OpenERP)" <> Date: Thu, 13 Oct 2011 14:11:47 -0700 Subject: [PATCH 007/373] [NEW] Account Check Writing-1 bzr revid: dhara_openerp-20111013211147-hs0qruje2t6vnyl5 --- addons/account_check_writing/__init__.py | 26 ++ addons/account_check_writing/__openerp__.py | 48 +++ addons/account_check_writing/account.py | 50 +++ .../account_check_writing_data.xml | 15 + .../account_check_writing_report.xml | 29 ++ addons/account_check_writing/account_demo.xml | 9 + addons/account_check_writing/account_view.xml | 42 ++ .../account_check_writing/account_voucher.py | 121 ++++++ .../account_voucher_view.xml | 56 +++ .../account_check_writing/report/__init__.py | 25 ++ .../report/check_print.py | 108 ++++++ .../report/check_print_bottom.rml | 321 ++++++++++++++++ .../report/check_print_middle.rml | 359 ++++++++++++++++++ .../report/check_print_top.rml | 338 +++++++++++++++++ 14 files changed, 1547 insertions(+) create mode 100644 addons/account_check_writing/__init__.py create mode 100644 addons/account_check_writing/__openerp__.py create mode 100644 addons/account_check_writing/account.py create mode 100644 addons/account_check_writing/account_check_writing_data.xml create mode 100644 addons/account_check_writing/account_check_writing_report.xml create mode 100644 addons/account_check_writing/account_demo.xml create mode 100644 addons/account_check_writing/account_view.xml create mode 100644 addons/account_check_writing/account_voucher.py create mode 100644 addons/account_check_writing/account_voucher_view.xml create mode 100644 addons/account_check_writing/report/__init__.py create mode 100644 addons/account_check_writing/report/check_print.py create mode 100644 addons/account_check_writing/report/check_print_bottom.rml create mode 100644 addons/account_check_writing/report/check_print_middle.rml create mode 100644 addons/account_check_writing/report/check_print_top.rml diff --git a/addons/account_check_writing/__init__.py b/addons/account_check_writing/__init__.py new file mode 100644 index 00000000000..0451b2bdb6a --- /dev/null +++ b/addons/account_check_writing/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import account +import account_voucher +import wizard +import report +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_check_writing/__openerp__.py b/addons/account_check_writing/__openerp__.py new file mode 100644 index 00000000000..c09288f6955 --- /dev/null +++ b/addons/account_check_writing/__openerp__.py @@ -0,0 +1,48 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name" : "Check writing", + "version" : "1.1", + "author" : "OpenERP SA, NovaPoint Group", + "category": "Generic Modules/Accounting", + "description": """ + Module for the Check writing and check printing + """, + 'website': 'http://www.openerp.com', + 'init_xml': [], + "depends" : [ + "account_voucher", + ], + 'update_xml': [ + 'account_check_writing_report.xml', + 'account_view.xml', + 'account_voucher_view.xml', + 'account_check_writing_data.xml', + ], + 'demo_xml': [ + 'account_demo.xml', + ], + 'test': [ + ], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_check_writing/account.py b/addons/account_check_writing/account.py new file mode 100644 index 00000000000..4dbbc245033 --- /dev/null +++ b/addons/account_check_writing/account.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import osv,fields + +class account_journal(osv.osv): + _inherit = "account.journal" + + _columns = { + 'allow_check_writing': fields.boolean('Allow Check writing', help='Check this if the journal is to be used for writing checks.'), + 'use_preprint_check': fields.boolean('Use Preprinted Check'), + } + +account_journal() + +class res_company(osv.osv): + _inherit = "res.company" + _columns = { + 'check_layout': fields.selection([ + ('top', 'Check on Top'), + ('middle', 'Check in middle'), + ('bottom', 'Check on bottom'), + ],"Choose Check layout", + help="Check on top is compatible with Quicken, QuickBooks and Microsoft Money. Check in middle is compatible with Peachtree, ACCPAC and DacEasy. Check on bottom is compatible with Peachtree, ACCPAC and DacEasy only" ), + } + + _defaults = { + 'check_layout' : lambda *a: 'top', + } + +res_company() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_check_writing/account_check_writing_data.xml b/addons/account_check_writing/account_check_writing_data.xml new file mode 100644 index 00000000000..324967836c2 --- /dev/null +++ b/addons/account_check_writing/account_check_writing_data.xml @@ -0,0 +1,15 @@ + + + + + Check Number + check.number + + + + Check Number + check.number + + + + diff --git a/addons/account_check_writing/account_check_writing_report.xml b/addons/account_check_writing/account_check_writing_report.xml new file mode 100644 index 00000000000..062827d3aa2 --- /dev/null +++ b/addons/account_check_writing/account_check_writing_report.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + diff --git a/addons/account_check_writing/account_demo.xml b/addons/account_check_writing/account_demo.xml new file mode 100644 index 00000000000..d4d772f597a --- /dev/null +++ b/addons/account_check_writing/account_demo.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/addons/account_check_writing/account_view.xml b/addons/account_check_writing/account_view.xml new file mode 100644 index 00000000000..529bfab2537 --- /dev/null +++ b/addons/account_check_writing/account_view.xml @@ -0,0 +1,42 @@ + + + + + + + + account.journal.form + account.journal + form + + + + + + + + + + + + + + res.company.check.format + res.company + form + 17 + + + + + + + + + + + diff --git a/addons/account_check_writing/account_voucher.py b/addons/account_check_writing/account_voucher.py new file mode 100644 index 00000000000..5d1d08018a8 --- /dev/null +++ b/addons/account_check_writing/account_voucher.py @@ -0,0 +1,121 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import osv,fields +from tools.translate import _ +from tools.amount_to_text_en import amount_to_text +from lxml import etree + +check_layout_report = { + 'top' : 'account.print.check.top', + 'middle' : 'account.print.check.middle', + 'bottom' : 'account.print.check.bottom', +} + +class account_voucher(osv.osv): + _inherit = 'account.voucher' + + def _get_journal(self, cr, uid, context=None): + + if context is None: context = {} + + journal_pool = self.pool.get('account.journal') + invoice_pool = self.pool.get('account.invoice') + + if context.get('invoice_id', False): + currency_id = invoice_pool.browse(cr, uid, context['invoice_id'], context=context).currency_id.id + journal_id = journal_pool.search(cr, uid, [('currency', '=', currency_id)], limit=1) + return journal_id and journal_id[0] or False + + if context.get('journal_id', False): + return context.get('journal_id') + + if not context.get('journal_id', False) and context.get('search_default_journal_id', False): + return context.get('search_default_journal_id') + + ttype = context.get('type', 'bank') + + if ttype in ('payment', 'receipt'): + ttype = 'bank' + if context.get('write_check',False) : + res = journal_pool.search(cr, uid, [('allow_check_writing', '=', True)], limit=1) + else : + res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1) + return res and res[0] or False + + _columns = { + 'amount_in_word' : fields.char("Amount in word" , size=128, readonly=True, states={'draft':[('readonly',False)]}), + 'allow_check' : fields.boolean('Allow Check Writing'), + 'number': fields.char('Number', size=32), + } + + _defaults = { + 'journal_id':_get_journal, + } + + def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None): + """ Inherited - add amount_in_word in return value dictionary """ + + if not context: + context = {} + default = super(account_voucher, self).onchange_partner_id(cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=context) + if 'value' in default: + amount = 'amount' in default['value'] and default['value']['amount'] or price + + #TODO : generic amount_to_text is not ready yet, otherwise language and currency can be passed + + amount_in_word = amount_to_text(amount) + default['value'].update({'amount_in_word':amount_in_word}) + + if journal_id: + allow_check_writing = self.pool.get('account.journal').browse(cr, uid, journal_id).allow_check_writing + default['value'].update({'allow_check':allow_check_writing}) + + return default + + def print_check(self, cr, uid, ids, context=None): + if not ids: return [] + + check_layout = self.browse(cr, uid, ids[0], context=context).company_id.check_layout + + return { + 'type': 'ir.actions.report.xml', + 'report_name':check_layout_report[check_layout], + 'datas': { + 'model':'account.voucher', + 'id': ids and ids[0] or False, + 'ids': ids and ids or [], + 'report_type': 'pdf' + }, + 'nodestroy': True + } + + def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False): + res = super(account_voucher, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu) + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='journal_id']") + if context.get('write_check', False) : + for node in nodes: + node.set('domain', "[('type', '=', 'bank')]") + res['arch'] = etree.tostring(doc) + return res + +account_voucher() diff --git a/addons/account_check_writing/account_voucher_view.xml b/addons/account_check_writing/account_voucher_view.xml new file mode 100644 index 00000000000..65d388ab42b --- /dev/null +++ b/addons/account_check_writing/account_voucher_view.xml @@ -0,0 +1,56 @@ + + + + + + + + account.voucher.payment.check.form + account.voucher + form + + + + + + + + + + + + + + + + + Write Checks + account.voucher + form + form,tree + [('journal_id.type', '=', 'bank'), ('type','=','payment'), ('journal_id.allow_check_writing','=',True)] + {'type':'payment','write_check':True} + + current + The check payment form allows you to track the payment you do to your suppliers specially by check. When you select a supplier, the payment method and an amount for the payment, OpenERP will propose to reconcile your payment with the open supplier invoices or bills.You can print the check + + + + + form + + + + + + + tree + + + + + + diff --git a/addons/account_check_writing/report/__init__.py b/addons/account_check_writing/report/__init__.py new file mode 100644 index 00000000000..e160380caea --- /dev/null +++ b/addons/account_check_writing/report/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import check_print + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/account_check_writing/report/check_print.py b/addons/account_check_writing/report/check_print.py new file mode 100644 index 00000000000..e0460964be5 --- /dev/null +++ b/addons/account_check_writing/report/check_print.py @@ -0,0 +1,108 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## + +import time +from report import report_sxw +from tools import amount_to_text_en + +class report_print_check(report_sxw.rml_parse): + def __init__(self, cr, uid, name, context): + super(report_print_check, self).__init__(cr, uid, name, context) + self.number_lines = 0 + self.number_add = 0 + self.localcontext.update({ + 'time': time, + 'get_lines': self.get_lines, + 'fill_stars' : self.fill_stars, + 'get_zip_line': self.get_zip_line, + }) + def fill_stars(self, amount): + amount = amount.replace('Dollars','') + if len(amount) < 100: #TODO + stars = 100 - len(amount) + return ' '.join([amount,'*'*stars]) + + else: return amount + + def get_zip_line(self, address): + ''' + Get the address line + ''' + ret = '' + if address: + if address.city: + ret += address.city + if address.state_id: + if address.state_id.name: + if ret: + ret += ', ' + ret += address.state_id.name + if address.zip: + if ret: + ret += ' ' + ret += address.zip + return ret + + def get_lines(self, voucher_lines): + result = [] + self.number_lines = len(voucher_lines) + print "==============",voucher_lines + for i in range(0, min(10,self.number_lines)): + if i < self.number_lines: + res = { + 'date_due' : voucher_lines[i].date_due, + 'name' : voucher_lines[i].name, + 'amount_original' : voucher_lines[i].amount_original and voucher_lines[i].amount_original or False, + 'amount_unreconciled' : voucher_lines[i].amount_unreconciled and voucher_lines[i].amount_unreconciled or False, + 'amount' : voucher_lines[i].amount and voucher_lines[i].amount or False, + } + else : + res = { + 'date_due' : False, + 'name' : False, + 'amount_original' : False, + 'amount_due' : False, + 'amount' : False, + } + result.append(res) + return result + +report_sxw.report_sxw( + 'report.account.print.check.top', + 'account.voucher', + 'addons/account_check_writing/report/check_print_top.rml', + parser=report_print_check,header=False +) + +report_sxw.report_sxw( + 'report.account.print.check.middle', + 'account.voucher', + 'addons/account_check_writing/report/check_print_middle.rml', + parser=report_print_check,header=False +) + +report_sxw.report_sxw( + 'report.account.print.check.bottom', + 'account.voucher', + 'addons/account_check_writing/report/check_print_bottom.rml', + parser=report_print_check,header=False +) +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_check_writing/report/check_print_bottom.rml b/addons/account_check_writing/report/check_print_bottom.rml new file mode 100644 index 00000000000..231edb65547 --- /dev/null +++ b/addons/account_check_writing/report/check_print_bottom.rml @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[repeatIn(objects,'voucher')]] + + + + + + + [[voucher.partner_id.name]] + + + [[ formatLang(voucher.date , date=True) or '' ]] [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + Due Date + + + Description + + + Original Amount + + + Balance Due + + + Discount + + + Payment + + + + + [[ repeatIn(get_lines(voucher.line_dr_ids),'l') ]] [[ formatLang(l['date_original'] ,date=True) or '' ]] + + + [[ l['name'] ]] + + + [[formatLang( l['amount_original']) ]] + + + [[ formatLang( l['amount_due']) ]] + + + + + + + + [[ formatLang (l['amount']) ]] + + + + + + + Check Amount + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + + + + + [[voucher.partner_id.name]] + + + [[ formatLang(voucher.date , date=True) or '' ]] [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + Due Date + + + Description + + + Original Amount + + + Balance Due + + + Discount + + + Payment + + + + + [[ repeatIn(get_lines(voucher.line_dr_ids),'l') ]] [[ formatLang(l['date_original'] ,date=True) or '' ]] + + + [[ l['name'] ]] + + + [[ formatLang (l['amount_original']) ]] + + + [[ formatLang (l['amount_due']) ]] + + + + + + + + [[ formatLang (l['amount']) ]] + + + + + + + Check Amount + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + + + + + + + + + + + + + [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + + [[ formatLang(voucher.date , date=True) or '' ]] + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + [[ voucher.partner_id.name ]] + [[ voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street or removeParentNode('para') ]] + [[ voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street2 or removeParentNode('para') ]] + [[ get_zip_line(voucher.partner_id.address) ]] + [[ voucher.partner_id.address[0].country_id.name]] + + + + + + + [[ fill_stars(voucher.amount_in_word) ]] + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/addons/account_check_writing/report/check_print_middle.rml b/addons/account_check_writing/report/check_print_middle.rml new file mode 100644 index 00000000000..a6416f9aeb2 --- /dev/null +++ b/addons/account_check_writing/report/check_print_middle.rml @@ -0,0 +1,359 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[repeatIn(objects,'voucher')]] + + + + + + + + + + [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + [[voucher.partner_id.name]] + + + [[ formatLang(voucher.date , date=True) or '' ]] + + + + + + + Due Date + + + Description + + + Original Amount + + + Balance Due + + + Discount + + + Payment + + + + + [[ repeatIn(get_lines(voucher.line_dr_ids),'l') ]] [[ formatLang(l['date_original'] ,date=True) or '' ]] + + + [[ l['name'] ]] + + + [[formatLang( l['amount_original']) ]] + + + [[ formatLang( l['amount_due']) ]] + + + + + + + + [[ formatLang (l['amount']) ]] + + + + + + + Check Amount + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + + + + [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + + + + + + + [[ str(fill_stars(voucher.amount_in_word)) ]] + + + + + + + + + + + + + + + + + + + + + + + + [[ formatLang(voucher.date , date=True) or '' ]] + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + [[ voucher.partner_id.name ]] + [[ voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street or removeParentNode('para') ]] + [[ voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street2 or removeParentNode('para') ]] + [[ get_zip_line(voucher.partner_id.address) ]] + [[ voucher.partner_id.address[0].country_id.name]] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[voucher.partner_id.name]] + + + [[ formatLang(voucher.date , date=True) or '' ]] + + + [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + Due Date + + + Description + + + Original Amount + + + Balance Due + + + Discount + + + Payment + + + + + [[ repeatIn(get_lines(voucher.line_dr_ids),'l') ]] [[ formatLang(l['date_original'] ,date=True) or '' ]] + + + [[ l['name'] ]] + + + [[ formatLang (l['amount_original']) ]] + + + [[ formatLang (l['amount_due']) ]] + + + + + + + + [[ formatLang (l['amount']) ]] + + + + + + + Check Amount + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + + + diff --git a/addons/account_check_writing/report/check_print_top.rml b/addons/account_check_writing/report/check_print_top.rml new file mode 100644 index 00000000000..a5068617ebe --- /dev/null +++ b/addons/account_check_writing/report/check_print_top.rml @@ -0,0 +1,338 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [[repeatIn(objects,'voucher')]] + + + + + + + + + + + + + + + + + + + + + + + + [[ formatLang(voucher.date , date=True) or '' ]] [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + + + + + + [[ voucher.partner_id.name ]] + + + [[ formatLang (voucher.amount) ]] + + + + + + + [[ fill_stars(voucher.amount_in_word) ]] + + + + + + + + + + [[ voucher.partner_id.name ]] + [[ voucher.partner_id.address and voucher.partner_id.address[0] and voucher.partner_id.address[0].street2 or removeParentNode('para') ]] + [[ get_zip_line(voucher.partner_id.address[0]) ]] + [[ voucher.partner_id.address[0].country_id.name]] + + + + + + + + + + + + + + + [[ voucher.name ]] + + + + + + + + + + + + + + + + + + + + + [[voucher.partner_id.name]] + + + [[ formatLang(voucher.date , date=True) or '' ]] [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + Due Date + + + Description + + + Original Amount + + + Open Balance + + + Discount + + + Payment + + + + + [[ repeatIn(get_lines(voucher.line_dr_ids),'l') ]] [[ formatLang(l['date_due'] ,date=True) or '' ]] + + + [[ l['name'] ]] + + + [[formatLang( l['amount_original']) ]] + + + [[ formatLang( l['amount_unreconciled']) ]] + + + + + + + + [[ formatLang (l['amount']) ]] + + + + + + + Check Amount + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + + + + + [[voucher.partner_id.name]] + + + [[ formatLang(voucher.date , date=True) or '' ]] [[ voucher.journal_id.use_preprint_check and voucher.chk_seq or '' ]] + + + + + + + Due Date + + + Description + + + Original Amount + + + Open Balance + + + Discount + + + Payment + + + + + [[ repeatIn(get_lines(voucher.line_dr_ids),'l') ]] [[ formatLang(l['date_due'] ,date=True) or '' ]] + + + [[ l['name'] ]] + + + [[ formatLang (l['amount_original']) ]] + + + [[ formatLang (l['amount_unreconciled']) ]] + + + + + + + + [[ formatLang (l['amount']) ]] + + + + + + + Check Amount + + + [[ formatLang (voucher.amount) ]] + + + + + + + + + + + + + + From dde556db2e2cf78426d59c468da7950e5b2f8d21 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 14 Nov 2011 17:58:23 +0530 Subject: [PATCH 008/373] [FIX] hr_attendance : timesheet - sign in - out : must not allow overlaps bzr revid: mdi@tinyerp.com-20111114122823-7ehd1axt0l0b2euz --- addons/hr_attendance/hr_attendance.py | 28 ++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index a138d66a285..31061459426 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -64,19 +64,21 @@ class hr_attendance(osv.osv): } def _altern_si_so(self, cr, uid, ids, context=None): - for id in ids: - sql = ''' - SELECT action, name - FROM hr_attendance AS att - WHERE employee_id = (SELECT employee_id FROM hr_attendance WHERE id=%s) - AND action IN ('sign_in','sign_out') - AND name <= (SELECT name FROM hr_attendance WHERE id=%s) - ORDER BY name DESC - LIMIT 2 ''' - cr.execute(sql,(id,id)) - atts = cr.fetchall() - if not ((len(atts)==1 and atts[0][0] == 'sign_in') or (len(atts)==2 and atts[0][0] != atts[1][0] and atts[0][1] != atts[1][1])): - return False + current_attendance_data = self.browse(cr, uid, ids, context=context)[0] + obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) + obj_attendance_ids.remove(ids[0]) + hr_attendance_data = self.browse(cr, uid, obj_attendance_ids, context=context) + + for old_attendance in hr_attendance_data: + if old_attendance.employee_id.id == current_attendance_data['employee_id'].id: + if old_attendance.action == current_attendance_data['action']: + return False + elif old_attendance.name >= current_attendance_data['name']: + return False + else: + return True + if current_attendance_data['action'] == 'sign_out': + return False return True _constraints = [(_altern_si_so, 'Error: Sign in (resp. Sign out) must follow Sign out (resp. Sign in)', ['action'])] From 6036184f115188ca3bcd093743f78d1376f74113 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 29 Nov 2011 14:58:17 +0530 Subject: [PATCH 009/373] [FIX]: missleading help text lp bug: https://launchpad.net/bugs/897556 fixed bzr revid: ksa@tinyerp.com-20111129092817-m8xcsixxofqh2nhf --- addons/portal/portal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/portal/portal.py b/addons/portal/portal.py index de39944e69f..3966e193c10 100644 --- a/addons/portal/portal.py +++ b/addons/portal/portal.py @@ -36,7 +36,7 @@ class portal(osv.osv): _columns = { 'group_id': fields.many2one('res.groups', required=True, ondelete='cascade', string='Group', - help='The group extended by this portal'), + help='The group connected to this portal'), 'url': fields.char('URL', size=64, help="The url where portal users can connect to the server"), 'menu_action_id': fields.many2one('ir.actions.act_window', readonly=True, From 8cfb45d5504376a9ade6e486af0375140a7d91c8 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 30 Nov 2011 16:13:34 +0530 Subject: [PATCH 010/373] [ADD]:demo data for the product with account information bzr revid: ksa@tinyerp.com-20111130104334-h7zjiuvq922n43nq --- addons/purchase/purchase_demo.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index 6999f85b076..406e8d89abc 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -14,6 +14,13 @@ + + + + + + + From 8029e57b00f9a2fddfec3f9034dc36e1930fbc6b Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Wed, 30 Nov 2011 16:16:18 +0530 Subject: [PATCH 011/373] [ADD]:yml for stock real time accounting valuation bzr revid: ksa@tinyerp.com-20111130104618-r3p550bnov9wjjhf --- addons/purchase/__openerp__.py | 1 + .../test/process/real_time_valuation.yml | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 addons/purchase/test/process/real_time_valuation.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index b4f3a9adf30..68e490d23f1 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -67,6 +67,7 @@ Dashboard for purchase management that includes: 'test/process/run_scheduler.yml', 'test/process/merge_order.yml', 'test/process/edi_purchase_order.yml', + 'test/process/real_time_valuation.yml', 'test/ui/print_report.yml', 'test/ui/duplicate_order.yml', 'test/ui/delete_order.yml', diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml new file mode 100644 index 00000000000..d1b4cb267f1 --- /dev/null +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -0,0 +1,42 @@ +- + In order to test real time stock valuation flow,I start by creating a new product 'Sugar' +- + !record {model: product.product, id: product_sugar_id_50kg}: + name: Sugar + procure_method: make_to_stock + supply_method: buy + cost_method: standard + standard_price: 3600.0 + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_gram + valuation: real_time + categ_id: product.product_category_rawmaterial0 +- + I create a draft Purchase Order +- + !record {model: purchase.order, id: purchase_order_sugar}: + partner_id: base.res_partner_agrolait + partner_address_id: base.res_partner_address_8invoice + pricelist_id: 1 + order_line: + - product_id: product_sugar_id_50kg + product_qty: 1.0 + product_uom: product.product_uom_gram + price_unit: 3600000 + name: 'Sugar' + date_planned: '2011-08-31' +- + I confirm the purchase order +- + !workflow {model: purchase.order, ref: purchase_order_sugar, action: purchase_confirm} +- + I check that the invoice of order and values. +- + !python {model: purchase.order}: | + purchase_order = self.browse(cr, uid, ref("purchase_order_sugar")) + for purchase_line in purchase_order.order_line: + assert purchase_line.price_unit == 3600000.0 + assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." + for invoice_line in purchase_order.invoice_ids: + for data in invoice_line.invoice_line: + assert data.price_unit == 3600000.0, "unit price is not same, got %s, expected 3600000.0"%(purchase_line.price_unit,) From b839539b83dcc7f2eee9f4885186a64f6fe4e056 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Wed, 30 Nov 2011 16:38:52 +0530 Subject: [PATCH 012/373] [FIX] ActiveId Ref on New Task When from Project>Tasks act_window and Query Code refectoring bzr revid: jam@tinyerp.com-20111130110852-ox1y0dfnvvmc44yx --- addons/project/project.py | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/addons/project/project.py b/addons/project/project.py index 9b588e88659..466c937ac6f 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -109,20 +109,18 @@ class project(osv.osv): parents = self._get_parents(cr, uid, [child[0]], parents,context) return parents + def _get_project(self,cr, ids): + cr.execute('''SELECT project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours) + FROM project_task WHERE project_id in %s AND state<>'cancelled' + GROUP BY project_id''', (tuple(ids),)) + return cr + def _progress_rate(self, cr, uid, ids, names, arg, context=None): res = {}.fromkeys(ids, 0.0) if not ids: return res parents = self._get_parents(cr, uid, ids, ids,context) - cr.execute('''SELECT - project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours) - FROM - project_task - WHERE - project_id in %s AND - state<>'cancelled' - GROUP BY - project_id''', (tuple(ids),)) + cr = self._get_project(cr,ids) progress = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) for project in self.browse(cr, uid, parents, context=context): childs = [] @@ -136,15 +134,7 @@ class project(osv.osv): } if childs: - cr.execute('''SELECT - project_id, sum(planned_hours), sum(total_hours), sum(effective_hours), SUM(remaining_hours) - FROM - project_task - WHERE - project_id in %s AND - state<>'cancelled' - GROUP BY - project_id''', (tuple(childs),)) + cr = self._get_project(cr, childs) child_progress = dict(map(lambda x: (x[0], (x[1] or 0.0 ,x[2] or 0.0 ,x[3] or 0.0 ,x[4] or 0.0)), cr.fetchall())) planned_hours, effective_hours, total_hours, rnd= 0.0, 0.0,0.0, 0.0 for child in childs: @@ -588,8 +578,8 @@ class task(osv.osv): def _default_project(self, cr, uid, context=None): if context is None: context = {} - if 'project_id' in context and context['project_id']: - return int(context['project_id']) + if 'default_project_id' in context and context['default_project_id']: + return int(context['default_project_id']) return False def duplicate_task(self, cr, uid, map_ids, context=None): From 6d1cf5dc29ad4739e69817317ff9bac553710818 Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Fri, 2 Dec 2011 14:13:12 +0530 Subject: [PATCH 013/373] [FIX] project: Change the help of dealy hours lp bug: https://launchpad.net/bugs/898644 fixed bzr revid: kjo@tinyerp.com-20111202084312-qofmgnjmwicko9wi --- addons/project/project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/project.py b/addons/project/project.py index abebd2d35ff..742681cf1c3 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -625,7 +625,7 @@ class task(osv.osv): 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours','state'], 10), 'project.task.work': (_get_task, ['hours'], 10), }), - 'delay_hours': fields.function(_hours_get, string='Delay Hours', multi='hours', help="Computed as difference of the time estimated by the project manager and the real time to close the task.", + 'delay_hours': fields.function(_hours_get, string='Delay Hours', multi='hours', help="Computed as difference between planned hours by the project manager and the total hours of the task.", store = { 'project.task': (lambda self, cr, uid, ids, c={}: ids, ['work_ids', 'remaining_hours', 'planned_hours'], 10), 'project.task.work': (_get_task, ['hours'], 10), From 296622e5f755ed7bab5f44a7825e80bbe6c9ed0d Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:13:22 +0530 Subject: [PATCH 014/373] [ADD]: demo data for different uom bzr revid: ksa@tinyerp.com-20111205104322-f63d4ujlt64kl0p1 --- addons/product/product_demo.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 3aebec13715..a95b41e546c 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -636,6 +636,20 @@ + + SUGAR50KG + buy + + 110.0 + 3600.0 + + + SUGAR of 50KG + + product + + + @@ -777,6 +791,15 @@ 5 + + + 10 + 1 + 5 + + 5 + + From 8af8d336375d6f0ddc4e278b9bfddb695713cccd Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:14:59 +0530 Subject: [PATCH 015/373] [IMP]:code for product onchange when uom is different bzr revid: ksa@tinyerp.com-20111205104459-p2hnekd0tazuia2n --- addons/purchase/purchase.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 0dc015834a0..cea5aeeef4f 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -727,10 +727,12 @@ class purchase_order_line(osv.osv): # - name of method should "onchange_product_id" # - docstring # - merge 'product_uom_change' method - # - split into small internal methods for clearity + # - split into small internal methods for clearity def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False, fiscal_position=False, date_planned=False, - name=False, price_unit=False, notes=False, context={}): + name=False, price_unit=False, notes=False, context=None): + if context is None: + context = {} if not pricelist: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: @@ -744,11 +746,14 @@ class purchase_order_line(osv.osv): lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] - context={'lang':lang} + context['lang'] = lang context['partner_id'] = partner_id prod = self.pool.get('product.product').browse(cr, uid, product, context=context) prod_uom_po = prod.uom_po_id.id + + if uom and prod and (uom <> prod_uom_po): + uom = prod_uom_po if not uom: uom = prod_uom_po if not date_order: @@ -773,6 +778,7 @@ class purchase_order_line(osv.osv): if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal. qty = temp_qty res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier has a minimal quantity set to %s, you should not purchase less.') % qty}}) + uom = context.get('uom_change', uom) qty_in_product_uom = product_uom_pool._compute_qty(cr, uid, uom, qty, to_uom_id=prod.uom_id.id) price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], product, qty_in_product_uom or 1.0, partner_id, { @@ -786,7 +792,7 @@ class purchase_order_line(osv.osv): 'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id), 'date_planned': date_planned or dt,'notes': notes or prod.description_purchase, 'product_qty': qty, - 'product_uom': prod.uom_id.id}}) + 'product_uom': uom or prod_uom_po}}) domain = {} taxes = self.pool.get('account.tax').browse(cr, uid,map(lambda x: x.id, prod.supplier_taxes_id)) @@ -808,7 +814,7 @@ class purchase_order_line(osv.osv): name=False, price_unit=False, notes=False, context={}): res = self.product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=date_order, fiscal_position=fiscal_position, date_planned=date_planned, - name=name, price_unit=price_unit, notes=notes, context=context) + name=name, price_unit=price_unit, notes=notes, context={'uom_change': uom}) if 'product_uom' in res['value']: if uom and (uom != res['value']['product_uom']) and res['value']['product_uom']: seller_uom_name = self.pool.get('product.uom').read(cr, uid, [res['value']['product_uom']], ['name'])[0]['name'] From 6709a80bbcb8f7f2fe3dccd528cd7743c54182d9 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Mon, 5 Dec 2011 16:15:41 +0530 Subject: [PATCH 016/373] [IMP]:yml for real time valuation value bzr revid: ksa@tinyerp.com-20111205104541-suka3mhly9ry8xdc --- addons/purchase/purchase_order_demo.yml | 5 +++ .../test/process/real_time_valuation.yml | 42 ++----------------- 2 files changed, 9 insertions(+), 38 deletions(-) diff --git a/addons/purchase/purchase_order_demo.yml b/addons/purchase/purchase_order_demo.yml index abfaa102033..8cd9271de45 100644 --- a/addons/purchase/purchase_order_demo.yml +++ b/addons/purchase/purchase_order_demo.yml @@ -74,3 +74,8 @@ - product_id: product.product_product_1 product_qty: 15 +- + !record {model: purchase.order, id: order_purchase8}: + partner_id: base.res_partner_asus + order_line: + - product_id: product.product_sugar_id_50kg diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml index d1b4cb267f1..69b04071f40 100644 --- a/addons/purchase/test/process/real_time_valuation.yml +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -1,42 +1,8 @@ - - In order to test real time stock valuation flow,I start by creating a new product 'Sugar' -- - !record {model: product.product, id: product_sugar_id_50kg}: - name: Sugar - procure_method: make_to_stock - supply_method: buy - cost_method: standard - standard_price: 3600.0 - uom_id: product.product_uom_kgm - uom_po_id: product.product_uom_gram - valuation: real_time - categ_id: product.product_category_rawmaterial0 -- - I create a draft Purchase Order -- - !record {model: purchase.order, id: purchase_order_sugar}: - partner_id: base.res_partner_agrolait - partner_address_id: base.res_partner_address_8invoice - pricelist_id: 1 - order_line: - - product_id: product_sugar_id_50kg - product_qty: 1.0 - product_uom: product.product_uom_gram - price_unit: 3600000 - name: 'Sugar' - date_planned: '2011-08-31' -- - I confirm the purchase order -- - !workflow {model: purchase.order, ref: purchase_order_sugar, action: purchase_confirm} -- - I check that the invoice of order and values. + In order to test real time stock valuation flow, when default UoM and purchase UoM is different - !python {model: purchase.order}: | - purchase_order = self.browse(cr, uid, ref("purchase_order_sugar")) + purchase_order = self.browse(cr, uid, ref("order_purchase8")) + assert len(purchase_order.order_line) == 1, "orderline should be generated." for purchase_line in purchase_order.order_line: - assert purchase_line.price_unit == 3600000.0 - assert len(purchase_order.invoice_ids) == 1, "Invoice should be generated." - for invoice_line in purchase_order.invoice_ids: - for data in invoice_line.invoice_line: - assert data.price_unit == 3600000.0, "unit price is not same, got %s, expected 3600000.0"%(purchase_line.price_unit,) + assert purchase_line.price_unit == 3.6 ,"unit price is not same, got %s, expected 3.6"%(purchase_line.price_unit,) \ No newline at end of file From 79942408d1935e863091765ec7485fce87e2250a Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Mon, 5 Dec 2011 16:59:11 +0530 Subject: [PATCH 017/373] [FIX] project: delay hours help text change in project.pot bzr revid: kjo@tinyerp.com-20111205112911-nbwvyc0ynabrqhwa --- addons/project/i18n/project.pot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project/i18n/project.pot b/addons/project/i18n/project.pot index 3566e54b5aa..9d5c6c7d2b1 100644 --- a/addons/project/i18n/project.pot +++ b/addons/project/i18n/project.pot @@ -1440,7 +1440,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 -msgid "Computed as difference of the time estimated by the project manager and the real time to close the task." +msgid "Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project From d82624a20b80170c2f9ec7b1c0b01af88c2e043e Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Mon, 5 Dec 2011 17:46:25 +0530 Subject: [PATCH 018/373] [FIX] project: delay hours help text change in po file bzr revid: kjo@tinyerp.com-20111205121625-b6wprh41kilh9hvb --- addons/project/i18n/ar.po | 3 +-- addons/project/i18n/bg.po | 3 +-- addons/project/i18n/bs.po | 3 +-- addons/project/i18n/ca.po | 3 +-- addons/project/i18n/cs.po | 3 +-- addons/project/i18n/de.po | 3 +-- addons/project/i18n/el.po | 3 +-- addons/project/i18n/es.po | 3 +-- addons/project/i18n/es_AR.po | 3 +-- addons/project/i18n/es_EC.po | 3 +-- addons/project/i18n/es_MX.po | 3 +-- addons/project/i18n/es_PY.po | 3 +-- addons/project/i18n/es_VE.po | 3 +-- addons/project/i18n/et.po | 3 +-- addons/project/i18n/eu.po | 3 +-- addons/project/i18n/fi.po | 3 +-- addons/project/i18n/fr.po | 3 +-- addons/project/i18n/gl.po | 3 +-- addons/project/i18n/hr.po | 3 +-- addons/project/i18n/hu.po | 3 +-- addons/project/i18n/id.po | 3 +-- addons/project/i18n/it.po | 3 +-- addons/project/i18n/ko.po | 3 +-- addons/project/i18n/lt.po | 3 +-- addons/project/i18n/lv.po | 3 +-- addons/project/i18n/mn.po | 3 +-- addons/project/i18n/nb.po | 3 +-- addons/project/i18n/nl.po | 3 +-- addons/project/i18n/nl_BE.po | 3 +-- addons/project/i18n/pl.po | 3 +-- addons/project/i18n/pt.po | 3 +-- addons/project/i18n/pt_BR.po | 3 +-- addons/project/i18n/ro.po | 3 +-- addons/project/i18n/ru.po | 3 +-- addons/project/i18n/sk.po | 3 +-- addons/project/i18n/sl.po | 3 +-- addons/project/i18n/sq.po | 3 +-- addons/project/i18n/sv.po | 3 +-- addons/project/i18n/tlh.po | 3 +-- addons/project/i18n/tr.po | 3 +-- addons/project/i18n/uk.po | 3 +-- addons/project/i18n/vi.po | 3 +-- addons/project/i18n/zh_CN.po | 3 +-- addons/project/i18n/zh_TW.po | 3 +-- 44 files changed, 44 insertions(+), 88 deletions(-) diff --git a/addons/project/i18n/ar.po b/addons/project/i18n/ar.po index 20c0766fe08..1acd3fe4a9d 100644 --- a/addons/project/i18n/ar.po +++ b/addons/project/i18n/ar.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/bg.po b/addons/project/i18n/bg.po index 71eea6d0e77..811d474f55a 100644 --- a/addons/project/i18n/bg.po +++ b/addons/project/i18n/bg.po @@ -1498,8 +1498,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/bs.po b/addons/project/i18n/bs.po index 4211107d667..2bd47395016 100644 --- a/addons/project/i18n/bs.po +++ b/addons/project/i18n/bs.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/ca.po b/addons/project/i18n/ca.po index f41bf9ec9b5..90f3c12b1dc 100644 --- a/addons/project/i18n/ca.po +++ b/addons/project/i18n/ca.po @@ -1579,8 +1579,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calculat com la diferència del temps previst pel responsable del projecte i " "el temps real per tancar la tasca." diff --git a/addons/project/i18n/cs.po b/addons/project/i18n/cs.po index 4648ea77aae..3192bf8ebe2 100644 --- a/addons/project/i18n/cs.po +++ b/addons/project/i18n/cs.po @@ -1534,8 +1534,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Spočítá rozdíl odhadovaného času vedoucím projektu a skutečným časem do " "uzavření úkolu." diff --git a/addons/project/i18n/de.po b/addons/project/i18n/de.po index 739be62dda6..f2a4d676e73 100644 --- a/addons/project/i18n/de.po +++ b/addons/project/i18n/de.po @@ -1576,8 +1576,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Berechnung durch die Differenz der geplanten Zeit und der tatsächlich " "benötigten Zeit." diff --git a/addons/project/i18n/el.po b/addons/project/i18n/el.po index 5e9c0753d8c..3e0448c7a74 100644 --- a/addons/project/i18n/el.po +++ b/addons/project/i18n/el.po @@ -1521,8 +1521,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/es.po b/addons/project/i18n/es.po index 3cd989e1ca1..5a67a6ff1b1 100644 --- a/addons/project/i18n/es.po +++ b/addons/project/i18n/es.po @@ -1575,8 +1575,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calculado como la diferencia del tiempo estimado por el responsable del " "proyecto y el tiempo real para cerrar la tarea." diff --git a/addons/project/i18n/es_AR.po b/addons/project/i18n/es_AR.po index 2fd1d382cc0..a2ff96f22ca 100644 --- a/addons/project/i18n/es_AR.po +++ b/addons/project/i18n/es_AR.po @@ -1519,8 +1519,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/es_EC.po b/addons/project/i18n/es_EC.po index 6c53b21aa72..ec2c6c99d03 100644 --- a/addons/project/i18n/es_EC.po +++ b/addons/project/i18n/es_EC.po @@ -1571,8 +1571,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calculado como diferencia del tiempo estimado por administrador de proyecto\n" " y el tiempo real para cerrar la tarea." diff --git a/addons/project/i18n/es_MX.po b/addons/project/i18n/es_MX.po index 22b2e410bcb..2e854f3424a 100644 --- a/addons/project/i18n/es_MX.po +++ b/addons/project/i18n/es_MX.po @@ -1576,8 +1576,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calculado como la diferencia del tiempo estimado por el responsable del " "proyecto y el tiempo real para cerrar la tarea." diff --git a/addons/project/i18n/es_PY.po b/addons/project/i18n/es_PY.po index ca5ae97a3af..74d4cecf489 100644 --- a/addons/project/i18n/es_PY.po +++ b/addons/project/i18n/es_PY.po @@ -1498,8 +1498,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/es_VE.po b/addons/project/i18n/es_VE.po index 22b2e410bcb..2e854f3424a 100644 --- a/addons/project/i18n/es_VE.po +++ b/addons/project/i18n/es_VE.po @@ -1576,8 +1576,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calculado como la diferencia del tiempo estimado por el responsable del " "proyecto y el tiempo real para cerrar la tarea." diff --git a/addons/project/i18n/et.po b/addons/project/i18n/et.po index 8313b419ba2..3848ea728b5 100644 --- a/addons/project/i18n/et.po +++ b/addons/project/i18n/et.po @@ -1513,8 +1513,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/eu.po b/addons/project/i18n/eu.po index 78b39b6dea1..dbf9f0d83cb 100644 --- a/addons/project/i18n/eu.po +++ b/addons/project/i18n/eu.po @@ -1502,8 +1502,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/fi.po b/addons/project/i18n/fi.po index 3db27c29f88..01f8c628367 100644 --- a/addons/project/i18n/fi.po +++ b/addons/project/i18n/fi.po @@ -1529,8 +1529,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Laskettu erotuksena projektipäällikön arvion ja projektin valmistumiseen " "kuluneen todellisen ajan mukaan" diff --git a/addons/project/i18n/fr.po b/addons/project/i18n/fr.po index 6b57de99e8f..52374ca7a0f 100644 --- a/addons/project/i18n/fr.po +++ b/addons/project/i18n/fr.po @@ -1587,8 +1587,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calcul correspondant à la différence entre le temps estimé par le " "Responsable Projet et le temps réel pour fermer la tâche" diff --git a/addons/project/i18n/gl.po b/addons/project/i18n/gl.po index 7052dc0db8a..8a6eb7bf7aa 100644 --- a/addons/project/i18n/gl.po +++ b/addons/project/i18n/gl.po @@ -1498,8 +1498,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/hr.po b/addons/project/i18n/hr.po index efc9c66ee4a..3e2070d26d1 100644 --- a/addons/project/i18n/hr.po +++ b/addons/project/i18n/hr.po @@ -1513,8 +1513,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/hu.po b/addons/project/i18n/hu.po index 08777fcc511..5c92f3f349e 100644 --- a/addons/project/i18n/hu.po +++ b/addons/project/i18n/hu.po @@ -1572,8 +1572,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "A projektmenedzser által becsült idő és a feladat lezárásához szükséges " "tényleges idő különbözeteként kerül kiszámításra." diff --git a/addons/project/i18n/id.po b/addons/project/i18n/id.po index 870ccf889a2..4f0c7020b32 100644 --- a/addons/project/i18n/id.po +++ b/addons/project/i18n/id.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/it.po b/addons/project/i18n/it.po index d03192323bb..2d9286f0e82 100644 --- a/addons/project/i18n/it.po +++ b/addons/project/i18n/it.po @@ -1578,8 +1578,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calcolato come la differenza fra il tempo stimato dal project manager ed il " "tempo reale impiegato per concludere l'attività." diff --git a/addons/project/i18n/ko.po b/addons/project/i18n/ko.po index 29f6944390c..cca514337aa 100644 --- a/addons/project/i18n/ko.po +++ b/addons/project/i18n/ko.po @@ -1503,8 +1503,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/lt.po b/addons/project/i18n/lt.po index b9595c015ff..fdca59d52a4 100644 --- a/addons/project/i18n/lt.po +++ b/addons/project/i18n/lt.po @@ -1517,8 +1517,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/lv.po b/addons/project/i18n/lv.po index 3dbe0406fbd..bc73af27250 100644 --- a/addons/project/i18n/lv.po +++ b/addons/project/i18n/lv.po @@ -1565,8 +1565,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Tiek aprēķināts kā starpība starp projektu vadītāja novērtēto un reālo " "uzdevuma pabeigšanas laiku." diff --git a/addons/project/i18n/mn.po b/addons/project/i18n/mn.po index ef864360d05..74e7f85bb6c 100644 --- a/addons/project/i18n/mn.po +++ b/addons/project/i18n/mn.po @@ -1505,8 +1505,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/nb.po b/addons/project/i18n/nb.po index 2cba8c54a3e..12a173d1571 100644 --- a/addons/project/i18n/nb.po +++ b/addons/project/i18n/nb.po @@ -1524,8 +1524,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Beregnet som: Total tid - estimert tid. Det gir differansen mellom tiden " "estimert av prosjektlederen og den reelle tiden det tok å fullføre oppgaven." diff --git a/addons/project/i18n/nl.po b/addons/project/i18n/nl.po index 8a4c2a29018..41bff4470d7 100644 --- a/addons/project/i18n/nl.po +++ b/addons/project/i18n/nl.po @@ -1569,8 +1569,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Berekend als het verschil tussen de door de project manager geschatte tijd " "en de werkelijke tijd tot sluiting van de taak." diff --git a/addons/project/i18n/nl_BE.po b/addons/project/i18n/nl_BE.po index f8e11682628..d54a5ea03ed 100644 --- a/addons/project/i18n/nl_BE.po +++ b/addons/project/i18n/nl_BE.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/pl.po b/addons/project/i18n/pl.po index a56ebf019c4..e2099f45b18 100644 --- a/addons/project/i18n/pl.po +++ b/addons/project/i18n/pl.po @@ -1560,8 +1560,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Obliczone jako różnica pomiędzy czasem szacowanym przez menedżera, a " "rzeczywistym czasem do zamknięcia zadania." diff --git a/addons/project/i18n/pt.po b/addons/project/i18n/pt.po index 268534e898c..0622ba21729 100644 --- a/addons/project/i18n/pt.po +++ b/addons/project/i18n/pt.po @@ -1516,8 +1516,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/pt_BR.po b/addons/project/i18n/pt_BR.po index 3ba453713f0..18af2aa08af 100644 --- a/addons/project/i18n/pt_BR.po +++ b/addons/project/i18n/pt_BR.po @@ -1572,8 +1572,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" "Calculado como diferença de tempo estimado pelo gerente de projetos e o " "tempo real para concluir a tarefa." diff --git a/addons/project/i18n/ro.po b/addons/project/i18n/ro.po index 094d3feb7e0..dfc7d31684a 100644 --- a/addons/project/i18n/ro.po +++ b/addons/project/i18n/ro.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/ru.po b/addons/project/i18n/ru.po index 679d33f190f..f134a44f214 100644 --- a/addons/project/i18n/ru.po +++ b/addons/project/i18n/ru.po @@ -1519,8 +1519,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/sk.po b/addons/project/i18n/sk.po index 85c7e6fb429..9aa0a1abc34 100644 --- a/addons/project/i18n/sk.po +++ b/addons/project/i18n/sk.po @@ -1498,8 +1498,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/sl.po b/addons/project/i18n/sl.po index 9655b687ef9..63906cf7d56 100644 --- a/addons/project/i18n/sl.po +++ b/addons/project/i18n/sl.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/sq.po b/addons/project/i18n/sq.po index 780b30c2413..d7f9252eaae 100644 --- a/addons/project/i18n/sq.po +++ b/addons/project/i18n/sq.po @@ -1498,8 +1498,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/sv.po b/addons/project/i18n/sv.po index d73ac6923fa..3209e4a6ada 100644 --- a/addons/project/i18n/sv.po +++ b/addons/project/i18n/sv.po @@ -1513,8 +1513,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/tlh.po b/addons/project/i18n/tlh.po index 56577ced268..e4aac792d17 100644 --- a/addons/project/i18n/tlh.po +++ b/addons/project/i18n/tlh.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/tr.po b/addons/project/i18n/tr.po index 8253777bedf..082bcb747cf 100644 --- a/addons/project/i18n/tr.po +++ b/addons/project/i18n/tr.po @@ -1505,8 +1505,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/uk.po b/addons/project/i18n/uk.po index de752130814..54cddbc8891 100644 --- a/addons/project/i18n/uk.po +++ b/addons/project/i18n/uk.po @@ -1497,8 +1497,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/vi.po b/addons/project/i18n/vi.po index e3acf3c2c37..6167475c56a 100644 --- a/addons/project/i18n/vi.po +++ b/addons/project/i18n/vi.po @@ -1498,8 +1498,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project diff --git a/addons/project/i18n/zh_CN.po b/addons/project/i18n/zh_CN.po index 26e66ac4198..55d28f76c28 100644 --- a/addons/project/i18n/zh_CN.po +++ b/addons/project/i18n/zh_CN.po @@ -1512,8 +1512,7 @@ msgstr "本项目和相关项目的任务实际花费的小时数合计" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "计算公式为:项目经理估算的时间和实际花费的时间的差" #. module: project diff --git a/addons/project/i18n/zh_TW.po b/addons/project/i18n/zh_TW.po index 008442910bb..1772eff4a79 100644 --- a/addons/project/i18n/zh_TW.po +++ b/addons/project/i18n/zh_TW.po @@ -1501,8 +1501,7 @@ msgstr "" #. module: project #: help:project.task,delay_hours:0 msgid "" -"Computed as difference of the time estimated by the project manager and the " -"real time to close the task." +"Computed as difference between planned hours by the project manager and the total hours of the task." msgstr "" #. module: project From 31f3f8651031f4c4de3c16f6e90bf4d1f6619600 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Thu, 8 Dec 2011 15:25:59 +0530 Subject: [PATCH 019/373] [IMP]:check the flow when default UoM and purchase UoM is different bzr revid: ksa@tinyerp.com-20111208095559-9qt47pftmtr55yh1 --- addons/product/product_demo.xml | 23 ----------- addons/purchase/purchase_demo.xml | 7 ---- addons/purchase/purchase_order_demo.yml | 19 ++++++++- .../test/process/real_time_valuation.yml | 39 ++++++++++++++++--- 4 files changed, 51 insertions(+), 37 deletions(-) diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index a95b41e546c..3aebec13715 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -636,20 +636,6 @@ - - SUGAR50KG - buy - - 110.0 - 3600.0 - - - SUGAR of 50KG - - product - - - @@ -791,15 +777,6 @@ 5 - - - 10 - 1 - 5 - - 5 - - diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index 406e8d89abc..6999f85b076 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -14,13 +14,6 @@ - - - - - - - diff --git a/addons/purchase/purchase_order_demo.yml b/addons/purchase/purchase_order_demo.yml index 8cd9271de45..0ea29b2a242 100644 --- a/addons/purchase/purchase_order_demo.yml +++ b/addons/purchase/purchase_order_demo.yml @@ -75,7 +75,22 @@ product_qty: 15 - - !record {model: purchase.order, id: order_purchase8}: + !record {model: product.product, id: product_sugar_id_50kg}: + default_code: SUGAR50KG + supply_method: buy + list_price: 110.0 + standard_price: 3600.0 + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_gram + name: SUGAR of 50KG + valuation: real_time + property_stock_account_input: account.o_expense + property_stock_account_output: account.o_income + categ_id: product.product_category_rawmaterial0 + +- + !record {model: purchase.order, id: order_purchase_sugar}: partner_id: base.res_partner_asus order_line: - - product_id: product.product_sugar_id_50kg + - product_id: product_sugar_id_50kg + diff --git a/addons/purchase/test/process/real_time_valuation.yml b/addons/purchase/test/process/real_time_valuation.yml index 69b04071f40..f0234888ba6 100644 --- a/addons/purchase/test/process/real_time_valuation.yml +++ b/addons/purchase/test/process/real_time_valuation.yml @@ -1,8 +1,37 @@ - - In order to test real time stock valuation flow, when default UoM and purchase UoM is different + In order to test real time stock valuation flow, I confirmed the purchase order. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: order_purchase_sugar} +- + I check that the order which was initially in the draft state has transmit to approved state. +- + !assert {model: purchase.order, id: order_purchase_sugar}: + - state == 'approved' +- + In order to test check that picking is generated or not. - !python {model: purchase.order}: | - purchase_order = self.browse(cr, uid, ref("order_purchase8")) - assert len(purchase_order.order_line) == 1, "orderline should be generated." - for purchase_line in purchase_order.order_line: - assert purchase_line.price_unit == 3.6 ,"unit price is not same, got %s, expected 3.6"%(purchase_line.price_unit,) \ No newline at end of file + purchase_order = self.browse(cr, uid, ref("order_purchase_sugar")) + assert len(purchase_order.picking_ids) >= 1, "You should have only one reception order" + for picking in purchase_order.picking_ids: + assert picking.purchase_id.id == purchase_order.id +- + Reception is ready for process so now done the reception. +- + !python {model: stock.partial.picking}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase_sugar")).picking_ids + partial_id = self.create(cr, uid, {},context={'active_model': 'stock.picking','active_ids': [pick_ids[0].id]}) + self.do_partial(cr, uid, [partial_id]) +- + Check the Journal having proper amount or not. +- + !python {model: account.move.line}: | + pick_ids = self.pool.get('purchase.order').browse(cr, uid, ref("order_purchase_sugar")).picking_ids + for data in pick_ids: + for moveline in data.move_lines: + ids = self.pool.get('account.move.line').search(cr, uid, [('ref','=',data.name),('partner_id','=',data.partner_id.id)]) + item_data = self.pool.get('account.move.line').browse(cr, uid, ids) + for item in item_data: + if item.account_id.id == moveline.product_id.property_stock_account_input.id: + assert item.credit == 3.6, "Journal items have not proper credit amount" + assert item.debit == 0.0, "Journal items have not proper debit amount" From 9def2e0169ebd23e9b053ff6b0ae16031cb03f88 Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Tue, 20 Dec 2011 11:42:28 +0530 Subject: [PATCH 020/373] [IMP]: change in po file bzr revid: ksa@tinyerp.com-20111220061228-dtgf8vob8g0z2htu --- addons/portal/i18n/ar.po | 2 +- addons/portal/i18n/bg.po | 2 +- addons/portal/i18n/bs.po | 2 +- addons/portal/i18n/ca.po | 2 +- addons/portal/i18n/de.po | 2 +- addons/portal/i18n/en_US.po | 2 +- addons/portal/i18n/es.po | 2 +- addons/portal/i18n/es_MX.po | 2 +- addons/portal/i18n/es_VE.po | 2 +- addons/portal/i18n/et.po | 2 +- addons/portal/i18n/fi.po | 2 +- addons/portal/i18n/fr.po | 2 +- addons/portal/i18n/hr.po | 2 +- addons/portal/i18n/hu.po | 2 +- addons/portal/i18n/id.po | 2 +- addons/portal/i18n/it.po | 2 +- addons/portal/i18n/lt.po | 2 +- addons/portal/i18n/nl.po | 2 +- addons/portal/i18n/pl.po | 2 +- addons/portal/i18n/pt.po | 2 +- addons/portal/i18n/pt_BR.po | 2 +- addons/portal/i18n/ro.po | 2 +- addons/portal/i18n/ru.po | 2 +- addons/portal/i18n/sl.po | 2 +- addons/portal/i18n/sv.po | 2 +- addons/portal/i18n/tr.po | 2 +- addons/portal/i18n/uk.po | 2 +- addons/portal/i18n/zh_CN.po | 2 +- addons/portal/i18n/zh_TW.po | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/addons/portal/i18n/ar.po b/addons/portal/i18n/ar.po index 56e8e4a0880..048183767f1 100644 --- a/addons/portal/i18n/ar.po +++ b/addons/portal/i18n/ar.po @@ -294,7 +294,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/bg.po b/addons/portal/i18n/bg.po index 5a41a942eab..6104b7d5898 100644 --- a/addons/portal/i18n/bg.po +++ b/addons/portal/i18n/bg.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/bs.po b/addons/portal/i18n/bs.po index 13ab4e3efa4..0488d6dab9b 100644 --- a/addons/portal/i18n/bs.po +++ b/addons/portal/i18n/bs.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/ca.po b/addons/portal/i18n/ca.po index 71faf20e85f..406e3381a52 100644 --- a/addons/portal/i18n/ca.po +++ b/addons/portal/i18n/ca.po @@ -318,7 +318,7 @@ msgstr "ir.ui.menú" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "El grup ampliat per aquest portal" #. module: portal diff --git a/addons/portal/i18n/de.po b/addons/portal/i18n/de.po index 8fbe9e1e388..ca282a28b38 100644 --- a/addons/portal/i18n/de.po +++ b/addons/portal/i18n/de.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/en_US.po b/addons/portal/i18n/en_US.po index ffc18da1f14..79eae8cc9d0 100644 --- a/addons/portal/i18n/en_US.po +++ b/addons/portal/i18n/en_US.po @@ -281,7 +281,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/es.po b/addons/portal/i18n/es.po index d73378f4150..029408ef2b4 100644 --- a/addons/portal/i18n/es.po +++ b/addons/portal/i18n/es.po @@ -294,7 +294,7 @@ msgstr "ir.ui.menu" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/es_MX.po b/addons/portal/i18n/es_MX.po index f4fca48ead1..22dc0db022f 100644 --- a/addons/portal/i18n/es_MX.po +++ b/addons/portal/i18n/es_MX.po @@ -294,7 +294,7 @@ msgstr "ir.ui.menu" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/es_VE.po b/addons/portal/i18n/es_VE.po index f4fca48ead1..22dc0db022f 100644 --- a/addons/portal/i18n/es_VE.po +++ b/addons/portal/i18n/es_VE.po @@ -294,7 +294,7 @@ msgstr "ir.ui.menu" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/et.po b/addons/portal/i18n/et.po index 41824c3ed1c..7e6fac6789e 100644 --- a/addons/portal/i18n/et.po +++ b/addons/portal/i18n/et.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/fi.po b/addons/portal/i18n/fi.po index 31c44509b96..7a0f682b07b 100644 --- a/addons/portal/i18n/fi.po +++ b/addons/portal/i18n/fi.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/fr.po b/addons/portal/i18n/fr.po index 4ba51b3d9be..e5a980b0f16 100644 --- a/addons/portal/i18n/fr.po +++ b/addons/portal/i18n/fr.po @@ -292,7 +292,7 @@ msgstr "ir.ui.menu" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/hr.po b/addons/portal/i18n/hr.po index 737a6990153..fa9dad14f04 100644 --- a/addons/portal/i18n/hr.po +++ b/addons/portal/i18n/hr.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/hu.po b/addons/portal/i18n/hu.po index 94a05d71a30..e3f579f358a 100644 --- a/addons/portal/i18n/hu.po +++ b/addons/portal/i18n/hu.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/id.po b/addons/portal/i18n/id.po index 3eb9b26b75b..0c3db0c1af0 100644 --- a/addons/portal/i18n/id.po +++ b/addons/portal/i18n/id.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/it.po b/addons/portal/i18n/it.po index c74fe28664a..aabc5f8d135 100644 --- a/addons/portal/i18n/it.po +++ b/addons/portal/i18n/it.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/lt.po b/addons/portal/i18n/lt.po index 5c8cb2d31df..42a5a138957 100644 --- a/addons/portal/i18n/lt.po +++ b/addons/portal/i18n/lt.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/nl.po b/addons/portal/i18n/nl.po index 6c6fde8b34e..a872165e552 100644 --- a/addons/portal/i18n/nl.po +++ b/addons/portal/i18n/nl.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/pl.po b/addons/portal/i18n/pl.po index b740c2c9c15..519f21ecb54 100644 --- a/addons/portal/i18n/pl.po +++ b/addons/portal/i18n/pl.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/pt.po b/addons/portal/i18n/pt.po index 499f6c07a0a..75f675b71df 100644 --- a/addons/portal/i18n/pt.po +++ b/addons/portal/i18n/pt.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/pt_BR.po b/addons/portal/i18n/pt_BR.po index 7de00b8d68a..be6f48379a1 100644 --- a/addons/portal/i18n/pt_BR.po +++ b/addons/portal/i18n/pt_BR.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/ro.po b/addons/portal/i18n/ro.po index ee31cd287ab..32a4ffa4d2b 100644 --- a/addons/portal/i18n/ro.po +++ b/addons/portal/i18n/ro.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/ru.po b/addons/portal/i18n/ru.po index 58ea572e3da..0c1d8a7c101 100644 --- a/addons/portal/i18n/ru.po +++ b/addons/portal/i18n/ru.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/sl.po b/addons/portal/i18n/sl.po index e996f6b2470..97e65852420 100644 --- a/addons/portal/i18n/sl.po +++ b/addons/portal/i18n/sl.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/sv.po b/addons/portal/i18n/sv.po index 13c18c6b339..3226875c189 100644 --- a/addons/portal/i18n/sv.po +++ b/addons/portal/i18n/sv.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/tr.po b/addons/portal/i18n/tr.po index b64d3a452b1..3e57de7d87b 100644 --- a/addons/portal/i18n/tr.po +++ b/addons/portal/i18n/tr.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/uk.po b/addons/portal/i18n/uk.po index 8f83ec52772..39951976c0f 100644 --- a/addons/portal/i18n/uk.po +++ b/addons/portal/i18n/uk.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/zh_CN.po b/addons/portal/i18n/zh_CN.po index f420ee74856..094ed3c7167 100644 --- a/addons/portal/i18n/zh_CN.po +++ b/addons/portal/i18n/zh_CN.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal diff --git a/addons/portal/i18n/zh_TW.po b/addons/portal/i18n/zh_TW.po index 2ea5e8f808a..c149e0ad675 100644 --- a/addons/portal/i18n/zh_TW.po +++ b/addons/portal/i18n/zh_TW.po @@ -292,7 +292,7 @@ msgstr "" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "" #. module: portal From 573227209615c0f30bb5b9d2efd28dd2ea36ed8d Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Tue, 20 Dec 2011 15:15:52 +0530 Subject: [PATCH 021/373] [FIX] hr_attendance : timesheet - sign in - out : must not allow overlaps lp bug: https://launchpad.net/bugs/885387 fixed bzr revid: mdi@tinyerp.com-20111220094552-jfwpgzy7f0lmig44 --- addons/hr_attendance/hr_attendance.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 31061459426..9987beae248 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -63,6 +63,14 @@ class hr_attendance(osv.osv): 'employee_id': _employee_get, } + def write(self, cr, uid, ids, vals, context=None): + current_attendance_data = self.browse(cr, uid, ids, context=context)[0] + obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) + if obj_attendance_ids[0] != ids[0]: + if ('name' in vals) or ('action' in vals): + raise osv.except_osv(_('Warning !'), _('You can not modify existing entries. To modify the entry , remove the prior entries.')) + return super(hr_attendance, self).write(cr, uid, ids, vals, context=context) + def _altern_si_so(self, cr, uid, ids, context=None): current_attendance_data = self.browse(cr, uid, ids, context=context)[0] obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) @@ -70,13 +78,13 @@ class hr_attendance(osv.osv): hr_attendance_data = self.browse(cr, uid, obj_attendance_ids, context=context) for old_attendance in hr_attendance_data: - if old_attendance.employee_id.id == current_attendance_data['employee_id'].id: - if old_attendance.action == current_attendance_data['action']: - return False - elif old_attendance.name >= current_attendance_data['name']: - return False - else: - return True + if old_attendance.action == current_attendance_data['action']: + return False + elif old_attendance.name >= current_attendance_data['name']: + return False + else: + return True + # First entry in the system must not be 'sign_out' if current_attendance_data['action'] == 'sign_out': return False return True From fd63c3c6d7e6b72481bfb50570861ffd46759dff Mon Sep 17 00:00:00 2001 From: "Kirti Savalia (OpenERP)" Date: Thu, 22 Dec 2011 17:03:41 +0530 Subject: [PATCH 022/373] [IMP]:chnage in po file bzr revid: ksa@tinyerp.com-20111222113341-lr2pfvhpbbqv3qjb --- addons/portal/i18n/cs.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/portal/i18n/cs.po b/addons/portal/i18n/cs.po index 3be439be9b6..794150cdf86 100644 --- a/addons/portal/i18n/cs.po +++ b/addons/portal/i18n/cs.po @@ -313,7 +313,7 @@ msgstr "ir.ui.menu" #. module: portal #: help:res.portal,group_id:0 -msgid "The group extended by this portal" +msgid "The group connected to this portal" msgstr "Skupina rozšířená tímto portálem" #. module: portal From 8394afcf8a8b87cd450e259753a117416a56c3d8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 5 Jan 2012 17:06:35 +0100 Subject: [PATCH 023/373] Extend the function action_invoice_create() so that the dict of the invoice is generated inside a dedicated function. We can now inherit this function in custom modules to add/modify values easily. bzr revid: alexis@via.ecp.fr-20120105160635-ac6drtj2ei363r8l --- addons/stock/stock.py | 87 ++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 39 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index cd9242c6b1f..ce344804347 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -968,6 +968,49 @@ class stock_picking(osv.osv): inv_type = 'out_invoice' return inv_type + def _prepare_invoice_group(self, cr, uid, picking, partner, invoice, context=None): + """Builds the dict for grouped invoices""" + comment = self._get_comment_invoice(cr, uid, picking) + + return { + 'name': (invoice.name or '') + ', ' + (picking.name or ''), + 'origin': (invoice.origin or '') + ', ' + (picking.name or '') + (picking.origin and (':' + picking.origin) or ''), + 'comment': (comment and (invoice.comment and invoice.comment + "\n" + comment or comment)) or (invoice.comment and invoice.comment or ''), + 'date_invoice': context.get('date_inv', False), + 'user_id': uid + } + + def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): + """Builds the dict containing the values for the invoice""" + if inv_type in ('out_invoice', 'out_refund'): + account_id = partner.property_account_receivable.id + else: + account_id = partner.property_account_payable.id + address_contact_id, address_invoice_id = \ + self._get_address_invoice(cr, uid, picking).values() + comment = self._get_comment_invoice(cr, uid, picking) + invoice_vals = { + 'name': picking.name, + 'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''), + 'type': inv_type, + 'account_id': account_id, + 'partner_id': partner.id, + 'address_invoice_id': address_invoice_id, + 'address_contact_id': address_contact_id, + 'comment': comment, + 'payment_term': self._get_payment_term(cr, uid, picking), + 'fiscal_position': partner.property_account_position.id, + 'date_invoice': context.get('date_inv', False), + 'company_id': picking.company_id.id, + 'user_id': uid + } + cur_id = self.get_currency_id(cr, uid, picking) + if cur_id: + invoice_vals['currency_id'] = cur_id + if journal_id: + invoice_vals['journal_id'] = journal_id + return invoice_vals + def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None): """ Creates invoice based on the invoice state selected for picking. @@ -981,7 +1024,6 @@ class stock_picking(osv.osv): invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') - address_obj = self.pool.get('res.partner.address') invoices_group = {} res = {} inv_type = type @@ -996,48 +1038,15 @@ class stock_picking(osv.osv): if not inv_type: inv_type = self._get_invoice_type(picking) - if inv_type in ('out_invoice', 'out_refund'): - account_id = partner.property_account_receivable.id - else: - account_id = partner.property_account_payable.id - address_contact_id, address_invoice_id = \ - self._get_address_invoice(cr, uid, picking).values() - address = address_obj.browse(cr, uid, address_contact_id, context=context) - - comment = self._get_comment_invoice(cr, uid, picking) if group and partner.id in invoices_group: invoice_id = invoices_group[partner.id] invoice = invoice_obj.browse(cr, uid, invoice_id) - invoice_vals = { - 'name': (invoice.name or '') + ', ' + (picking.name or ''), - 'origin': (invoice.origin or '') + ', ' + (picking.name or '') + (picking.origin and (':' + picking.origin) or ''), - 'comment': (comment and (invoice.comment and invoice.comment+"\n"+comment or comment)) or (invoice.comment and invoice.comment or ''), - 'date_invoice':context.get('date_inv',False), - 'user_id':uid - } - invoice_obj.write(cr, uid, [invoice_id], invoice_vals, context=context) + invoice_obj.write(cr, uid, [invoice_id], + self._prepare_invoice_group(cr, uid, picking, partner, invoice, context=context), + context=context) else: - invoice_vals = { - 'name': picking.name, - 'origin': (picking.name or '') + (picking.origin and (':' + picking.origin) or ''), - 'type': inv_type, - 'account_id': account_id, - 'partner_id': address.partner_id.id, - 'address_invoice_id': address_invoice_id, - 'address_contact_id': address_contact_id, - 'comment': comment, - 'payment_term': self._get_payment_term(cr, uid, picking), - 'fiscal_position': partner.property_account_position.id, - 'date_invoice': context.get('date_inv',False), - 'company_id': picking.company_id.id, - 'user_id':uid - } - cur_id = self.get_currency_id(cr, uid, picking) - if cur_id: - invoice_vals['currency_id'] = cur_id - if journal_id: - invoice_vals['journal_id'] = journal_id - invoice_id = invoice_obj.create(cr, uid, invoice_vals, + invoice_id = invoice_obj.create(cr, uid, + self._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context), context=context) invoices_group[partner.id] = invoice_id res[picking.id] = invoice_id From 638ca9122e950b4b91f80748f4edf888dbbc07bd Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 5 Jan 2012 17:08:45 +0100 Subject: [PATCH 024/373] Modularize the selection of the partner to invoice when invoicing from the picking. With this modification, all the parameters of the invoice are correct even when the goods are delivered to a third party company i.e. when the partner who receives the goods (picking.address_id.partner_id) is not to partner who ordered the goods (picking.sale_id.partner_id). bzr revid: alexis@via.ecp.fr-20120105160845-c6wk08k7v7i64zyl --- addons/sale/stock.py | 7 ++++++- addons/stock/stock.py | 9 ++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 653b147d3d0..618867821fb 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -48,6 +48,11 @@ class stock_picking(osv.osv): else: return super(stock_picking, self).get_currency_id(cursor, user, picking) + def _get_partner_to_invoice(self, cr, uid, picking, context=None): + if picking.sale_id: + return picking.sale_id.partner_id + return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context) + def _get_payment_term(self, cursor, user, picking): if picking.sale_id and picking.sale_id.payment_term: return picking.sale_id.payment_term.id @@ -195,4 +200,4 @@ class stock_picking(osv.osv): }) return result -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ce344804347..c1a334a4b6d 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -874,6 +874,13 @@ class stock_picking(osv.osv): def get_currency_id(self, cr, uid, picking): return False + def _get_partner_to_invoice(self, cr, uid, picking, context=None): + """ Gets the partner that will be invoiced + Note that this function is inherited in the sale module + @return: partner object + """ + return picking.address_id and picking.address_id.partner_id + def _get_payment_term(self, cr, uid, picking): """ Gets payment term from partner. @return: Payment term @@ -1030,7 +1037,7 @@ class stock_picking(osv.osv): for picking in self.browse(cr, uid, ids, context=context): if picking.invoice_state != '2binvoiced': continue - partner = picking.address_id and picking.address_id.partner_id + partner = self._get_partner_to_invoice(cr, uid, picking, context=context) if not partner: raise osv.except_osv(_('Error, no partner !'), _('Please put a partner on the picking list if you want to generate invoice.')) From 752186173fed4c2a3b71f4e504a0e8336cfb12a9 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 5 Jan 2012 17:23:43 +0100 Subject: [PATCH 025/373] If the fiscal position has been changed on the sale order, the invoice should use the fiscal posion of the sale order and not the fiscal position of the partner. bzr revid: alexis@via.ecp.fr-20120105162343-tf8359d8hrk7r2j1 --- addons/sale/stock.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 618867821fb..30b9367cf4c 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -71,6 +71,12 @@ class stock_picking(osv.osv): return picking.note or picking.sale_id.note return super(stock_picking, self)._get_comment_invoice(cursor, user, picking) + def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): + invoice_vals = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context) + if picking.sale_id and picking.sale_id.fiscal_position: + invoice_vals['fiscal_position'] = picking.sale_id.fiscal_position.id + return invoice_vals + def _get_price_unit_invoice(self, cursor, user, move_line, type): if move_line.sale_line_id and move_line.sale_line_id.product_id.id == move_line.product_id.id: uom_id = move_line.product_id.uom_id.id From 1f9401bf416cf7c3b7dc553bdff6e33ca986b9b5 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 5 Jan 2012 22:42:30 +0100 Subject: [PATCH 026/373] Add _get_partner_to_invoice() to purchase module. Inheritance of _prepare_invoice() now replaces the functions _get_payment_term() and _get_address_invoice(). I have checked that these two functions are not used elsewere in the addons and extra-addons. bzr revid: alexis@via.ecp.fr-20120105214230-3wetu0v1foyeate3 --- addons/purchase/stock.py | 27 ++++++++++++++++----------- addons/sale/stock.py | 27 ++++++++++++--------------- addons/stock/stock.py | 22 ++++------------------ 3 files changed, 32 insertions(+), 44 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index c212a171b21..ca84d88babd 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -58,18 +58,23 @@ class stock_picking(osv.osv): 'purchase_id': False, } - def _get_address_invoice(self, cr, uid, picking): - """ Gets invoice address of a partner - @return {'contact': address, 'invoice': address} for invoice - """ - res = super(stock_picking, self)._get_address_invoice(cr, uid, picking) + def _get_partner_to_invoice(self, cr, uid, picking, context=None): if picking.purchase_id: - partner_obj = self.pool.get('res.partner') - partner = picking.purchase_id.partner_id or picking.address_id.partner_id - data = partner_obj.address_get(cr, uid, [partner.id], - ['contact', 'invoice']) - res.update(data) - return res + return picking.purchase_id.partner_id + return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context) + + def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): + """Inherit the original function of the 'stock' module in order to override some + values if the picking has been generated by a purchase order + """ + invoice_vals = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context) + if picking.purchase_id: + invoice_vals['address_contact_id'], invoice_vals['address_invoice_id'] = \ + self.pool.get('res.partner').address_get(cr, uid, [partner.id], + ['contact', 'invoice']).values() + if picking.purchase_id.fiscal_position: + invoice_vals['fiscal_position'] = picking.purchase_id.fiscal_position.id + return invoice_vals def get_currency_id(self, cursor, user, picking): if picking.purchase_id: diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 30b9367cf4c..6daff3a83b0 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -53,28 +53,25 @@ class stock_picking(osv.osv): return picking.sale_id.partner_id return super(stock_picking, self)._get_partner_to_invoice(cr, uid, picking, context=context) - def _get_payment_term(self, cursor, user, picking): - if picking.sale_id and picking.sale_id.payment_term: - return picking.sale_id.payment_term.id - return super(stock_picking, self)._get_payment_term(cursor, user, picking) - - def _get_address_invoice(self, cursor, user, picking): - res = {} - if picking.sale_id: - res['contact'] = picking.sale_id.partner_order_id.id - res['invoice'] = picking.sale_id.partner_invoice_id.id - return res - return super(stock_picking, self)._get_address_invoice(cursor, user, picking) - def _get_comment_invoice(self, cursor, user, picking): if picking.note or (picking.sale_id and picking.sale_id.note): return picking.note or picking.sale_id.note return super(stock_picking, self)._get_comment_invoice(cursor, user, picking) def _prepare_invoice(self, cr, uid, picking, partner, inv_type, journal_id, context=None): + """Inherit the original function of the 'stock' module in order to override some + values if the picking has been generated by a sale order + """ invoice_vals = super(stock_picking, self)._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context) - if picking.sale_id and picking.sale_id.fiscal_position: - invoice_vals['fiscal_position'] = picking.sale_id.fiscal_position.id + if picking.sale_id: + invoice_vals['address_contact_id'] = picking.sale_id.partner_order_id.id + invoice_vals['address_invoice_id'] = picking.sale_id.partner_invoice_id.id + if picking.sale_id.fiscal_position: + invoice_vals['fiscal_position'] = picking.sale_id.fiscal_position.id + if picking.sale_id.payment_term: + invoice_vals['payment_term'] = picking.sale_id.payment_term.id + if picking.sale_id.user_id: + invoice_vals['user_id'] = picking.sale_id.user_id.id return invoice_vals def _get_price_unit_invoice(self, cursor, user, move_line, type): diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c1a334a4b6d..a1b06adedc6 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -881,22 +881,6 @@ class stock_picking(osv.osv): """ return picking.address_id and picking.address_id.partner_id - def _get_payment_term(self, cr, uid, picking): - """ Gets payment term from partner. - @return: Payment term - """ - partner = picking.address_id.partner_id - return partner.property_payment_term and partner.property_payment_term.id or False - - def _get_address_invoice(self, cr, uid, picking): - """ Gets invoice address of a partner - @return {'contact': address, 'invoice': address} for invoice - """ - partner_obj = self.pool.get('res.partner') - partner = picking.address_id.partner_id - return partner_obj.address_get(cr, uid, [partner.id], - ['contact', 'invoice']) - def _get_comment_invoice(self, cr, uid, picking): """ @return: comment string for invoice @@ -994,7 +978,8 @@ class stock_picking(osv.osv): else: account_id = partner.property_account_payable.id address_contact_id, address_invoice_id = \ - self._get_address_invoice(cr, uid, picking).values() + self.pool.get('res.partner').address_get(cr, uid, [partner.id], + ['contact', 'invoice']).values() comment = self._get_comment_invoice(cr, uid, picking) invoice_vals = { 'name': picking.name, @@ -1005,7 +990,8 @@ class stock_picking(osv.osv): 'address_invoice_id': address_invoice_id, 'address_contact_id': address_contact_id, 'comment': comment, - 'payment_term': self._get_payment_term(cr, uid, picking), + 'payment_term': partner.property_payment_term and partner.property_payment_term.id + or False, 'fiscal_position': partner.property_account_position.id, 'date_invoice': context.get('date_inv', False), 'company_id': picking.company_id.id, From 3d54f085653b6bbfcbd0154af90792ad9c6796a0 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Fri, 6 Jan 2012 15:48:50 +0530 Subject: [PATCH 027/373] [IMP]delivery:add size 64 on name field bzr revid: mma@tinyerp.com-20120106101850-qubjt41c739ky7fu --- addons/delivery/delivery.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index e747e6871b3..dc28d1efb93 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -223,7 +223,7 @@ class delivery_grid_line(osv.osv): _name = "delivery.grid.line" _description = "Delivery Grid Line" _columns = { - 'name': fields.char('Name', size=32, required=True), + 'name': fields.char('Name', size=64, required=True), 'grid_id': fields.many2one('delivery.grid', 'Grid',required=True, ondelete='cascade'), 'type': fields.selection([('weight','Weight'),('volume','Volume'),\ ('wv','Weight * Volume'), ('price','Price')],\ From 20ed63d59809061118cb32c3734c874b4ddc966d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 11 Jan 2012 14:01:21 +0100 Subject: [PATCH 028/373] [IMP] Refactored _altern_si_so code. Added limits to searches. Code now validates only new data, not all past data. Cleaned algorithm documentation. bzr revid: tde@openerp.com-20120111130121-8bcgnjt233nv0izj --- addons/hr_attendance/hr_attendance.py | 37 ++++++++++++--------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/addons/hr_attendance/hr_attendance.py b/addons/hr_attendance/hr_attendance.py index 9987beae248..80741510785 100644 --- a/addons/hr_attendance/hr_attendance.py +++ b/addons/hr_attendance/hr_attendance.py @@ -63,30 +63,25 @@ class hr_attendance(osv.osv): 'employee_id': _employee_get, } - def write(self, cr, uid, ids, vals, context=None): - current_attendance_data = self.browse(cr, uid, ids, context=context)[0] - obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) - if obj_attendance_ids[0] != ids[0]: - if ('name' in vals) or ('action' in vals): - raise osv.except_osv(_('Warning !'), _('You can not modify existing entries. To modify the entry , remove the prior entries.')) - return super(hr_attendance, self).write(cr, uid, ids, vals, context=context) - def _altern_si_so(self, cr, uid, ids, context=None): - current_attendance_data = self.browse(cr, uid, ids, context=context)[0] - obj_attendance_ids = self.search(cr, uid, [('employee_id', '=', current_attendance_data.employee_id.id)], context=context) - obj_attendance_ids.remove(ids[0]) - hr_attendance_data = self.browse(cr, uid, obj_attendance_ids, context=context) - - for old_attendance in hr_attendance_data: - if old_attendance.action == current_attendance_data['action']: + """ Alternance sign_in/sign_out check + Previous (if exists) must be of opposite action + Next (if exists) must be of opposite action + """ + atts = self.browse(cr, uid, ids, context=context) + for att in atts: + # search and browse for first previous and first next records + prev_att_ids = self.search(cr, uid, [('employee_id', '=', att.employee_id.id), ('name', '<', att.name), ('action', 'in', ('sign_in', 'sign_out'))], limit=1, order='name DESC') + next_add_ids = self.search(cr, uid, [('employee_id', '=', att.employee_id.id), ('name', '>', att.name), ('action', 'in', ('sign_in', 'sign_out'))], limit=1, order='name ASC') + prev_atts = self.browse(cr, uid, prev_att_ids, context=context) if (len(prev_att_ids) != 0) else [] + next_atts = self.browse(cr, uid, next_add_ids, context=context) if (len(next_add_ids) != 0) else [] + # perform alternance check, return False if at least one condition is not satisfied + if len(prev_atts) != 0 and prev_atts[0].action == att.action: # previous exists and is same action return False - elif old_attendance.name >= current_attendance_data['name']: + if len(next_atts) != 0 and next_atts[0].action == att.action: # next exists and is same action + return False + if len(prev_atts) == 0 and len(next_atts) == 0 and att.action != 'sign_in': # first attendance must be sign_in return False - else: - return True - # First entry in the system must not be 'sign_out' - if current_attendance_data['action'] == 'sign_out': - return False return True _constraints = [(_altern_si_so, 'Error: Sign in (resp. Sign out) must follow Sign out (resp. Sign in)', ['action'])] From afd266bf6a544937ce26d4948c356fdac3a7f0b8 Mon Sep 17 00:00:00 2001 From: "Nimesh (Open ERP)" Date: Thu, 12 Jan 2012 11:46:36 +0530 Subject: [PATCH 029/373] [FIX]import_google: i have change the external_id_field in initialize. bzr revid: nco@tinyerp.com-20120112061636-xw78p1gog5til567 --- addons/import_google/wizard/import_google.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/import_google/wizard/import_google.py b/addons/import_google/wizard/import_google.py index 936a6d17649..cfeaa623f76 100644 --- a/addons/import_google/wizard/import_google.py +++ b/addons/import_google/wizard/import_google.py @@ -51,7 +51,7 @@ class google_import(import_framework): def initialize(self): google = self.obj.pool.get('google.login') - self.external_id_field = 'Id' + self.external_id_field = 'id' self.gd_client = google.google_login(self.context.get('user'), self.context.get('password'), self.context.get('instance')) From a4eb2a04b56483dacfe00e999cf396c299e96104 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 12 Jan 2012 12:32:40 +0530 Subject: [PATCH 030/373] [REF] purchase: refactor product_id_change and rename with onchange_product_id bzr revid: hmo@tinyerp.com-20120112070240-zgsic6tjiy7j7g30 --- addons/purchase/purchase.py | 101 ++++++++++++++++++------------ addons/purchase/purchase_view.xml | 6 +- 2 files changed, 63 insertions(+), 44 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index bb748d68329..f63b86f11f2 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -697,56 +697,74 @@ class purchase_order_line(osv.osv): default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]}) return super(purchase_order_line, self).copy_data(cr, uid, id, default, context) - #TOFIX: - # - name of method should "onchange_product_id" - # - docstring - # - split into small internal methods for clearity - def product_id_change(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, + + def _onchange_check_partner_pricelist(self, pricelist_id, partner_id): + return True + + def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, name=False, price_unit=False, notes=False, context=None): + """ + onchange handler of product_uom. + """ + if not uom_id: + return {'value': {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False}} + return self.onchange_product_id(cr, uid, ids, pricelist_id, product_id, qty, uom_id, + partner_id, date_order=date_order, fiscal_position_id=fiscal_position_id, date_planned=date_planned, + name=name, price_unit=price_unit, notes=notes, context=context) + + def onchange_product_id(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, + partner_id, date_order=False, fiscal_position_id=False, date_planned=False, + name=False, price_unit=False, notes=False, context=None): + """ + onchange handler of product_id. + """ + res = {} if context is None: context = {} - - res = {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False} - uom_change = context.get('uom_change', False) + res_value = {'price_unit': price_unit or 0.0, 'name': name or '', 'notes': notes or'', 'product_uom' : uom_id or False} + if not product_id: + return {'value': res_value} + + product_product = self.pool.get('product.product') + product_uom = self.pool.get('product.uom') + res_partner = self.pool.get('res.partner') + product_supplierinfo = self.pool.get('product.supplierinfo') + product_pricelist = self.pool.get('product.pricelist') + account_fiscal_position = self.pool.get('account.fiscal.position') + account_tax = self.pool.get('account.tax') + + # - check for the presence of partner_id and pricelist_id if not pricelist_id: raise osv.except_osv(_('No Pricelist !'), _('You have to select a pricelist or a supplier in the purchase form !\nPlease set one before choosing a product.')) if not partner_id: raise osv.except_osv(_('No Partner!'), _('You have to select a partner in the purchase form !\nPlease set one partner before choosing a product.')) - if not product_id: - return {'value': res} - - product_uom_pool = self.pool.get('product.uom') - product_supplierinfo = self.pool.get('product.supplierinfo') - res_partner = self.pool.get('res.partner') - product_product = self.pool.get('product.product') - account_fiscal_position = self.pool.get('account.fiscal.position') - account_tax = self.pool.get('account.tax') - - # set supplier langauage in context + # - determine name and notes based on product in partner lang. lang = res_partner.browse(cr, uid, partner_id).lang if lang: context['lang'] = lang context['partner_id'] = partner_id - product = product_product.browse(cr, uid, product_id, context=context) + res_value.update({'name': product.name, 'notes': notes or product.description_purchase}) + + # - set a domain on product_uom domain = {'product_uom':[('category_id','=',product.uom_id.category_id.id)]} - res['domain'] = domain - - if uom_change and not uom_id: - return {'value': res} + res.update({'domain': domain}) + # - check that uom and product uom belong to the same category product_uom_po_id = product.uom_po_id.id if not uom_id: uom_id = product_uom_po_id - # checking UOM category - if product.uom_id.category_id.id != product_uom_pool.browse(cr, uid, uom_id).category_id.id: + if product.uom_id.category_id.id != product_uom.browse(cr, uid, uom_id, context=context).category_id.id: res.update({'warning': {'title': _('Warning'), 'message': _('Selected UOM does not have same category of default UOM')}}) uom_id = product_uom_po_id - + + res_value.update({'product_uom': uom_id}) + + # - determine product_qty and date_planned based on seller info if not date_order: date_order = time.strftime('%Y-%m-%d') @@ -758,31 +776,32 @@ class purchase_order_line(osv.osv): seller_delay = supplierinfo.delay if supplierinfo.product_uom.id != uom_id: res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier only sells this product by %s') % supplierinfo.product_uom.name }}) - min_qty = product_uom_pool._compute_qty(cr, uid, supplierinfo.product_uom.id, supplierinfo.min_qty, to_uom_id=uom_id) + min_qty = product_uom._compute_qty(cr, uid, supplierinfo.product_uom.id, supplierinfo.min_qty, to_uom_id=uom_id) if qty < min_qty: # If the supplier quantity is greater than entered from user, set minimal. res.update({'warning': {'title': _('Warning'), 'message': _('The selected supplier has a minimal quantity set to %s %s, you should not purchase less.') % (supplierinfo.min_qty, supplierinfo.product_uom.name)}}) qty = min_qty - - price = self.pool.get('product.pricelist').price_get(cr, uid, [pricelist_id], + + dt = (datetime.strptime(date_order, '%Y-%m-%d') + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S') + res_value.update({'date_planned': date_planned or dt, 'product_qty': qty}) + + # - determine price_unit and taxes_id + price = product_pricelist.price_get(cr, uid, [pricelist_id], product.id, qty or 1.0, partner_id, { 'uom': uom_id, 'date': date_order, })[pricelist_id] - dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S') - - - res.update({'value': {'price_unit': price, 'name': product.name, - 'taxes_id':map(lambda x: x.id, product.supplier_taxes_id), - 'date_planned': date_planned or dt,'notes': notes or product.description_purchase, - 'product_qty': qty, - 'product_uom': uom_id}}) - + taxes = account_tax.browse(cr, uid, map(lambda x: x.id, product.supplier_taxes_id)) fpos = fiscal_position_id and account_fiscal_position.browse(cr, uid, fiscal_position_id, context=context) or False - res['value']['taxes_id'] = account_fiscal_position.map_tax(cr, uid, fpos, taxes) + taxes_ids = account_fiscal_position.map_tax(cr, uid, fpos, taxes) + res_value.update({'price_unit': price, 'taxes_id': taxes_ids}) + + + res.update({'value': res_value}) return res - product_uom_change = product_id_change + product_id_change = onchange_product_id + product_uom_change = onchange_product_uom def action_confirm(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'confirmed'}, context=context) diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 14f5354f970..221c0b854a1 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -359,9 +359,9 @@
- - - + + + From cdabe44260423cebf266f80e0655fc3d3a15a53b Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Thu, 12 Jan 2012 12:48:56 +0530 Subject: [PATCH 031/373] [IMP] purchase: remove unused method bzr revid: hmo@tinyerp.com-20120112071856-zh0bl7tn7zv0x21i --- addons/purchase/purchase.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 3895fd39667..908720eccd1 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -697,10 +697,6 @@ class purchase_order_line(osv.osv): default.update({'state':'draft', 'move_ids':[],'invoiced':0,'invoice_lines':[]}) return super(purchase_order_line, self).copy_data(cr, uid, id, default, context) - - def _onchange_check_partner_pricelist(self, pricelist_id, partner_id): - return True - def onchange_product_uom(self, cr, uid, ids, pricelist_id, product_id, qty, uom_id, partner_id, date_order=False, fiscal_position_id=False, date_planned=False, name=False, price_unit=False, notes=False, context=None): From 4cc5c14273ea39b9fcbba5c117c1b1c2b22dd2fd Mon Sep 17 00:00:00 2001 From: "hbto(humbertoarocha)" <> Date: Thu, 12 Jan 2012 14:51:49 +0530 Subject: [PATCH 032/373] [FIX] account: add Missing date on fiscalyear clousure wizard account.fiscalyear.close lp bug: https://launchpad.net/bugs/912623 fixed bzr revid: jap@tinyerp.com-20120112092149-ism5impd38iliz2u --- addons/account/wizard/account_fiscalyear_close.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index d2295b5bbf2..849a7a9f514 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -105,6 +105,7 @@ class account_fiscalyear_close(osv.osv_memory): 'name': '/', 'ref': '', 'period_id': period.id, + 'date': period.date_start, 'journal_id': new_journal.id, } move_id = obj_acc_move.create(cr, uid, vals, context=context) @@ -118,7 +119,6 @@ class account_fiscalyear_close(osv.osv_memory): AND a.type != 'view' AND t.close_method = %s''', ('unreconciled', )) account_ids = map(lambda x: x[0], cr.fetchall()) - if account_ids: cr.execute(''' INSERT INTO account_move_line ( @@ -130,11 +130,11 @@ class account_fiscalyear_close(osv.osv_memory): (SELECT name, create_uid, create_date, write_uid, write_date, statement_id, %s,currency_id, date_maturity, partner_id, blocked, credit, 'draft', debit, ref, account_id, - %s, date, %s, amount_currency, quantity, product_id, company_id + %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id FROM account_move_line WHERE account_id IN %s AND ''' + query_line + ''' - AND reconcile_id IS NULL)''', (new_journal.id, period.id, move_id, tuple(account_ids),)) + AND reconcile_id IS NULL)''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),)) #We have also to consider all move_lines that were reconciled #on another fiscal year, and report them too @@ -149,7 +149,7 @@ class account_fiscalyear_close(osv.osv_memory): b.name, b.create_uid, b.create_date, b.write_uid, b.write_date, b.statement_id, %s, b.currency_id, b.date_maturity, b.partner_id, b.blocked, b.credit, 'draft', b.debit, - b.ref, b.account_id, %s, b.date, %s, b.amount_currency, + b.ref, b.account_id, %s, (%s) AS date, %s, b.amount_currency, b.quantity, b.product_id, b.company_id FROM account_move_line b WHERE b.account_id IN %s @@ -157,7 +157,7 @@ class account_fiscalyear_close(osv.osv_memory): AND b.period_id IN ('''+fy_period_set+''') AND b.reconcile_id IN (SELECT DISTINCT(reconcile_id) FROM account_move_line a - WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, move_id, tuple(account_ids),)) + WHERE a.period_id IN ('''+fy2_period_set+''')))''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),)) #2. report of the accounts with defferal method == 'detail' cr.execute(''' @@ -180,11 +180,11 @@ class account_fiscalyear_close(osv.osv_memory): (SELECT name, create_uid, create_date, write_uid, write_date, statement_id, %s,currency_id, date_maturity, partner_id, blocked, credit, 'draft', debit, ref, account_id, - %s, date, %s, amount_currency, quantity, product_id, company_id + %s, (%s) AS date, %s, amount_currency, quantity, product_id, company_id FROM account_move_line WHERE account_id IN %s AND ''' + query_line + ''') - ''', (new_journal.id, period.id, move_id, tuple(account_ids),)) + ''', (new_journal.id, period.id, period.date_start, move_id, tuple(account_ids),)) #3. report of the accounts with defferal method == 'balance' From 59cbdd3341721226ef6f8ddfdd8f143273077806 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Thu, 12 Jan 2012 15:19:04 +0530 Subject: [PATCH 033/373] [ADD] hr_attendance : Added Test Cases For Hr Attendance bzr revid: mdi@tinyerp.com-20120112094904-b10x1mx4c2uxitzj --- .../hr_attendance/test/attendance_process.yml | 55 ++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 1d8308c2f45..5c83ba25aa1 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -28,4 +28,57 @@ - !assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in absent state}: - state == 'absent' - +- + In order to check that first attendance must be Sign In. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 09:59:25'), action: 'sign_out'}, None) + except Exception, e: + assert e, 'The first attendance must be Sign In' +- + First of all, Employee Sign's In. +- + !record {model: hr.attendance, id: hr_attendance_1}: + employee_id: hr.employee_fp + name: !eval time.strftime('%Y-%m-%d 09:59:25') + action: 'sign_in' +- + Now Employee is going to Sign In prior to First Sign In. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 08:59:25'), action: 'sign_in'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' +- + After that Employee is going to Sign In after First Sign In. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_in'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' +- + After two hours, Employee Sign's Out. +- + !record {model: hr.attendance, id: hr_attendance_4}: + employee_id: hr.employee_fp + name: !eval time.strftime('%Y-%m-%d 11:59:25') + action: 'sign_out' +- + Now Employee is going to Sign Out prior to First Sign Out. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_out'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' +- + After that Employee is going to Sign Out After First Sign Out. +- + !python {model: hr.attendance}: | + try: + self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 12:59:25'), action: 'sign_out'}, None) + except Exception, e: + assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' From 815f27fedf5da0b1772f231cd565982da5df836c Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 12 Jan 2012 17:14:57 +0530 Subject: [PATCH 034/373] [IMP]mrp_repair: added a message when repair order without repair line bzr revid: mma@tinyerp.com-20120112114457-yheegsrhr8tikbuy --- addons/mrp_repair/mrp_repair.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp_repair/mrp_repair.py b/addons/mrp_repair/mrp_repair.py index e1216332ae4..e420ebdbf68 100644 --- a/addons/mrp_repair/mrp_repair.py +++ b/addons/mrp_repair/mrp_repair.py @@ -330,6 +330,8 @@ class mrp_repair(osv.osv): self.write(cr, uid, [o.id], {'state': '2binvoiced'}) else: self.write(cr, uid, [o.id], {'state': 'confirmed'}) + if not o.operations: + raise osv.except_osv(_('Error !'),_('You cannot confirm a repair order which has no line.')) for line in o.operations: if line.product_id.track_production and not line.prodlot_id: raise osv.except_osv(_('Warning'), _("Production lot is required for opration line with product '%s'") % (line.product_id.name)) From 447cf0e2b32f384ff209bb66608260b294106dd8 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Thu, 12 Jan 2012 17:28:34 +0530 Subject: [PATCH 035/373] [IMP]mrp_repair: pass a workflow in make invoice wizard bzr revid: mma@tinyerp.com-20120112115834-8gma20bjj0bbf64h --- addons/mrp_repair/wizard/make_invoice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/addons/mrp_repair/wizard/make_invoice.py b/addons/mrp_repair/wizard/make_invoice.py index 61f82a3d57c..6b49aab5aba 100644 --- a/addons/mrp_repair/wizard/make_invoice.py +++ b/addons/mrp_repair/wizard/make_invoice.py @@ -45,6 +45,8 @@ class make_invoice(osv.osv_memory): order_obj = self.pool.get('mrp.repair') newinv = order_obj.action_invoice_create(cr, uid, context['active_ids'], group=inv.group,context=context) + wf_service = netsvc.LocalService("workflow") + wf_service.trg_validate(uid, 'mrp.repair', context.get('active_id'), 'action_invoice_create' , cr) return { 'domain': [('id','in', newinv.values())], From 7449274b63c6539ea023ac6f6239fc0b07433736 Mon Sep 17 00:00:00 2001 From: Benoit Guillot Date: Thu, 12 Jan 2012 15:44:56 +0100 Subject: [PATCH 036/373] [REF] refactor _calc_seller and create the function _get_main_product_supplier bzr revid: benoit.guillot@akretion.com.br-20120112144456-pg8vg1stpm9y78ky --- addons/product/product.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index e6b4b4c6348..601c47d8f91 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -257,20 +257,23 @@ product_category() class product_template(osv.osv): _name = "product.template" _description = "Product Template" + + def _get_main_product_supplier(self, cr, uid, product, context=None): + sellers = [(seller_info.sequence, seller_info) + for seller_info in product.seller_ids or [] + if seller_info and isinstance(seller_info.sequence, (int, long))] + return sellers and sellers[0][1] or False + def _calc_seller(self, cr, uid, ids, fields, arg, context=None): result = {} for product in self.browse(cr, uid, ids, context=context): - for field in fields: - result[product.id] = {field:False} - result[product.id]['seller_delay'] = 1 - if product.seller_ids: - partner_list = [(partner_id.sequence, partner_id) - for partner_id in product.seller_ids - if partner_id and isinstance(partner_id.sequence, (int, long))] - main_supplier = partner_list and partner_list[0] and partner_list[0][1] or False - result[product.id]['seller_delay'] = main_supplier and main_supplier.delay or 1 - result[product.id]['seller_qty'] = main_supplier and main_supplier.qty or 0.0 - result[product.id]['seller_id'] = main_supplier and main_supplier.name.id or False + main_supplier = self._get_main_product_supplier(cr, uid, product, context=context) + result[product.id] = { + 'seller_info_id': main_supplier and main_supplier.id or False, + 'seller_delay': main_supplier and main_supplier.delay or 1, + 'seller_qty': main_supplier and main_supplier.qty or 0.0, + 'seller_id': main_supplier and main_supplier.name.id or False + } return result _columns = { @@ -317,6 +320,7 @@ class product_template(osv.osv): 'loc_row': fields.char('Row', size=16), 'loc_case': fields.char('Case', size=16), 'company_id': fields.many2one('res.company', 'Company',select=1), + 'seller_info_id': fields.function(_calc_seller, type='many2one', relation="product.supplierinfo", multi="seller_info"), } def _get_uom_id(self, cr, uid, *args): From f1b0a82ff6b4786d8283ffc646066f9fde671175 Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Fri, 13 Jan 2012 14:14:42 +0530 Subject: [PATCH 037/373] [FIX]:Survey: if send invitation log in with that account it shows only that survey bzr revid: sgo@tinyerp.com-20120113084442-9uhynv0ut54h9dad --- addons/survey/wizard/survey_selection.py | 26 ++++++++++++++++++++++- addons/survey/wizard/survey_selection.xml | 3 +-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 82c9fd385ed..e865330fac9 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -22,12 +22,13 @@ from osv import osv from osv import fields from tools.translate import _ +from lxml import etree class survey_name_wiz(osv.osv_memory): _name = 'survey.name.wiz' _columns = { - 'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade'), + 'survey_id': fields.many2one('survey', 'Survey', required=True, ondelete='cascade' ,domain= [('state', '=', 'open')]), 'page_no': fields.integer('Page Number'), 'note': fields.text("Description"), 'page': fields.char('Page Position',size = 12), @@ -44,6 +45,27 @@ class survey_name_wiz(osv.osv_memory): 'store_ans': '{}' #Setting the default pattern as '{}' as the field is of type text. The field always gets the value in dict format } + def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + survey_obj = self.pool.get('survey') + lines_ids=[] + res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) + survey_user_group_id = self.pool.get('res.groups').search(cr, uid, [('name', '=', 'Survey / User')]) + group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User','Survey / User'))]) + user_obj = self.pool.get('res.users') + user_rec = user_obj.read(cr, uid, uid) + if uid!=1: + if survey_user_group_id: + if survey_user_group_id == user_rec['groups_id']: + lines_ids=survey_obj.search(cr, uid, [ ('invited_user_ids','in',uid)], context=context) + domain = '[("id", "in", '+ str(lines_ids)+')]' + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='survey_id']") + for node in nodes: + node.set('domain', domain) + res['arch'] = etree.tostring(doc) + return res + + def action_next(self, cr, uid, ids, context=None): """ Start the survey, Increment in started survey field but if set the max_response_limit of @@ -87,5 +109,7 @@ class survey_name_wiz(osv.osv_memory): return {} notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note'] return {'value': {'note': notes}} + +survey_name_wiz() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/survey/wizard/survey_selection.xml b/addons/survey/wizard/survey_selection.xml index 144525979dd..a72566f7888 100644 --- a/addons/survey/wizard/survey_selection.xml +++ b/addons/survey/wizard/survey_selection.xml @@ -15,8 +15,7 @@ + on_change="on_change_survey(survey_id)" width="250"/> From 37530335e1ece8ada40e2b0f4110738141a0b40d Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Fri, 13 Jan 2012 14:46:45 +0530 Subject: [PATCH 038/373] survey set nolable=1 with questations bzr revid: tta@openerp.com-20120113091645-qza696j2ju2dvdi5 --- addons/survey/survey_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/survey/survey_view.xml b/addons/survey/survey_view.xml index 3dd7ca17f6f..0f1a68145aa 100644 --- a/addons/survey/survey_view.xml +++ b/addons/survey/survey_view.xml @@ -39,7 +39,7 @@ - + From e5f375ce0d07ee60e2cf242258d3f13f1bb6316a Mon Sep 17 00:00:00 2001 From: "Sanjay Gohel (Open ERP)" Date: Fri, 13 Jan 2012 15:09:11 +0530 Subject: [PATCH 039/373] [FIX]Survey: improve code remove unused code remove users bzr revid: sgo@tinyerp.com-20120113093911-cd1vvavmqo5p735p --- addons/survey/wizard/survey_selection.py | 29 +++++++++--------------- 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index e865330fac9..37d8e3bade2 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -46,23 +46,18 @@ class survey_name_wiz(osv.osv_memory): } def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + survey_obj = self.pool.get('survey') - lines_ids=[] - res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) - survey_user_group_id = self.pool.get('res.groups').search(cr, uid, [('name', '=', 'Survey / User')]) - group_id = self.pool.get('res.groups').search(cr, uid, [('name', 'in', ('Tools / Manager','Tools / User','Survey / User'))]) - user_obj = self.pool.get('res.users') - user_rec = user_obj.read(cr, uid, uid) - if uid!=1: - if survey_user_group_id: - if survey_user_group_id == user_rec['groups_id']: - lines_ids=survey_obj.search(cr, uid, [ ('invited_user_ids','in',uid)], context=context) - domain = '[("id", "in", '+ str(lines_ids)+')]' - doc = etree.XML(res['arch']) - nodes = doc.xpath("//field[@name='survey_id']") - for node in nodes: - node.set('domain', domain) - res['arch'] = etree.tostring(doc) + lines_ids = [] + res = super(survey_name_wiz, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) + if uid != 1: + lines_ids = survey_obj.search(cr, uid,[('invited_user_ids','in',uid)], context=context) + domain = '[("id", "in", '+ str(lines_ids)+')]' + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='survey_id']") + for node in nodes: + node.set('domain',domain) + res['arch'] = etree.tostring(doc) return res @@ -110,6 +105,4 @@ class survey_name_wiz(osv.osv_memory): notes = self.pool.get('survey').read(cr, uid, survey_id, ['note'])['note'] return {'value': {'note': notes}} -survey_name_wiz() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From 664de510ad8e29951bd7a19e8e5b4cdd25f6214a Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 13 Jan 2012 12:17:36 +0100 Subject: [PATCH 040/373] [IMP] edi: remove debug in edi url bzr revid: chs@openerp.com-20120113111736-w542872mwozrhbpp --- addons/edi/models/edi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/edi/models/edi.py b/addons/edi/models/edi.py index c573115618e..589922ff178 100644 --- a/addons/edi/models/edi.py +++ b/addons/edi/models/edi.py @@ -2,7 +2,7 @@ ############################################################################## # # OpenERP, Open Source Business Applications -# Copyright (c) 2011 OpenERP S.A. +# Copyright (c) 2011-2012 OpenERP S.A. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -37,7 +37,7 @@ from tools.translate import _ from tools.safe_eval import safe_eval as eval EXTERNAL_ID_PATTERN = re.compile(r'^([^.:]+)(?::([^.]+))?\.(\S+)$') -EDI_VIEW_WEB_URL = '%s/edi/view?debug=1&db=%s&token=%s' +EDI_VIEW_WEB_URL = '%s/edi/view?db=%s&token=%s' EDI_PROTOCOL_VERSION = 1 # arbitrary ever-increasing version number EDI_GENERATOR = 'OpenERP ' + release.major_version EDI_GENERATOR_VERSION = release.version_info @@ -682,4 +682,4 @@ class EDIMixin(object): return record_id -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From fb2e5f04c00d492b6edfab0c73b230ab6c0ef591 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 13 Jan 2012 12:20:34 +0100 Subject: [PATCH 041/373] [FIX] edi: correct design bzr revid: chs@openerp.com-20120113112034-zr1v1qsvwn6ya0x7 --- addons/edi/static/src/js/edi.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/edi/static/src/js/edi.js b/addons/edi/static/src/js/edi.js index 73bcfa267e5..352177156e1 100644 --- a/addons/edi/static/src/js/edi.js +++ b/addons/edi/static/src/js/edi.js @@ -109,7 +109,7 @@ openerp.edi.EdiView = openerp.web.Widget.extend({ openerp.edi.edi_view = function (db, token) { openerp.connection.bind().then(function () { - new openerp.edi.EdiView(null,db,token).appendTo($("body")); + new openerp.edi.EdiView(null,db,token).appendTo($("body").addClass('openerp')); }); } @@ -172,7 +172,7 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({ openerp.edi.edi_import = function (url) { openerp.connection.bind().then(function () { - new openerp.edi.EdiImport(null,url).appendTo($("body")); + new openerp.edi.EdiImport(null,url).appendTo($("body").addClass('openerp')); }); } From db1ffb561b704d76a6ee80faf94fbce906df82e5 Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 13 Jan 2012 12:21:21 +0100 Subject: [PATCH 042/373] [FIX] edi: ask login before import bzr revid: chs@openerp.com-20120113112121-5tlnb2he9sw8cbe0 --- addons/edi/static/src/js/edi.js | 47 +++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/addons/edi/static/src/js/edi.js b/addons/edi/static/src/js/edi.js index 352177156e1..d62a4c3b780 100644 --- a/addons/edi/static/src/js/edi.js +++ b/addons/edi/static/src/js/edi.js @@ -114,30 +114,49 @@ openerp.edi.edi_view = function (db, token) { } openerp.edi.EdiImport = openerp.web.Widget.extend({ - init: function(parent,url) { - this._super(); - this.url = url; - var params = {}; + template: "EdiImport", - this.template = "EdiImport"; - this.session = openerp.connection; - this.login = new openerp.web.Login(this); - this.header = new openerp.web.Header(this); + init: function(parent, url) { + this._super(parent); + this.url = url; }, start: function() { - // TODO fix by explicitly asking login if needed - //this.session.on_session_invalid.add_last(this.do_ask_login); - this.header.appendTo($("#oe_header")); - this.login.appendTo($('#oe_login')); + if (!this.session.session_is_valid()) { + this.show_login(); + this.session.on_session_valid.add({ + callback: this.proxy('show_import'), + unique: true, + }); + } else { + this.show_import(); + } + }, + + show_import: function() { + this.destroy_content(); this.do_import(); }, + + show_login: function() { + this.destroy_content(); + this.login = new openerp.web.Login(this); + this.login.appendTo(this.$element); + }, + + destroy_content: function() { + _.each(_.clone(this.widget_children), function(el) { + el.stop(); + }); + this.$element.children().remove(); + }, + do_import: function() { this.rpc('/edi/import_edi_url', {url: this.url}, this.on_imported, this.on_imported_error); }, on_imported: function(response) { if ('action' in response) { this.rpc("/web/session/save_session_action", {the_action: response.action}, function(key) { - window.location = "/web/webclient/home?debug=1&s_action="+encodeURIComponent(key); + window.location = "/web/webclient/home#sa="+encodeURIComponent(key); }); } else { @@ -147,7 +166,7 @@ openerp.edi.EdiImport = openerp.web.Widget.extend({ buttons: { Ok: function() { $(this).dialog("close"); - window.location = "/web/webclient/home"; + window.location = "/"; } } }).html('The document has been successfully imported!'); From b84f9fe2d7937b023a79bea30b05fc93671c21be Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 13 Jan 2012 12:36:08 +0100 Subject: [PATCH 043/373] [IMP] handle session actions bzr revid: chs@openerp.com-20120113113608-am1cbzs6z0urfh4k --- addons/web/static/src/js/views.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index f8bdd58bc3e..87e3861fc87 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -80,6 +80,16 @@ session.web.ActionManager = session.web.Widget.extend({ }; action_loaded = this.do_action(action); } + else if (state.sa) { + // load session action + var self = this; + this.null_action(); + action_loaded = this.rpc('/web/session/get_session_action', {key: state.sa}).pipe(function(action) { + if (action) { + return self.do_action(action); + } + }); + } else if (state.client_action) { this.null_action(); this.ir_actions_client(state.client_action); From cf252dd6c14779619483820abaecc856692d9456 Mon Sep 17 00:00:00 2001 From: "Atul Patel (OpenERP)" Date: Fri, 13 Jan 2012 19:06:15 +0530 Subject: [PATCH 044/373] [FIX]crm_partner_assign: Add user_id insted of "partner_id" in crm_lead_view.xml under the crm.lead Search View. bzr revid: atp@tinyerp.com-20120113133615-twtc2sntv373y5b3 --- addons/crm_partner_assign/crm_lead_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm_partner_assign/crm_lead_view.xml b/addons/crm_partner_assign/crm_lead_view.xml index 14e160fb397..224a52a104c 100644 --- a/addons/crm_partner_assign/crm_lead_view.xml +++ b/addons/crm_partner_assign/crm_lead_view.xml @@ -61,7 +61,7 @@ - + From 293ee2f2d457038c14df853733688175d0b2a02f Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 16 Jan 2012 12:15:26 +0530 Subject: [PATCH 045/373] [IMP] hr_attendance : Improved Test Cases. bzr revid: mdi@tinyerp.com-20120116064526-i1o9qwq4nxlv01yx --- .../hr_attendance/test/attendance_process.yml | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 5c83ba25aa1..7d76ee79e74 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -43,42 +43,62 @@ employee_id: hr.employee_fp name: !eval time.strftime('%Y-%m-%d 09:59:25') action: 'sign_in' +- + In order to check that first attendance must be Sign In. +- + !python {model: hr.attendance}: | + import time + try: + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 09:59:25'), 'action': 'sign_out'}, None) + except Exception, e: + assert e[0]=='ValidateError', e +- + First of all, Employee Sign's In. +- + !record {model: hr.attendance, id: hr_attendance_0}: + employee_id: hr.employee_niv + name: !eval time.strftime('%Y-%m-%d 09:59:25') + action: 'sign_in' - Now Employee is going to Sign In prior to First Sign In. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 08:59:25'), action: 'sign_in'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 08:59:25'), 'action': 'sign_in'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e - After that Employee is going to Sign In after First Sign In. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_in'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 10:59:25'), 'action': 'sign_in'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e - After two hours, Employee Sign's Out. - - !record {model: hr.attendance, id: hr_attendance_4}: - employee_id: hr.employee_fp + !record {model: hr.attendance, id: hr_attendance_1}: + employee_id: hr.employee_niv name: !eval time.strftime('%Y-%m-%d 11:59:25') action: 'sign_out' - Now Employee is going to Sign Out prior to First Sign Out. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 10:59:25'), action: 'sign_out'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 10:59:25'), 'action': 'sign_out'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e - After that Employee is going to Sign Out After First Sign Out. - !python {model: hr.attendance}: | + import time try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 12:59:25'), action: 'sign_out'}, None) + self.create(cr, uid, {'employee_id': ref('hr.employee_niv'), 'name': time.strftime('%Y-%m-%d 12:59:25'), 'action': 'sign_out'}, None) except Exception, e: - assert e, 'Sign In (resp. Sign Out) must follow Sign Out (resp. Sign In)' + assert e[0]=='ValidateError', e From 7db3e24af994a60cdb26cb8074717aa153e506c8 Mon Sep 17 00:00:00 2001 From: "Divyesh Makwana (Open ERP)" Date: Mon, 16 Jan 2012 12:30:12 +0530 Subject: [PATCH 046/373] [IMP] hr_attendance : Improved Test Cases. bzr revid: mdi@tinyerp.com-20120116070012-8blt2ov12b0qx74b --- addons/hr_attendance/test/attendance_process.yml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 7d76ee79e74..4ad765d65df 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -30,21 +30,6 @@ - state == 'absent' - In order to check that first attendance must be Sign In. -- - !python {model: hr.attendance}: | - try: - self.create(cr, uid, {employee_id: hr.employee_fp, name: time.strftime('%Y-%m-%d 09:59:25'), action: 'sign_out'}, None) - except Exception, e: - assert e, 'The first attendance must be Sign In' -- - First of all, Employee Sign's In. -- - !record {model: hr.attendance, id: hr_attendance_1}: - employee_id: hr.employee_fp - name: !eval time.strftime('%Y-%m-%d 09:59:25') - action: 'sign_in' -- - In order to check that first attendance must be Sign In. - !python {model: hr.attendance}: | import time From 8dfb00969cd1a0d9fc9c9e0642f5cad59ce38064 Mon Sep 17 00:00:00 2001 From: "tfr@openerp.com" <> Date: Mon, 16 Jan 2012 15:04:53 +0100 Subject: [PATCH 047/373] [FIX] Fix base contact, when create an address from a contact you can link to a partner + delete useless definition of partner_id in location + add domain when select a location bzr revid: tfr@openerp.com-20120116140453-k3m6busjbk29aygr --- addons/base_contact/base_contact.py | 1 - addons/base_contact/base_contact_view.xml | 5 +++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/base_contact/base_contact.py b/addons/base_contact/base_contact.py index 40653f01ff3..7df5c444ecb 100644 --- a/addons/base_contact/base_contact.py +++ b/addons/base_contact/base_contact.py @@ -120,7 +120,6 @@ class res_partner_location(osv.osv): 'city': fields.char('City', size=128), 'state_id': fields.many2one("res.country.state", 'Fed. State', domain="[('country_id','=',country_id)]"), 'country_id': fields.many2one('res.country', 'Country'), - 'partner_id': fields.many2one('res.partner', 'Partner Name', ondelete='set null', select=True, help="Keep empty for a private address, not related to partner."), 'company_id': fields.many2one('res.company', 'Company',select=1), 'job_ids': fields.one2many('res.partner.address', 'location_id', 'Contacts'), 'partner_id': fields.related('job_ids', 'partner_id', type='many2one',\ diff --git a/addons/base_contact/base_contact_view.xml b/addons/base_contact/base_contact_view.xml index 10d8de984c2..16a9a966e25 100644 --- a/addons/base_contact/base_contact_view.xml +++ b/addons/base_contact/base_contact_view.xml @@ -50,7 +50,8 @@ - + + @@ -135,7 +136,7 @@ form - + From da9d5063499fecbee58681ce55010ecab9afc262 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 16 Jan 2012 15:16:43 +0100 Subject: [PATCH 048/373] Override values even when they are empty (a user may empty a value on a sale order or purchase order and would like the empty field to be "copied" on the invoice). bzr revid: alexis@via.ecp.fr-20120116141643-boglddgratoro59p --- addons/purchase/stock.py | 3 +-- addons/sale/stock.py | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index ca84d88babd..acb4ae13c05 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -72,8 +72,7 @@ class stock_picking(osv.osv): invoice_vals['address_contact_id'], invoice_vals['address_invoice_id'] = \ self.pool.get('res.partner').address_get(cr, uid, [partner.id], ['contact', 'invoice']).values() - if picking.purchase_id.fiscal_position: - invoice_vals['fiscal_position'] = picking.purchase_id.fiscal_position.id + invoice_vals['fiscal_position'] = picking.purchase_id.fiscal_position.id return invoice_vals def get_currency_id(self, cursor, user, picking): diff --git a/addons/sale/stock.py b/addons/sale/stock.py index 6daff3a83b0..f42f09eb20c 100644 --- a/addons/sale/stock.py +++ b/addons/sale/stock.py @@ -66,12 +66,9 @@ class stock_picking(osv.osv): if picking.sale_id: invoice_vals['address_contact_id'] = picking.sale_id.partner_order_id.id invoice_vals['address_invoice_id'] = picking.sale_id.partner_invoice_id.id - if picking.sale_id.fiscal_position: - invoice_vals['fiscal_position'] = picking.sale_id.fiscal_position.id - if picking.sale_id.payment_term: - invoice_vals['payment_term'] = picking.sale_id.payment_term.id - if picking.sale_id.user_id: - invoice_vals['user_id'] = picking.sale_id.user_id.id + invoice_vals['fiscal_position'] = picking.sale_id.fiscal_position.id + invoice_vals['payment_term'] = picking.sale_id.payment_term.id + invoice_vals['user_id'] = picking.sale_id.user_id.id return invoice_vals def _get_price_unit_invoice(self, cursor, user, move_line, type): From 13e80f5e0e7ad934d386c06ce3ead24d5298a5fe Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 16 Jan 2012 15:18:24 +0100 Subject: [PATCH 049/373] Make the creation of the invoice lines extensible too. This change also fixes a bug when the fiscal position is changed on the sale order/purchase order : now, the account on the invoice line uses the fiscal position of the sale order/purchase order and not the fiscal position of the partner. bzr revid: alexis@via.ecp.fr-20120116141824-iw7y1wdnueahahuz --- addons/stock/stock.py | 109 ++++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 52 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index a1b06adedc6..e16b982aee9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution @@ -1004,6 +1005,53 @@ class stock_picking(osv.osv): invoice_vals['journal_id'] = journal_id return invoice_vals + def _prepare_invoice_line(self, cr, uid, group, picking, move_line, invoice_id, + invoice_vals, context=None): + """Builds the dict containing the values for the invoice line""" + if group: + name = (picking.name or '') + '-' + move_line.name + else: + name = move_line.name + origin = move_line.picking_id.name or '' + if move_line.picking_id.origin: + origin += ':' + move_line.picking_id.origin + + if invoice_vals['type'] in ('out_invoice', 'out_refund'): + account_id = move_line.product_id.product_tmpl_id.\ + property_account_income.id + if not account_id: + account_id = move_line.product_id.categ_id.\ + property_account_income_categ.id + else: + account_id = move_line.product_id.product_tmpl_id.\ + property_account_expense.id + if not account_id: + account_id = move_line.product_id.categ_id.\ + property_account_expense_categ.id + if invoice_vals['fiscal_position']: + fp_obj = self.pool.get('account.fiscal.position') + fiscal_position = fp_obj.browse(cr, uid, invoice_vals['fiscal_position'], context=context) + account_id = fp_obj.map_account(cr, uid, fiscal_position, account_id) + # set UoS if it's a sale and the picking doesn't have one + uos_id = move_line.product_uos and move_line.product_uos.id or False + if not uos_id and invoice_vals['type'] in ('out_invoice', 'out_refund'): + uos_id = move_line.product_uom.id + + return { + 'name': name, + 'origin': origin, + 'invoice_id': invoice_id, + 'uos_id': uos_id, + 'product_id': move_line.product_id.id, + 'account_id': account_id, + 'price_unit': self._get_price_unit_invoice(cr, uid, move_line, invoice_vals['type']), + 'discount': self._get_discount_invoice(cr, uid, move_line), + 'quantity': move_line.product_uos_qty or move_line.product_qty, + 'invoice_line_tax_id': [(6, 0, + self._get_taxes_invoice(cr, uid, move_line, invoice_vals['type']))], + 'account_analytic_id': self._get_account_analytic_invoice(cr, uid, picking, move_line), + } + def action_invoice_create(self, cr, uid, ids, journal_id=False, group=False, type='out_invoice', context=None): """ Creates invoice based on the invoice state selected for picking. @@ -1034,64 +1082,21 @@ class stock_picking(osv.osv): if group and partner.id in invoices_group: invoice_id = invoices_group[partner.id] invoice = invoice_obj.browse(cr, uid, invoice_id) - invoice_obj.write(cr, uid, [invoice_id], - self._prepare_invoice_group(cr, uid, picking, partner, invoice, context=context), - context=context) + invoice_vals_group = self._prepare_invoice_group(cr, uid, picking, partner, invoice, context=context) + invoice_obj.write(cr, uid, [invoice_id], invoice_vals_group, context=context) else: - invoice_id = invoice_obj.create(cr, uid, - self._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context), - context=context) + invoice_vals = self._prepare_invoice(cr, uid, picking, partner, inv_type, journal_id, context=context) + invoice_id = invoice_obj.create(cr, uid, invoice_vals, context=context) invoices_group[partner.id] = invoice_id res[picking.id] = invoice_id for move_line in picking.move_lines: if move_line.state == 'cancel': continue - origin = move_line.picking_id.name or '' - if move_line.picking_id.origin: - origin += ':' + move_line.picking_id.origin - if group: - name = (picking.name or '') + '-' + move_line.name - else: - name = move_line.name - - if inv_type in ('out_invoice', 'out_refund'): - account_id = move_line.product_id.product_tmpl_id.\ - property_account_income.id - if not account_id: - account_id = move_line.product_id.categ_id.\ - property_account_income_categ.id - else: - account_id = move_line.product_id.product_tmpl_id.\ - property_account_expense.id - if not account_id: - account_id = move_line.product_id.categ_id.\ - property_account_expense_categ.id - - price_unit = self._get_price_unit_invoice(cr, uid, - move_line, inv_type) - discount = self._get_discount_invoice(cr, uid, move_line) - tax_ids = self._get_taxes_invoice(cr, uid, move_line, inv_type) - account_analytic_id = self._get_account_analytic_invoice(cr, uid, picking, move_line) - - #set UoS if it's a sale and the picking doesn't have one - uos_id = move_line.product_uos and move_line.product_uos.id or False - if not uos_id and inv_type in ('out_invoice', 'out_refund'): - uos_id = move_line.product_uom.id - - account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, partner.property_account_position, account_id) - invoice_line_id = invoice_line_obj.create(cr, uid, { - 'name': name, - 'origin': origin, - 'invoice_id': invoice_id, - 'uos_id': uos_id, - 'product_id': move_line.product_id.id, - 'account_id': account_id, - 'price_unit': price_unit, - 'discount': discount, - 'quantity': move_line.product_uos_qty or move_line.product_qty, - 'invoice_line_tax_id': [(6, 0, tax_ids)], - 'account_analytic_id': account_analytic_id, - }, context=context) + print "invoice_vals=", invoice_vals + invoice_line_id = invoice_line_obj.create(cr, uid, + self._prepare_invoice_line(cr, uid, group, picking, move_line, + invoice_id, invoice_vals, context=context), + context=context) self._invoice_line_hook(cr, uid, move_line, invoice_line_id) invoice_obj.button_compute(cr, uid, [invoice_id], context=context, From 299026589d9e9e8574f5ebcfed79a605c4a1f59f Mon Sep 17 00:00:00 2001 From: Numerigraphe - Lionel Sausin Date: Mon, 16 Jan 2012 16:37:35 +0100 Subject: [PATCH 050/373] [FIX] l10n_fr: incorrect name for chart of accounts template bzr revid: ls@numerigraphe.fr-20120116153735-htsceg2a8fpu3r5b --- addons/l10n_fr/fr_pcg_taxes_demo.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/l10n_fr/fr_pcg_taxes_demo.xml b/addons/l10n_fr/fr_pcg_taxes_demo.xml index 54a8d2d7444..de078b4a82a 100644 --- a/addons/l10n_fr/fr_pcg_taxes_demo.xml +++ b/addons/l10n_fr/fr_pcg_taxes_demo.xml @@ -358,7 +358,7 @@ - France PCMN + Plan Comptable Général (France) From 5c3df6b9cd7e64db6934af82de6a61cf06d2bcaf Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Tue, 17 Jan 2012 12:58:41 +0530 Subject: [PATCH 051/373] [FIX] Account_analytic_default_view.xml: correct the help string on company button lp bug: https://launchpad.net/bugs/916187 fixed bzr revid: jap@tinyerp.com-20120117072841-0ifxcf6hfyisz94x --- .../account_analytic_default/account_analytic_default_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_analytic_default/account_analytic_default_view.xml b/addons/account_analytic_default/account_analytic_default_view.xml index 753765019f6..d3d8a8c2022 100644 --- a/addons/account_analytic_default/account_analytic_default_view.xml +++ b/addons/account_analytic_default/account_analytic_default_view.xml @@ -61,7 +61,7 @@ - + From 5f4c443a02c572f3255c5c730e79afe2c3ba4c55 Mon Sep 17 00:00:00 2001 From: "ksa (OpenERP)" Date: Tue, 17 Jan 2012 14:10:38 +0530 Subject: [PATCH 052/373] [FIX]:mrp unclear text lp bug: https://launchpad.net/bugs/916539 fixed bzr revid: ksa@tinyerp.com-20120117084038-r65jh2j7dcnrion1 --- addons/mrp_operations/mrp_operations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/mrp_operations/mrp_operations.py b/addons/mrp_operations/mrp_operations.py index 12e30ca9b0b..e8e83cef7ff 100644 --- a/addons/mrp_operations/mrp_operations.py +++ b/addons/mrp_operations/mrp_operations.py @@ -97,7 +97,7 @@ class mrp_production_workcenter_line(osv.osv): 'date_planned_end': fields.function(_get_date_end, string='End Date', type='datetime'), 'date_start': fields.datetime('Start Date'), 'date_finished': fields.datetime('End Date'), - 'delay': fields.float('Working Hours',help="This is lead time between operation start and stop in this Work Center",readonly=True), + 'delay': fields.float('Working Hours',help="This is delay time between operation start and stop in this Work Center",readonly=True), 'production_state':fields.related('production_id','state', type='selection', selection=[('draft','Draft'),('picking_except', 'Picking Exception'),('confirmed','Waiting Goods'),('ready','Ready to Produce'),('in_production','In Production'),('cancel','Canceled'),('done','Done')], From 31db4ea87c2c250f28bc92eb715a4711f4ac8445 Mon Sep 17 00:00:00 2001 From: "ksa (OpenERP)" Date: Tue, 17 Jan 2012 15:38:36 +0530 Subject: [PATCH 053/373] [FIX]:string correction for purchase lp bug: https://launchpad.net/bugs/916485 fixed bzr revid: ksa@tinyerp.com-20120117100836-38ecauwmtgtu2kdv --- addons/purchase/wizard/purchase_installer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/wizard/purchase_installer.py b/addons/purchase/wizard/purchase_installer.py index a96d07f6caf..74b557b9b35 100644 --- a/addons/purchase/wizard/purchase_installer.py +++ b/addons/purchase/wizard/purchase_installer.py @@ -28,7 +28,7 @@ class purchase_config_wizard(osv.osv_memory): 'default_method' : fields.selection( [('manual', 'Based on Purchase Order Lines'), ('picking', 'Based on Receptions'), - ('order', 'Pre-Generate Draft Invoices on Based Purchase Orders'), + ('order', 'Pre-Generate Draft Invoices Based on Purchase Orders'), ], 'Default Invoicing Control Method', required=True, ) } From 04c98a8a9986a7541ec845a10454d5c88db1721e Mon Sep 17 00:00:00 2001 From: Vishal Parmar Date: Tue, 17 Jan 2012 16:21:16 +0530 Subject: [PATCH 054/373] [FIX] email_template: set colspan lp bug: https://launchpad.net/bugs/917516 fixed bzr revid: kjo@tinyerp.com-20120117105116-yc8eo5ij0d2owo1v --- addons/email_template/email_template_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/email_template/email_template_view.xml b/addons/email_template/email_template_view.xml index 1f3b9aef949..3d56f4e6601 100644 --- a/addons/email_template/email_template_view.xml +++ b/addons/email_template/email_template_view.xml @@ -24,7 +24,7 @@ - + @@ -79,7 +79,7 @@ - + From 79ceef507d380831ab6ca1d555bf08100ab13140 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 17 Jan 2012 16:35:50 +0530 Subject: [PATCH 055/373] [FIX]delivery:added a normal price field in demo data and set a variable lp bug: https://launchpad.net/bugs/915404 fixed bzr revid: mma@tinyerp.com-20120117110550-u8g36mguxeh53fgg --- addons/delivery/delivery.py | 4 ++-- addons/delivery/delivery_demo.xml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 4b1d588a53e..2ee0544c82e 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -124,9 +124,8 @@ class delivery_carrier(osv.osv): grid_line_pool.unlink(cr, uid, lines, context=context) #create the grid lines - line_data = None if record.free_if_more_than: - line_data = { + data = { 'grid_id': grid_id and grid_id[0], 'name': _('Free if more than %.2f') % record.amount, 'type': 'price', @@ -135,6 +134,7 @@ class delivery_carrier(osv.osv): 'standard_price': 0.0, 'list_price': 0.0, } + grid_line_pool.create(cr, uid, data, context=context) if record.normal_price: line_data = { 'grid_id': grid_id and grid_id[0], diff --git a/addons/delivery/delivery_demo.xml b/addons/delivery/delivery_demo.xml index acc17e20eae..427f943890b 100644 --- a/addons/delivery/delivery_demo.xml +++ b/addons/delivery/delivery_demo.xml @@ -31,6 +31,7 @@ Free delivery charges + 10 True 1000 From 45d3b74350743bcaa8ba0a2dd148d741b599ef75 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 17 Jan 2012 16:43:33 +0530 Subject: [PATCH 056/373] [FIX]delivery:remove a if line bzr revid: mma@tinyerp.com-20120117111333-eogxcf539s3rb4o2 --- addons/delivery/delivery.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/delivery/delivery.py b/addons/delivery/delivery.py index 2ee0544c82e..19913ac6837 100644 --- a/addons/delivery/delivery.py +++ b/addons/delivery/delivery.py @@ -145,7 +145,6 @@ class delivery_carrier(osv.osv): 'standard_price': record.normal_price, 'list_price': record.normal_price, } - if line_data: grid_line_pool.create(cr, uid, line_data, context=context) return True From 3635ade2e4cb00972c95f21305cfd9e4e67663e0 Mon Sep 17 00:00:00 2001 From: "Mayur Maheshwari (OpenERP)" Date: Tue, 17 Jan 2012 17:35:31 +0530 Subject: [PATCH 057/373] [FIX]procurement: added read method instead of browse method lp bug: https://launchpad.net/bugs/915404 fixed bzr revid: mma@tinyerp.com-20120117120531-xg0acpsb4vt3gwe3 --- addons/procurement/schedulers.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py index 6ad04bb6759..0c6731c40c2 100644 --- a/addons/procurement/schedulers.py +++ b/addons/procurement/schedulers.py @@ -180,10 +180,11 @@ class procurement_order(osv.osv): for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids, context=context): context['warehouse'] = warehouse - for product in product_obj.browse(cr, uid, products_id, context=context): - if product.virtual_available >= 0.0: + for product_availability in product_obj.read(cr, uid, products_id, ['virtual_available'], context=context): + if product_availability['virtual_available'] >= 0.0: continue + product = product_obj.browse(cr, uid, [product_availability['id']], context=context)[0] if product.supply_method == 'buy': location_id = warehouse.lot_input_id.id elif product.supply_method == 'produce': From f554ff10861c061aaafa5854b5188aca3f68c995 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulius=20Sladkevi=C4=8Dius?= Date: Tue, 17 Jan 2012 18:43:18 +0200 Subject: [PATCH 058/373] [FIX] account_asset, _compute_entries method depreciation line search bzr revid: paulius@inovera.lt-20120117164318-oqko4wba68577hpz --- addons/account_asset/account_asset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_asset/account_asset.py b/addons/account_asset/account_asset.py index 0b6f5b7feac..97aec1d8487 100644 --- a/addons/account_asset/account_asset.py +++ b/addons/account_asset/account_asset.py @@ -309,7 +309,7 @@ class account_asset_asset(osv.osv): period_obj = self.pool.get('account.period') depreciation_obj = self.pool.get('account.asset.depreciation.line') period = period_obj.browse(cr, uid, period_id, context=context) - depreciation_ids = depreciation_obj.search(cr, uid, [('asset_id', 'in', ids), ('depreciation_date', '<', period.date_stop), ('depreciation_date', '>', period.date_start), ('move_check', '=', False)], context=context) + depreciation_ids = depreciation_obj.search(cr, uid, [('asset_id', 'in', ids), ('depreciation_date', '<=', period.date_stop), ('depreciation_date', '>=', period.date_start), ('move_check', '=', False)], context=context) return depreciation_obj.create_move(cr, uid, depreciation_ids, context=context) def create(self, cr, uid, vals, context=None): From 61c3841ed72f765d0d723620fb9579af91484438 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Tue, 17 Jan 2012 18:21:53 +0100 Subject: [PATCH 059/373] [MRG] from c2c swiss localization bzr revid: yannick.vaucher@camptocamp.com-20120117172153-elginy094q5rvt7s --- addons/l10n_ch/bank.py | 45 ++++++++++++- addons/l10n_ch/demo/demo.xml | 2 +- addons/l10n_ch/demo/dta_demo.xml | 2 +- addons/l10n_ch/report/report_webkit_html.py | 22 +++--- addons/l10n_ch/wizard/bvr_import.py | 5 +- addons/l10n_ch/wizard/create_dta.py | 74 +++++++++++++++++---- addons/l10n_ch/wizard/create_dta_view.xml | 4 +- 7 files changed, 120 insertions(+), 34 deletions(-) diff --git a/addons/l10n_ch/bank.py b/addons/l10n_ch/bank.py index fd69dec625f..ac57eca8903 100644 --- a/addons/l10n_ch/bank.py +++ b/addons/l10n_ch/bank.py @@ -21,6 +21,7 @@ from tools.translate import _ from osv import fields, osv +import re class Bank(osv.osv): """Inherit res.bank class in order to add swiss specific field""" @@ -42,8 +43,8 @@ class ResPartnerBank(osv.osv): _columns = { 'name': fields.char('Description', size=128, required=True), - 'post_number': fields.char('Post number', size=64), - 'bvr_adherent_num': fields.char('BVR adherent number', size=11), + 'post_number': fields.char('Post number', size=64, help="Postal number 0x-xxxxxx-x or xxxxx"), + 'bvr_adherent_num': fields.char('Bank BVR adherent number', size=11, help="Your Bank adherent number to be printed in references of your BVR. This is not a postal account number."), 'dta_code': fields.char('DTA code', size=5), 'print_bank': fields.boolean('Print Bank on BVR'), 'print_account': fields.boolean('Print Account Number on BVR'), @@ -69,10 +70,48 @@ class ResPartnerBank(osv.osv): def _prepare_name(self, bank): "Hook to get bank number of bank account" res = super(ResPartnerBank, self)._prepare_name(bank) + res = res or u'' if bank.post_number: - res = u"%s - %s" % (res, bank.post_number) + if res: + res = u"%s - %s" % (res, bank.post_number) + else: + res = bank.post_number return res + def _check_9_pos_postal_num(self, number): + """ + check if a postal number in format xx-xxxxxx-x is correct, + return true if it matches the pattern + and if check sum mod10 is ok + """ + from tools import mod10r + pattern = r'^[0-9]{2}-[0-9]{1,6}-[0-9]$' + if not re.search(pattern, number): + return False + num, checksum = (number.replace('-','')[:-1], number[-1:]) + return mod10r(num)[-1:] == checksum + + + def _check_5_pos_postal_num(self, number): + """ + check if a postal number on 5 positions is correct + """ + pattern = r'^[0-9]{1,5}$' + if not re.search(pattern, number): + return False + return True + + def _check_postal_num(self, cursor, uid, ids): + banks = self.browse(cursor, uid, ids) + for b in banks: + return self._check_9_pos_postal_num(b.post_number) or \ + self._check_5_pos_postal_num(b.post_number) + + + _constraints = [(_check_postal_num, + 'Please enter a correct postal number. (01-23456-5 or 12345)', + ['post_number'])] + _sql_constraints = [('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !')] diff --git a/addons/l10n_ch/demo/demo.xml b/addons/l10n_ch/demo/demo.xml index fbe09024966..f13546150b3 100644 --- a/addons/l10n_ch/demo/demo.xml +++ b/addons/l10n_ch/demo/demo.xml @@ -11,7 +11,7 @@ 11-1234-1 bvrbank - 11-1234-1 + 70-004152-8 0000000 diff --git a/addons/l10n_ch/demo/dta_demo.xml b/addons/l10n_ch/demo/dta_demo.xml index cdddb0d7a74..4f44ad21cc0 100644 --- a/addons/l10n_ch/demo/dta_demo.xml +++ b/addons/l10n_ch/demo/dta_demo.xml @@ -12,7 +12,7 @@ 123456 bvrbank - 234567 + 01-23456-5 diff --git a/addons/l10n_ch/report/report_webkit_html.py b/addons/l10n_ch/report/report_webkit_html.py index 8b179e7ae58..e6f7239c4e4 100644 --- a/addons/l10n_ch/report/report_webkit_html.py +++ b/addons/l10n_ch/report/report_webkit_html.py @@ -124,28 +124,24 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): invoice_obj = pool.get('account.invoice') ids = invoice_ids for invoice in invoice_obj.browse(cursor, self.uid, ids): + invoice_name = "%s %s" %(invoice.name, invoice.number) if not invoice.partner_bank_id: raise except_osv(_('UserError'), - _('No bank specified on invoice:\n' + \ - invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1])) + _('No bank specified on invoice:\n%s' %(invoice_name))) if not self._compile_check_bvr.match( invoice.partner_bank_id.post_number or ''): raise except_osv(_('UserError'), - _('Your bank BVR number should be of the form 0X-XXX-X! ' + - 'Please check your company ' + - 'information for the invoice:\n' + - invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1])) + _(('Your bank BVR number should be of the form 0X-XXX-X! ' + 'Please check your company ' + 'information for the invoice:\n%s') + %(invoice_name))) if invoice.partner_bank_id.bvr_adherent_num \ and not self._compile_check_bvr_add_num.match( invoice.partner_bank_id.bvr_adherent_num): raise except_osv(_('UserError'), - _('Your bank BVR adherent number must contain exactly seven' + - 'digits!\nPlease check your company ' + - 'information for the invoice:\n' + - invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1])) + _(('Your bank BVR adherent number must contain only ' + 'digits!\nPlease check your company ' + 'information for the invoice:\n%s') %(invoice_name))) return '' class BVRWebKitParser(webkit_report.WebKitParser): diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py index e98053513cd..e5c5b7e5053 100644 --- a/addons/l10n_ch/wizard/bvr_import.py +++ b/addons/l10n_ch/wizard/bvr_import.py @@ -71,6 +71,9 @@ def _import(self, cursor, user, data, context=None): statement_obj = self.pool.get('account.bank.statement') property_obj = self.pool.get('ir.property') file = data['form']['file'] + if not file: + raise osv.except_osv(_('UserError'), + _('Please select a file first!')) statement_id = data['id'] records = [] total_amount = 0 @@ -239,7 +242,7 @@ def _import(self, cursor, user, data, context=None): class bvr_import_wizard(osv.osv_memory): _name = 'bvr.import.wizard' _columns = { - 'file':fields.binary('BVR File', readonly=True) + 'file':fields.binary('BVR File') } def import_bvr(self, cr, uid, ids, context=None): diff --git a/addons/l10n_ch/wizard/create_dta.py b/addons/l10n_ch/wizard/create_dta.py index 7abb1d7ca7c..e9b0585d4c8 100644 --- a/addons/l10n_ch/wizard/create_dta.py +++ b/addons/l10n_ch/wizard/create_dta.py @@ -28,6 +28,8 @@ import pooler from tools.translate import _ import unicode2ascii +import re + TRANS=[ (u'é','e'), (u'è','e'), @@ -346,6 +348,14 @@ def c_ljust(s, size): s = s.decode('utf-8').encode('latin1','replace').ljust(size) return s +def _is_9_pos_bvr_adherent(adherent_num): + """ + from a bvr adherent number, + return true if + """ + pattern = r'[0-9]{2}-[0-9]{1,6}-[0-9]' + return re.search(pattern, adherent_num) + def _create_dta(obj, cr, uid, data, context=None): v = {} v['uid'] = str(uid) @@ -435,10 +445,24 @@ def _create_dta(obj, cr, uid, data, context=None): or False v['partner_bvr'] = pline.bank_id.post_number or '' if v['partner_bvr']: - v['partner_bvr'] = v['partner_bvr'].replace('-','') - if len(v['partner_bvr']) < 9: - v['partner_bvr'] = v['partner_bvr'][:2] + '0' * \ - (9 - len(v['partner_bvr'])) + v['partner_bvr'][2:] + is_9_pos_adherent = None + # if adherent bvr number is a 9 pos number + # add 0 to fill 2nd part plus remove '-' + # exemple: 12-567-C becomes 12000567C + if _is_9_pos_bvr_adherent(v['partner_bvr']): + parts = v['partner_bvr'].split('-') + parts[1] = parts[1].rjust(6, '0') + v['partner_bvr'] = ''.join(parts) + is_9_pos_adherent = True + # add 4*0 to bvr adherent number with 5 pos + # exemple: 12345 becomes 000012345 + elif len(v['partner_bvr']) == 5: + v['partner_bvr'] = v['partner_bvr'].rjust(9, '0') + is_9_pos_adherent = False + else: + raise osv.except_osv(_('Error'), + _('Wrong postal number format.\n' + 'It must be 12-123456-9 or 12345 format')) if pline.bank_id.bank: v['partner_bank_city'] = pline.bank_id.bank.city or False @@ -518,15 +542,39 @@ def _create_dta(obj, cr, uid, data, context=None): elif elec_pay == 'bvrbank' or elec_pay == 'bvrpost': from tools import mod10r - if v['reference']: - v['reference'] = v['reference'].replace(' ', - '').rjust(27).replace(' ', '0') - if not v['reference'] \ - or (mod10r(v['reference'][:-1]) != v['reference'] and \ - not len(v['reference']) == 15): - raise osv.except_osv(_('Error'), _('You must provide ' \ - 'a valid BVR reference number \n' \ - 'for the line: %s') % pline.name) + if not v['reference']: + raise osv.except_osv(_('Error'), + _('You must provide ' \ + 'a BVR reference number \n' \ + 'for the line: %s') % pline.name) + v['reference'] = v['reference'].replace(' ', '') + if is_9_pos_adherent: + if len(v['reference']) > 27: + raise osv.except_osv(_('Error'), + _('BVR reference number is not valid \n' + 'for the line: %s. \n' + 'Reference is too long.') % pline.name) + # do a mod10 check + if mod10r(v['reference'][:-1]) != v['reference']: + raise osv.except_osv(_('Error'), + _('BVR reference number is not valid \n' + 'for the line: %s. \n' + 'Mod10 check failed') % pline.name) + # fill reference with 0 + v['reference'] = v['reference'].rjust(27, '0') + else: + # reference of BVR adherent with 5 positions number + # have 15 positions references + if len(v['reference']) > 15: + raise osv.except_osv(_('Error'), + _('BVR reference number is not valid \n' + 'for the line: %s. \n' + 'Reference is too long ' + 'for this type of beneficiary.') % pline.name) + # complete 15 first digit with 0 on left and complete 27 digits with trailing spaces + # exemple: 123456 becomes 00000000012345____________ + v['reference'] = v['reference'].rjust(15, '0').ljust(27, ' ') + if not v['partner_bvr']: raise osv.except_osv(_('Error'), _('You must provide a BVR number\n' 'for the bank account: %s' \ diff --git a/addons/l10n_ch/wizard/create_dta_view.xml b/addons/l10n_ch/wizard/create_dta_view.xml index 11cd2095e28..df0544aa0b7 100644 --- a/addons/l10n_ch/wizard/create_dta_view.xml +++ b/addons/l10n_ch/wizard/create_dta_view.xml @@ -8,8 +8,7 @@ form - - +