From 255eea5655a7d2c75bd3642903d4a804f472f59f Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sun, 17 Oct 2010 18:42:26 +0200 Subject: [PATCH] fix bzr revid: fp@tinyerp.com-20101017164226-dg8yx79q0c7yrvbr --- addons/account/account.py | 8 ++++ addons/account/account_view.xml | 33 +++++++------- addons/account/data/account_data2.xml | 5 +++ addons/account/invoice.py | 6 ++- addons/hr_timesheet/hr_timesheet_data.xml | 5 +++ .../hr_timesheet_invoice.py | 4 +- .../hr_timesheet_invoice_data.xml | 10 +++++ addons/profile_tools/installer.py | 3 +- addons/profile_tools/misc_tools_installer.xml | 1 + addons/project/installer.py | 5 --- addons/project_timesheet/project_timesheet.py | 20 +++++++-- .../project_timesheet_view.xml | 6 +-- addons/sale/sale_view.xml | 43 +++++++++++-------- addons/sale/stock_view.xml | 2 +- .../sale/wizard/sale_make_invoice_advance.py | 8 ++-- .../sale/wizard/sale_make_invoice_advance.xml | 2 +- 16 files changed, 105 insertions(+), 56 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index bdd6b37b988..5794c59ffdc 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -2544,9 +2544,17 @@ class wizard_multi_charts_accounts(osv.osv_memory): if ids: return ids[0] return False + + def _get_default_accounts(self, cr, uid, context=None): + accounts = [{'acc_name':'Current','account_type':'bank'}, + {'acc_name':'Deposit','account_type':'bank'}, + {'acc_name':'Cash','account_type':'cash'}] + return accounts + _defaults = { 'company_id': lambda self, cr, uid, c: self.pool.get('res.users').browse(cr, uid, [uid], c)[0].company_id.id, 'chart_template_id': _get_chart, + 'bank_accounts_id': _get_default_accounts, 'code_digits': 6, 'seq_journal': True } diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index cc44e4563d8..8217522715e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -2413,23 +2413,22 @@ - - - - - -
- - - - - - - - - - + + + + + +
+ + + + + + + + + +
diff --git a/addons/account/data/account_data2.xml b/addons/account/data/account_data2.xml index 8cd2071f70e..38bdd4b2b2c 100644 --- a/addons/account/data/account_data2.xml +++ b/addons/account/data/account_data2.xml @@ -2,6 +2,11 @@ + + Sales + sale + + diff --git a/addons/account/invoice.py b/addons/account/invoice.py index a39e259681e..4b308c06418 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -677,7 +677,7 @@ class account_invoice(osv.osv): return (ref or '').replace('/','') def _get_analytic_lines(self, cr, uid, id): - inv = self.browse(cr, uid, [id])[0] + inv = self.browse(cr, uid, id) cur_obj = self.pool.get('res.currency') company_currency = inv.company_id.currency_id.id @@ -693,6 +693,8 @@ class account_invoice(osv.osv): ref = inv.reference else: ref = self._convert_ref(cr, uid, inv.number) + if not inv.journal_id.analytic_journal_id: + raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (inv.journal_id.name,)) il['analytic_lines'] = [(0,0, { 'name': il['name'], 'date': inv['date_invoice'], @@ -702,7 +704,7 @@ class account_invoice(osv.osv): 'product_id': il['product_id'], 'product_uom_id': il['uos_id'], 'general_account_id': il['account_id'], - 'journal_id': self._get_journal_analytic(cr, uid, inv.type), + 'journal_id': inv.journal_id.analytic_journal_id.id, 'ref': ref, })] return iml diff --git a/addons/hr_timesheet/hr_timesheet_data.xml b/addons/hr_timesheet/hr_timesheet_data.xml index e7cb3d5e0d4..a19b2c67291 100644 --- a/addons/hr_timesheet/hr_timesheet_data.xml +++ b/addons/hr_timesheet/hr_timesheet_data.xml @@ -18,5 +18,10 @@ + + + + + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index f605fd760be..8dd25ef1eb3 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -27,8 +27,8 @@ class hr_timesheet_invoice_factor(osv.osv): _name = "hr_timesheet_invoice.factor" _description = "Invoice Rate" _columns = { - 'name': fields.char('Internal name', size=128, required=True), - 'customer_name': fields.char('Name', size=128, help="Name of the customer"), + 'name': fields.char('Internal name', size=128, required=True, translate=True), + 'customer_name': fields.char('Name', size=128, help="Label for the customer"), 'factor': fields.float('Discount (%)', required=True, help="Discount in percentage"), } _defaults = { diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml index a81af0788b6..462888e0b39 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_data.xml @@ -6,5 +6,15 @@ 100% 0.0 + + 90% + 90% + 10.0 + + + 50% + 50% + 50.0 + diff --git a/addons/profile_tools/installer.py b/addons/profile_tools/installer.py index 54fd0602802..6ea024aebbe 100644 --- a/addons/profile_tools/installer.py +++ b/addons/profile_tools/installer.py @@ -29,9 +29,10 @@ class misc_tools_installer(osv.osv_memory): 'subscription':fields.boolean('Recurring Documents',help='Helps to generate automatically recurring documents.'), 'survey':fields.boolean('Survey',help='Allows you to organize surveys.'), 'idea':fields.boolean('Ideas Box',help='Promote ideas of the employees, votes and discussion on best ideas.'), + 'share':fields.boolean('Share Data / Portals',help='This module allows you to easily give restricted access of any filtered list of objects to any customer or supplier.' \ + 'Just click on the share icon to give access to your customers on their project\'s tasks, support requests, invoices, etc.'), } _defaults = { - 'lunch': True, } misc_tools_installer() diff --git a/addons/profile_tools/misc_tools_installer.xml b/addons/profile_tools/misc_tools_installer.xml index b59f95ab908..d81936756a6 100644 --- a/addons/profile_tools/misc_tools_installer.xml +++ b/addons/profile_tools/misc_tools_installer.xml @@ -25,6 +25,7 @@ Configure + diff --git a/addons/project/installer.py b/addons/project/installer.py index 7a147737768..693e2d58018 100644 --- a/addons/project/installer.py +++ b/addons/project/installer.py @@ -47,11 +47,6 @@ class project_installer(osv.osv_memory): 'project_gtd': fields.boolean('Getting Things Done', help="GTD is a methodology to efficiently organise yourself and your tasks. This module fully integrates GTD principle with OpenERP's project management."), } - - _defaults={ - 'project_issue': True, - } - project_installer() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_timesheet/project_timesheet.py b/addons/project_timesheet/project_timesheet.py index f5480793adc..8d846f919e7 100644 --- a/addons/project_timesheet/project_timesheet.py +++ b/addons/project_timesheet/project_timesheet.py @@ -26,6 +26,20 @@ import pooler import tools from tools.translate import _ +class project_project(osv.osv): + _inherit = 'project.project' + def onchange_partner_id(self, cr, uid, ids, part=False, context=None): + result = super(project_project, self).onchange_partner_id(cr, uid, ids, part, context) + if result.get('value', False): + try: + d = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr_timesheet_invoice', 'timesheet_invoice_factor1') + if d: + result['value']['to_invoice'] = d[1] + except ValueError, e: + pass + return result +project_project() + class project_work(osv.osv): _inherit = "project.task.work" @@ -145,13 +159,13 @@ class project_work(osv.osv): # Compute based on pricetype amount_unit = timesheet_obj.on_change_unit_amount(cr, uid, line_id.id, - prod_id=prod_id, - quantity=vals_line['unit_amount'], unit=False, context=context) + prod_id=prod_id, company_id=False, + unit_amount=vals_line['unit_amount'], unit=False, context=context) if amount_unit and 'amount' in amount_unit.get('value',{}): vals_line['amount'] = amount_unit['value']['amount'] - obj.write(cr, uid, [line_id.id], vals_line, context=context) + self.pool.get('hr.analytic.timesheet').write(cr, uid, [line_id.id], vals_line, context=context) return super(project_work,self).write(cr, uid, ids, vals, context) diff --git a/addons/project_timesheet/project_timesheet_view.xml b/addons/project_timesheet/project_timesheet_view.xml index 05be6d5466e..c0dcd3a46bc 100644 --- a/addons/project_timesheet/project_timesheet_view.xml +++ b/addons/project_timesheet/project_timesheet_view.xml @@ -27,14 +27,14 @@ - + - - diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index e5357ee0e04..36ba5e62d81 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -198,7 +198,8 @@