From 5c07939320a2d5096d99038728fdba7bf77512e6 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Fri, 2 Jul 2010 15:45:52 +0530 Subject: [PATCH 1/7] [Add]: Task-897 [audaxis] tax linked to country warning if address diff bzr revid: sbh@tinyerp.com-20100702101552-u45m5hven8mcu1mn --- addons/account_tax_country/__init__.py | 25 +++++++++ addons/account_tax_country/__openerp__.py | 42 ++++++++++++++ .../account_tax_country.py | 56 +++++++++++++++++++ .../account_tax_country.xml | 22 ++++++++ 4 files changed, 145 insertions(+) create mode 100644 addons/account_tax_country/__init__.py create mode 100644 addons/account_tax_country/__openerp__.py create mode 100644 addons/account_tax_country/account_tax_country.py create mode 100644 addons/account_tax_country/account_tax_country.xml diff --git a/addons/account_tax_country/__init__.py b/addons/account_tax_country/__init__.py new file mode 100644 index 00000000000..5b71912151a --- /dev/null +++ b/addons/account_tax_country/__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 account_tax_country + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/account_tax_country/__openerp__.py b/addons/account_tax_country/__openerp__.py new file mode 100644 index 00000000000..e7e127127e7 --- /dev/null +++ b/addons/account_tax_country/__openerp__.py @@ -0,0 +1,42 @@ +# -*- 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" : "Accounting and Financial Management", + "version" : "1.1", + "depends" : ["account"], + "author" : "Tiny", + "category": 'Generic Modules/Accounting', + "description": """Taxes to countries + """, + 'website': 'http://www.openerp.com', + 'init_xml': [], + 'update_xml': [ + "account_tax_country.xml" + ], + 'demo_xml': [ + + ], + 'installable': True, + 'active': False, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/account_tax_country/account_tax_country.py b/addons/account_tax_country/account_tax_country.py new file mode 100644 index 00000000000..6d1f7b1d753 --- /dev/null +++ b/addons/account_tax_country/account_tax_country.py @@ -0,0 +1,56 @@ +# -*- 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 +import netsvc +from osv import fields, osv + +from tools.misc import currency +from tools.translate import _ +class account_tax(osv.osv): + _inherit='account.tax' + _columns = { + 'country_id':fields.many2many('res.country','country_invoice_line_tax','invoice_line_id','tax_id',string='Country'), + } +account_tax() +class account_invoice(osv.osv): + _inherit='account.invoice' + + def _checkreset_taxes(self, cr, uid, ids, context=None): + + for invoice in self.browse(cr,uid,ids): + flag=False + country_id = invoice.address_invoice_id.country_id.id + for i in invoice.invoice_line: + tax_ids=i.invoice_line_tax_id + for tax in tax_ids: + for country in tax.country_id: + if country_id!=country.id: + flag=True + if flag: + raise osv.except_osv(_('Error!'), _('Find a valid Tax of country !')) + return True + _constraints = [ + (_checkreset_taxes, 'Unable to find a valid country in Tax', ['invoice_line']) + ] + + +account_invoice() diff --git a/addons/account_tax_country/account_tax_country.xml b/addons/account_tax_country/account_tax_country.xml new file mode 100644 index 00000000000..341e8db0239 --- /dev/null +++ b/addons/account_tax_country/account_tax_country.xml @@ -0,0 +1,22 @@ + + + + + + + account.tax.country.form + account.tax + form + + + + + + + + + + + + + \ No newline at end of file From 110799550501d58720a27ad29407bc27870e0ba9 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 8 Jul 2010 16:46:44 +0530 Subject: [PATCH 2/7] [IMP] procument,project_mrp: Add the comment in process file and add the task_id in procument bzr revid: sbh@tinyerp.com-20100708111644-iqxoddxs54xk5gtg --- addons/procurement/process/procurement_process.xml | 7 +------ addons/product/product_view.xml | 6 +++--- addons/project_mrp/__openerp__.py | 1 + addons/project_mrp/mrp.py | 5 ++++- addons/stock/product_view.xml | 6 +++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/addons/procurement/process/procurement_process.xml b/addons/procurement/process/procurement_process.xml index e5b94bb225d..e12c97b2070 100644 --- a/addons/procurement/process/procurement_process.xml +++ b/addons/procurement/process/procurement_process.xml @@ -3,7 +3,7 @@ @@ -11,11 +11,6 @@ - - - diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index b5f48efd90a..e58987cf2c8 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -127,9 +127,9 @@ - - - + + + diff --git a/addons/project_mrp/__openerp__.py b/addons/project_mrp/__openerp__.py index a51a95c5d16..2ac983e67e4 100644 --- a/addons/project_mrp/__openerp__.py +++ b/addons/project_mrp/__openerp__.py @@ -51,6 +51,7 @@ automatically created via sale orders. 'init_xml': [], 'update_xml': ['project_mrp_workflow.xml', #'process/project_mrp_process.xml', + 'project_mrp_view.xml' ], 'demo_xml': [], 'test': ['test/project_task_procurement.yml'], diff --git a/addons/project_mrp/mrp.py b/addons/project_mrp/mrp.py index dc5d52e241d..a45601e6245 100644 --- a/addons/project_mrp/mrp.py +++ b/addons/project_mrp/mrp.py @@ -26,6 +26,9 @@ import tools class procurement_order(osv.osv): _name = "procurement.order" _inherit = "procurement.order" + _columns = { + 'task_id': fields.many2one('project.task', 'Task') + } def action_produce_assign_service(self, cr, uid, ids, context=None): if context is None: @@ -93,7 +96,7 @@ class procurement_order(osv.osv): 'company_id': procurement.company_id.id, 'project_id': project_id, },context=context) - + self.write(cr,uid,ids,{'task_id':task_id}) return task_id procurement_order() diff --git a/addons/stock/product_view.xml b/addons/stock/product_view.xml index 1d8db4f0228..01214bad6a4 100644 --- a/addons/stock/product_view.xml +++ b/addons/stock/product_view.xml @@ -116,9 +116,9 @@ - - - + + + From e1f0e06084ae19a3b3df01efaa33560d9ccb08e3 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 8 Jul 2010 17:16:52 +0530 Subject: [PATCH 3/7] [ADD] proejct_mrp: Add user_id and project_id in product bzr revid: sbh@tinyerp.com-20100708114652-h1d2o8h4oiu9gvlu --- addons/project_mrp/project_mrp.py | 8 +++++++ addons/project_mrp/project_mrp_view.xml | 30 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 addons/project_mrp/project_mrp_view.xml diff --git a/addons/project_mrp/project_mrp.py b/addons/project_mrp/project_mrp.py index 09820d44c71..d946e2c2fd6 100644 --- a/addons/project_mrp/project_mrp.py +++ b/addons/project_mrp/project_mrp.py @@ -48,5 +48,13 @@ class project_task(osv.osv): return True project_task() +class product_product(osv.osv): + _inherit = "product.product" + _columns = { + 'user_id': fields.many2one('res.users', 'Responsible', ondelete='set null',help='Project Manager'), + 'project_id': fields.many2one('project.project', 'Project', ondelete='set null',) + } +product_product() + # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml new file mode 100644 index 00000000000..dce408f793b --- /dev/null +++ b/addons/project_mrp/project_mrp_view.xml @@ -0,0 +1,30 @@ + + + + + procurement.procurement.form.view.inherit + procurement.order + form + + + + + + + + + + product.form.view.inherit + product.product + form + + + + + + + + + + + \ No newline at end of file From e1becc32a7a5e86ff4918151692559b179970be2 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 8 Jul 2010 17:44:25 +0530 Subject: [PATCH 4/7] [IMP] project_mpr: create task from procurement, it takes that info + the time planned as sum of customer lead and manufcatoring time bzr revid: sbh@tinyerp.com-20100708121425-34l75ebg1j93cqli --- addons/project_mrp/mrp.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/project_mrp/mrp.py b/addons/project_mrp/mrp.py index a45601e6245..eca7b283948 100644 --- a/addons/project_mrp/mrp.py +++ b/addons/project_mrp/mrp.py @@ -72,6 +72,7 @@ class procurement_order(osv.osv): self.write(cr, uid, [procurement.id], {'state': 'running'}) name_task = ('','') + planned_hours=0.0 if procurement.product_id.type == 'service': proc_name = procurement.name if procurement.origin == proc_name: @@ -80,12 +81,12 @@ class procurement_order(osv.osv): name_task = (procurement.origin, proc_name or '') else: name_task = (procurement.product_id.name or procurement.origin, procurement.name or '') - + planned_hours= procurement.product_id.sale_delay +procurement.product_id. produce_delay task_id = self.pool.get('project.task').create(cr, uid, { 'name': '%s:%s' % name_task, 'date_deadline': procurement.date_planned, - 'planned_hours': procurement.product_qty, - 'remaining_hours': procurement.product_qty, + 'planned_hours': planned_hours, + 'remaining_hours': planned_hours, 'user_id': procurement.product_id.product_manager.id, 'notes': "b"+(l and l.order_id.note or ''), 'procurement_id': procurement.id, From 6bd70936d1bbec058bf56039224b1d71f01cbccb Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 26 Aug 2010 12:37:03 +0530 Subject: [PATCH 5/7] [IMP] Project: Improve view of Delegrate wizard , Done wizard:Imroive the view and update the description bzr revid: sbh@tinyerp.com-20100826070703-4sz1lk8lmjlp5e97 --- addons/project/project_view.xml | 2 +- addons/project/wizard/project_close_task.py | 8 +++++++- addons/project/wizard/project_close_task_view.xml | 8 ++++---- addons/project/wizard/project_task_delegate_view.xml | 5 +++-- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 154c2f28935..eaee70c0d5f 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -421,7 +421,7 @@ - + diff --git a/addons/project/wizard/project_close_task.py b/addons/project/wizard/project_close_task.py index eb5589f2e3a..499f09413a4 100644 --- a/addons/project/wizard/project_close_task.py +++ b/addons/project/wizard/project_close_task.py @@ -75,8 +75,14 @@ class project_close_task(osv.osv_memory): } def close(self, cr, uid, ids, context=None): + data=self.read(cr,uid,ids)[0] + description="" + user_name= self.pool.get('res.users').browse(cr, uid, uid).name + description=user_name +" At " + time.strftime('%Y-%m-%d %H:%M:%S') + description+"\n"+"=======================" + description=description+ "\n "+"Closed task:\n"+data['description'] if 'task_id' in context: - self.pool.get('project.task').write(cr, uid, [context['task_id']], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0}) + self.pool.get('project.task').write(cr, uid, [context['task_id']], {'description':description,'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0}) return {} def confirm(self, cr, uid, ids, context=None): diff --git a/addons/project/wizard/project_close_task_view.xml b/addons/project/wizard/project_close_task_view.xml index 37b6646232a..cfe9587525a 100644 --- a/addons/project/wizard/project_close_task_view.xml +++ b/addons/project/wizard/project_close_task_view.xml @@ -8,21 +8,21 @@ form
-