diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 897b8366b7a..3b000e40592 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -366,12 +366,13 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): return period or 0.0 def _get_partners(self,data): + # TODO: deprecated, to remove in trunk if data['form']['result_selection'] == 'customer': - return 'Receivable Accounts' + return self._translate('Receivable Accounts') elif data['form']['result_selection'] == 'supplier': - return 'Payable Accounts' + return self._translate('Payable Accounts') elif data['form']['result_selection'] == 'customer_supplier': - return 'Receivable and Payable Accounts' + return self._translate('Receivable and Payable Accounts') return '' report_sxw.report_sxw('report.account.aged_trial_balance', 'res.partner', diff --git a/addons/account/report/account_aged_partner_balance.rml b/addons/account/report/account_aged_partner_balance.rml index fb79ab0d199..5b5404e9c86 100644 --- a/addons/account/report/account_aged_partner_balance.rml +++ b/addons/account/report/account_aged_partner_balance.rml @@ -147,7 +147,9 @@ [[ data['form']['period_length'] ]] - [[ get_partners(data) ]] + Receivable Accounts[[ data['form']['result_selection'] == 'customer' or removeParentNode('para') ]] + Payable Accounts[[ data['form']['result_selection'] == 'supplier' or removeParentNode('para') ]] + Receivable and Payable Accounts[[ data['form']['result_selection'] == 'customer_supplier' or removeParentNode('para') ]] [[ data['form']['direction_selection'] ]] @@ -166,7 +168,8 @@ Partners - [[ data['form']['direction_selection'] == 'future' and 'Due' or 'Not due' ]] + Due[[ data['form']['direction_selection'] == 'future' and ' ' or removeParentNode('para') ]] + Not due[[ data['form']['direction_selection'] != 'future' and ' ' or removeParentNode('para') ]] [[ data['form']['4']['name'] ]] diff --git a/addons/account/report/account_balance.rml b/addons/account/report/account_balance.rml index 88980a9cd97..6ddfc238bff 100644 --- a/addons/account/report/account_balance.rml +++ b/addons/account/report/account_balance.rml @@ -211,8 +211,10 @@ - [[ data['model']=='account.account' and 'Company'or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] + + Company[[ data['model']=='account.account' and ' ' or removeParentNode('para') ]] + Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]] + Fiscal Year @@ -233,7 +235,11 @@ [[ get_fiscalyear(data) or '' ]] - [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] + + All[[ data['form']['display_account']=='all' and ' ' or removeParentNode('para') ]] + With movements[[ data['form']['display_account']=='movement' and ' ' or removeParentNode('para') ]] + With balance is not equal to 0[[ data['form']['display_account']=='not_zero' and ' ' or removeParentNode('para') ]] + [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] diff --git a/addons/account/report/account_general_journal.rml b/addons/account/report/account_general_journal.rml index 4ad086d6bd4..dce30e59918 100644 --- a/addons/account/report/account_general_journal.rml +++ b/addons/account/report/account_general_journal.rml @@ -220,8 +220,8 @@ - [[ data['model']=='account.journal.period' and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] + Company[[ data['model']=='account.journal.period' and ' ' or removeParentNode('para') ]] + Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]] Fiscal Year Journals Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] diff --git a/addons/account/report/account_general_ledger_landscape.rml b/addons/account/report/account_general_ledger_landscape.rml index 7ae5db98f20..c5d24343148 100644 --- a/addons/account/report/account_general_ledger_landscape.rml +++ b/addons/account/report/account_general_ledger_landscape.rml @@ -360,9 +360,8 @@ - [[ data['model']=='account.account' and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] - + Company[[ data['model']=='account.account' and ' ' or removeParentNode('para') ]] + Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]] Fiscal Year @@ -395,7 +394,9 @@ [[', '.join([ lt or '' for lt in get_journal(data) ]) ]] - [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] + All[[ data['form']['display_account']=='all' and ' ' or removeParentNode('para') ]] + With movements[[ data['form']['display_account']=='movement' and ' ' or removeParentNode('para') ]] + With balance is not equal to 0[[ data['form']['display_account']=='not_zero' and ' ' or removeParentNode('para') ]] [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 769a8335f55..97e19be4b0c 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -189,11 +189,12 @@ class journal_print(report_sxw.rml_parse, common_report_header): return data['form']['amount_currency'] def _get_sortby(self, data): + # TODO: deprecated, to remove in trunk if self.sort_selection == 'date': - return 'Date' + return self._translate('Date') elif self.sort_selection == 'ref': - return 'Reference Number' - return 'Date' + return self._translate('Reference Number') + return self._translate('Date') report_sxw.report_sxw('report.account.journal.period.print', 'account.journal.period', 'addons/account/report/account_journal.rml', parser=journal_print, header='external') report_sxw.report_sxw('report.account.journal.period.print.sale.purchase', 'account.journal.period', 'addons/account/report/account_journal_sale_purchase.rml', parser=journal_print, header='external') diff --git a/addons/account/report/account_journal.rml b/addons/account/report/account_journal.rml index fb203d4e664..6d606ed1937 100644 --- a/addons/account/report/account_journal.rml +++ b/addons/account/report/account_journal.rml @@ -186,8 +186,8 @@ - [[ data['model']=='account.journal.period'and 'Company' or removeParentNode('para') ]] - [[ data['model']=='ir.ui.menu' and 'Chart of Accounts' or removeParentNode('para') ]] + Company[[ data['model']=='account.journal.period'and ' ' or removeParentNode('para') ]] + Chart of Accounts[[ data['model']=='ir.ui.menu' and ' ' or removeParentNode('para') ]] Fiscal Year Journal Period @@ -199,8 +199,10 @@ [[ get_fiscalyear(data) or '' ]] [[ o.journal_id.name ]] [[ o.period_id.name ]] - [[ get_sortby(data) ]] - [[ get_target_move(data) ]] + + Date[[ data['form'].get('sort_selection', 'date') == 'date' and ' ' or removeParentNode('para') ]] + Reference Number[[ data['form'].get('sort_selection', 'date') == 'ref' and ' ' or removeParentNode('para') ]] + diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 21c1ee3d846..d21323e02fc 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -267,12 +267,13 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): return result_tmp + result_init def _get_partners(self): + # TODO: deprecated, to remove in trunk if self.result_selection == 'customer': - return 'Receivable Accounts' + return _('Receivable Accounts') elif self.result_selection == 'supplier': - return 'Payable Accounts' + return _('Payable Accounts') elif self.result_selection == 'customer_supplier': - return 'Receivable and Payable Accounts' + return _('Receivable and Payable Accounts') return '' def _sum_currency_amount_account(self, account, form): diff --git a/addons/account/report/account_partner_ledger.rml b/addons/account/report/account_partner_ledger.rml index 0d7122369c6..48ed6d4afe3 100644 --- a/addons/account/report/account_partner_ledger.rml +++ b/addons/account/report/account_partner_ledger.rml @@ -423,7 +423,9 @@ - [[ get_partners() ]] + Receivable Accounts[[ data['form'].get('result_selection', 'customer') == 'customer' or removeParentNode('para') ]] + Payable Accounts[[ data['form'].get('result_selection', 'customer') == 'supplier' or removeParentNode('para') ]] + Receivable and Payable Accounts[[ data['form'].get('result_selection', 'customer') == 'customer_supplier' or removeParentNode('para') ]] [[ get_target_move(data) ]] diff --git a/addons/account/static/src/js/account_move_line_quickadd.js b/addons/account/static/src/js/account_move_line_quickadd.js index 997b2b03bb6..0b904e19da6 100644 --- a/addons/account/static/src/js/account_move_line_quickadd.js +++ b/addons/account/static/src/js/account_move_line_quickadd.js @@ -84,7 +84,7 @@ openerp.account.quickadd = function (instance) { }, search_by_journal_period: function() { var self = this; - var domain = []; + var domain = ['|',['debit', '!=', 0], ['credit', '!=', 0]]; if (self.current_journal !== null) domain.push(["journal_id", "=", self.current_journal]); if (self.current_period !== null) domain.push(["period_id", "=", self.current_period]); self.last_context["journal_id"] = self.current_journal === null ? false : self.current_journal; diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py index c457140684a..871aea9e4d9 100644 --- a/addons/account/wizard/account_report_common.py +++ b/addons/account/wizard/account_report_common.py @@ -175,7 +175,7 @@ class account_common_report(osv.osv_memory): data['form'][field] = data['form'][field][0] used_context = self._build_contexts(cr, uid, ids, data, context=context) data['form']['periods'] = used_context.get('periods', False) and used_context['periods'] or [] - data['form']['used_context'] = used_context + data['form']['used_context'] = dict(used_context, lang=context.get('lang', 'en_US')) return self._print_report(cr, uid, ids, data, context=context) diff --git a/addons/account_analytic_plans/account_analytic_plans_view.xml b/addons/account_analytic_plans/account_analytic_plans_view.xml index 7fb4091b45f..42b17ae06c3 100644 --- a/addons/account_analytic_plans/account_analytic_plans_view.xml +++ b/addons/account_analytic_plans/account_analytic_plans_view.xml @@ -248,9 +248,12 @@ account.analytic.default - + + 1 + + - + diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index 896349ec5e6..a9061c0afce 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1510,7 +1510,7 @@ rule or repeating pattern of time to exclude from the recurring rule."), continue if r['class']=='private': for f in r.keys(): - if f not in ('id','date','date_deadline','duration','user_id','state'): + if f not in ('id','date','date_deadline','duration','user_id','state','interval','count'): if isinstance(r[f], list): r[f] = [] else: diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 1070af22b3c..e344b0153df 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -96,13 +96,11 @@ class crm_lead(base_stage, format_address, osv.osv): def create(self, cr, uid, vals, context=None): if context is None: context = {} - if not vals.get('stage_id'): - ctx = context.copy() - if vals.get('section_id'): - ctx['default_section_id'] = vals['section_id'] - if vals.get('type'): - ctx['default_type'] = vals['type'] - vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) + if vals.get('type') and not context.get('default_type'): + context['default_type'] = vals.get('type') + if vals.get('section_id') and not context.get('default_section_id'): + context['default_section_id'] = vals.get('section_id') + # context: no_log, because subtype already handle this create_context = dict(context, mail_create_nolog=True) return super(crm_lead, self).create(cr, uid, vals, context=create_context) diff --git a/addons/crm/crm_phonecall_menu.xml b/addons/crm/crm_phonecall_menu.xml index 2344604a294..f6f94547173 100644 --- a/addons/crm/crm_phonecall_menu.xml +++ b/addons/crm/crm_phonecall_menu.xml @@ -58,7 +58,7 @@ tree,calendar [] - {} + {'default_state': 'done'}

diff --git a/addons/crm/res_partner.py b/addons/crm/res_partner.py index f25b1303c02..fca9222082d 100644 --- a/addons/crm/res_partner.py +++ b/addons/crm/res_partner.py @@ -56,7 +56,7 @@ class res_partner(osv.osv): default.update({'opportunity_ids': [], 'meeting_ids' : [], 'phonecall_ids' : []}) - super(res_partner, self).copy(cr, uid, record_id, default, context) + return super(res_partner, self).copy(cr, uid, record_id, default, context) def redirect_partner_form(self, cr, uid, partner_id, context=None): search_view = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base', 'view_res_partner_filter') diff --git a/addons/document_page/document_page.py b/addons/document_page/document_page.py index f74cfe02a21..7f885018001 100644 --- a/addons/document_page/document_page.py +++ b/addons/document_page/document_page.py @@ -66,7 +66,7 @@ class document_page(osv.osv): 'create_date': fields.datetime("Created on", select=True, readonly=True), 'create_uid': fields.many2one('res.users', 'Author', select=True, readonly=True), 'write_date': fields.datetime("Modification Date", select=True, readonly=True), - 'write_uid': fields.many2one('res.users', "Last Contributor", select=True), + 'write_uid': fields.many2one('res.users', "Last Contributor", select=True, readonly=True), } _defaults = { 'type':'content', diff --git a/addons/hr_expense/hr_expense_view.xml b/addons/hr_expense/hr_expense_view.xml index a383f72e2ab..0d9e2a247fd 100644 --- a/addons/hr_expense/hr_expense_view.xml +++ b/addons/hr_expense/hr_expense_view.xml @@ -86,7 +86,7 @@ - +

diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index d8c00c40a31..2bfe03fe5fa 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -240,7 +240,7 @@ class hr_applicant(base_stage, osv.Model): _defaults = { 'active': lambda *a: 1, - 'user_id': lambda s, cr, uid, c: uid, + 'user_id': lambda s, cr, uid, c: uid, 'email_from': lambda s, cr, uid, c: s._get_default_email(cr, uid, c), 'stage_id': lambda s, cr, uid, c: s._get_default_stage_id(cr, uid, c), 'department_id': lambda s, cr, uid, c: s._get_default_department_id(cr, uid, c), @@ -253,13 +253,11 @@ class hr_applicant(base_stage, osv.Model): } def onchange_job(self, cr, uid, ids, job, context=None): - result = {} - if job: - job_obj = self.pool.get('hr.job') - result['department_id'] = job_obj.browse(cr, uid, job, context=context).department_id.id - return {'value': result} - return {'value': {'department_id': False}} + job_record = self.pool.get('hr.job').browse(cr, uid, job, context=context) + if job_record and job_record.department_id: + return {'value': {'department_id': job_record.department_id.id}} + return {} def onchange_department_id(self, cr, uid, ids, department_id=False, context=None): obj_recru_stage = self.pool.get('hr.recruitment.stage') @@ -403,6 +401,11 @@ class hr_applicant(base_stage, osv.Model): return super(hr_applicant, self).message_update(cr, uid, ids, msg, update_vals=update_vals, context=context) def create(self, cr, uid, vals, context=None): + if context is None: + context = {} + if vals.get('department_id') and not context.get('default_department_id'): + context['default_department_id'] = vals.get('department_id') + obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context) applicant = self.browse(cr, uid, obj_id, context=context) if applicant.job_id: diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 9cbfd4560e7..9da17bd2928 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -187,6 +187,7 @@ + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py index 6c4f6022c39..b950b85ac48 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice.py +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice.py @@ -173,7 +173,10 @@ class account_analytic_line(osv.osv): data = {} journal_types = {} + price = 0.0 for line in self.pool.get('account.analytic.line').browse(cr, uid, ids, context=context): + price += line.amount*-1 + line_name = line.name if line.journal_id.type not in journal_types: journal_types[line.journal_id.type] = set() journal_types[line.journal_id.type].add(line.account_id.id) @@ -204,7 +207,6 @@ class account_analytic_line(osv.osv): 'date_due': date_due, 'fiscal_position': account.partner_id.property_account_position.id } - context2 = context.copy() context2['lang'] = partner.lang # set company_id in context, so the correct default journal will be selected @@ -225,36 +227,42 @@ class account_analytic_line(osv.osv): if data.get('product'): product_id = data['product'][0] product = product_obj.browse(cr, uid, product_id, context=context2) - if not product: - raise osv.except_osv(_('Error!'), _('There is no product defined. Please select one or force the product through the wizard.')) factor = invoice_factor_obj.browse(cr, uid, factor_id, context=context2) - factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1] - if factor.customer_name: - factor_name += ' - ' + factor.customer_name - - ctx = context.copy() - ctx.update({'uom':uom}) - - price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, ctx) - - general_account = product.property_account_income or product.categ_id.property_account_income_categ - if not general_account: - raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name) - taxes = product.taxes_id or general_account.tax_ids - tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes) + factor_name = factor.customer_name and line_name + ' - ' + factor.customer_name or line_name curr_line = { 'price_unit': price, 'quantity': qty, - 'discount':factor.factor, - 'invoice_line_tax_id': [(6,0,tax )], + 'discount': factor.factor, 'invoice_id': last_invoice, 'name': factor_name, - 'product_id': product_id, - 'invoice_line_tax_id': [(6,0,tax)], 'uos_id': uom, - 'account_id': general_account.id, 'account_analytic_id': account.id, } + if product: + factor_name = product_obj.name_get(cr, uid, [product_id], context=context2)[0][1] + if factor.customer_name: + factor_name += ' - ' + factor.customer_name + + ctx = context.copy() + ctx.update({'uom': uom}) + + # check force product + if data.get('product'): + price = self._get_invoice_price(cr, uid, account, product_id, user_id, qty, ctx) + + general_account = product.property_account_income or product.categ_id.property_account_income_categ + if not general_account: + raise osv.except_osv(_("Configuration Error!"), _("Please define income account for product '%s'.") % product.name) + taxes = product.taxes_id or general_account.tax_ids + tax = fiscal_pos_obj.map_tax(cr, uid, account.partner_id.property_account_position, taxes) + curr_line.update({ + 'price_unit': price, + 'invoice_line_tax_id': [(6,0,tax )], + 'name': factor_name, + 'product_id': product_id, + 'invoice_line_tax_id': [(6,0,tax)], + 'account_id': general_account.id, + }) # # Compute for lines diff --git a/addons/idea/views/idea.xml b/addons/idea/views/idea.xml index b228af2da45..7df21f99f11 100644 --- a/addons/idea/views/idea.xml +++ b/addons/idea/views/idea.xml @@ -93,7 +93,6 @@ help="Accepted Ideas" /> - diff --git a/addons/l10n_be_coda/wizard/account_coda_import.py b/addons/l10n_be_coda/wizard/account_coda_import.py index 8aabe601bc8..aed99345fba 100644 --- a/addons/l10n_be_coda/wizard/account_coda_import.py +++ b/addons/l10n_be_coda/wizard/account_coda_import.py @@ -117,6 +117,8 @@ class account_coda_import(osv.osv_memory): # and so a 'like' operator would return the first account number in the database which matches. cr.execute("select id from res_partner_bank where replace(replace(acc_number,' ',''),'-','') = %s", (statement['acc_number'],)) bank_ids = [id[0] for id in cr.fetchall()] + # Filter bank accounts which are not allowed + bank_ids = self.pool.get('res.partner.bank').search(cr, uid, [('id', 'in', bank_ids)]) if bank_ids and len(bank_ids) > 0: bank_accs = self.pool.get('res.partner.bank').browse(cr, uid, bank_ids) for bank_acc in bank_accs: @@ -248,7 +250,7 @@ class account_coda_import(osv.osv_memory): elif line[0] == '9': statement['balanceMin'] = float(rmspaces(line[22:37])) / 1000 statement['balancePlus'] = float(rmspaces(line[37:52])) / 1000 - if not statement['balance_end_real']: + if not statement.get('balance_end_real'): statement['balance_end_real'] = statement['balance_start'] + statement['balancePlus'] - statement['balanceMin'] for i, statement in enumerate(statements): statement['coda_note'] = '' @@ -266,6 +268,8 @@ class account_coda_import(osv.osv_memory): raise osv.except_osv(_('Error'), _("Configuration Error in journal %s!\nPlease verify the Default Debit and Credit Account settings.") % statement['journal_id'].name) if balance_start_check != statement['balance_start']: statement['coda_note'] = _("The CODA Statement %s Starting Balance (%.2f) does not correspond with the previous Closing Balance (%.2f) in journal %s!") % (statement['description'] + ' #' + statement['paperSeqNumber'], statement['balance_start'], balance_start_check, statement['journal_id'].name) + if not(statement.get('period_id')): + raise osv.except_osv(_('Error') + ' R3006', _(' No transactions or no period in coda file !')) data = { 'name': statement['paperSeqNumber'], 'date': statement['date'], diff --git a/addons/l10n_be_invoice_bba/invoice.py b/addons/l10n_be_invoice_bba/invoice.py index a23dabd7c51..fca743928bf 100644 --- a/addons/l10n_be_invoice_bba/invoice.py +++ b/addons/l10n_be_invoice_bba/invoice.py @@ -153,25 +153,33 @@ class account_invoice(osv.osv): return {'value': {'reference': reference}} def create(self, cr, uid, vals, context=None): - if vals.has_key('reference_type'): - reference_type = vals['reference_type'] + reference = vals.get('reference', False) + reference_type = vals.get('reference_type', False) + if vals.get('type') == 'out_invoice' and not reference_type: + # fallback on default communication type for partner + reference_type = self.pool.get('res.partner').browse(cr, uid, vals['partner_id']).out_inv_comm_type if reference_type == 'bba': - if vals.has_key('reference'): - bbacomm = vals['reference'] - else: + reference = self.generate_bbacomm(cr, uid, [], vals['type'], reference_type, vals['partner_id'], '', context={})['value']['reference'] + vals.update({ + 'reference_type': reference_type or 'none', + 'reference': reference, + }) + + if reference_type == 'bba': + if not reference: + raise osv.except_osv(_('Warning!'), + _('Empty BBA Structured Communication!' \ + '\nPlease fill in a unique BBA Structured Communication.')) + if self.check_bbacomm(reference): + reference = re.sub('\D', '', reference) + vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++' + same_ids = self.search(cr, uid, + [('type', '=', 'out_invoice'), ('reference_type', '=', 'bba'), + ('reference', '=', vals['reference'])]) + if same_ids: raise osv.except_osv(_('Warning!'), - _('Empty BBA Structured Communication!' \ - '\nPlease fill in a unique BBA Structured Communication.')) - if self.check_bbacomm(bbacomm): - reference = re.sub('\D', '', bbacomm) - vals['reference'] = '+++' + reference[0:3] + '/' + reference[3:7] + '/' + reference[7:] + '+++' - same_ids = self.search(cr, uid, - [('type', '=', 'out_invoice'), ('reference_type', '=', 'bba'), - ('reference', '=', vals['reference'])]) - if same_ids: - raise osv.except_osv(_('Warning!'), - _('The BBA Structured Communication has already been used!' \ - '\nPlease create manually a unique BBA Structured Communication.')) + _('The BBA Structured Communication has already been used!' \ + '\nPlease create manually a unique BBA Structured Communication.')) return super(account_invoice, self).create(cr, uid, vals, context=context) def write(self, cr, uid, ids, vals, context=None): diff --git a/addons/l10n_ca/account_tax_en.xml b/addons/l10n_ca/account_tax_en.xml index afe505f27f5..f0d2670d077 100644 --- a/addons/l10n_ca/account_tax_en.xml +++ b/addons/l10n_ca/account_tax_en.xml @@ -101,8 +101,8 @@ - GST + TVQ for sales - GSTTVQ_SALE + GST + QST for sales + GSTQST_SALE sale 1 percent @@ -127,8 +127,8 @@ - TVQ for sales - 9.975% - TVQ + QST for sales - 9.975% + QST sale 0.099750 percent @@ -192,8 +192,8 @@ - TVH for sales - 12% - TVH12_SALE + HST for sales - 12% + HST12_SALE sale 0.120000 percent @@ -207,8 +207,8 @@ - TVH for sales - 13% - TVH13_SALE + HST for sales - 13% + HST13_SALE sale 0.130000 percent @@ -222,8 +222,8 @@ - TVH for sales - 13.5% - TVH135_SALE + HST for sales - 13.5% + HST135_SALE sale 0.135000 percent @@ -237,8 +237,8 @@ - TVH for sales - 15% - TVH15_SALE + HST for sales - 15% + HST15_SALE sale 0.150000 percent @@ -367,8 +367,8 @@ - GST + TVQ for purchases - GSTTVQ_PURC + GST + QST for purchases + GSTQST_PURC purchase 1 percent @@ -393,8 +393,8 @@ - TVQ for purchases - 9.975% - TVQ + QST for purchases - 9.975% + QST purchase 0.099750 percent @@ -458,8 +458,8 @@ - TVH for purchases - 12% - TVH12_PURC + HST for purchases - 12% + HST12_PURC purchase 0.120000 percent @@ -473,8 +473,8 @@ - TVH for purchases - 13% - TVH13_PURC + HST for purchases - 13% + HST13_PURC purchase 0.130000 percent @@ -488,8 +488,8 @@ - TVH for purchases - 13.5% - TVH135_PURC + HST for purchases - 13.5% + HST135_PURC purchase 0.135000 percent @@ -503,8 +503,8 @@ - TVH for purchases - 15% - TVH15_PURC + HST for purchases - 15% + HST15_PURC purchase 0.150000 percent diff --git a/addons/l10n_ch/__openerp__.py b/addons/l10n_ch/__openerp__.py index 8960224891d..a7830784340 100644 --- a/addons/l10n_ch/__openerp__.py +++ b/addons/l10n_ch/__openerp__.py @@ -24,8 +24,8 @@ {'name': 'Switzerland - Accounting', 'description': """ - Swiss localization : - ==================== +Swiss localization +================== **Multilang swiss STERCHI account chart and taxes** **Author:** Camptocamp SA diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index d9e00353d49..d45ae04ddd1 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -176,7 +176,7 @@ class mail_mail(osv.Model): if context is None: context = {} if not ids: - filters = ['&', ('state', '=', 'outgoing'), ('type', '=', 'email')] + filters = [('state', '=', 'outgoing')] if 'filters' in context: filters.extend(context['filters']) ids = self.search(cr, uid, filters, context=context) diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index 1b5d520cd42..2744e6df231 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -312,7 +312,12 @@ class mail_thread(osv.AbstractModel): # subscribe uid unless asked not to if not context.get('mail_create_nosubscribe'): self.message_subscribe_users(cr, uid, [thread_id], [uid], context=context) - self.message_auto_subscribe(cr, uid, [thread_id], values.keys(), context=context) + # auto_subscribe: take values and defaults into account + create_values = set(values.keys()) + for key, val in context.iteritems(): + if key.startswith('default_'): + create_values.add(key[8:]) + self.message_auto_subscribe(cr, uid, [thread_id], list(create_values), context=context) # track values tracked_fields = self._get_tracked_fields(cr, uid, values.keys(), context=context) @@ -1436,7 +1441,7 @@ class mail_thread(osv.AbstractModel): ], context=context) mail_followers_obj.write(cr, SUPERUSER_ID, fol_ids, {'subtype_ids': [(6, 0, subtype_ids)]}, context=context) # subtype_ids not specified: do not update already subscribed partner, fetch default subtypes for new partners - else: + elif subtype_ids is None: subtype_ids = subtype_obj.search(cr, uid, [ ('default', '=', True), '|', diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 370aa2e55ff..126b4b40a07 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -975,11 +975,11 @@ class pos_order(osv.osv): }) if data_type == 'product': - key = ('product', values['partner_id'], values['product_id']) + key = ('product', values['partner_id'], values['product_id'], values['debit'] > 0) elif data_type == 'tax': - key = ('tax', values['partner_id'], values['tax_code_id'],) + key = ('tax', values['partner_id'], values['tax_code_id'], values['debit'] > 0) elif data_type == 'counter_part': - key = ('counter_part', values['partner_id'], values['account_id']) + key = ('counter_part', values['partner_id'], values['account_id'], values['debit'] > 0) else: return diff --git a/addons/point_of_sale/wizard/pos_session_opening.py b/addons/point_of_sale/wizard/pos_session_opening.py index 39e7c564831..3d6e314d033 100644 --- a/addons/point_of_sale/wizard/pos_session_opening.py +++ b/addons/point_of_sale/wizard/pos_session_opening.py @@ -85,6 +85,7 @@ class pos_session_opening(osv.osv_memory): session_ids = proxy.search(cr, uid, [ ('state', '!=', 'closed'), ('config_id', '=', config_id), + ('user_id', '=', uid), ], context=context) if session_ids: session = proxy.browse(cr, uid, session_ids[0], context=context) diff --git a/addons/procurement/procurement_data.xml b/addons/procurement/procurement_data.xml index 6a83d525c68..52503e76c44 100644 --- a/addons/procurement/procurement_data.xml +++ b/addons/procurement/procurement_data.xml @@ -12,7 +12,7 @@ - + diff --git a/addons/procurement/schedulers.py b/addons/procurement/schedulers.py index 7c9d5ec3290..6f326ccf1c5 100644 --- a/addons/procurement/schedulers.py +++ b/addons/procurement/schedulers.py @@ -36,6 +36,8 @@ class procurement_order(osv.osv): ''' Runs through scheduler. @param use_new_cursor: False or the dbname ''' + if use_new_cursor: + use_new_cursor = cr.dbname self._procure_confirm(cr, uid, use_new_cursor=use_new_cursor, context=context) self._procure_orderpoint_confirm(cr, uid, automatic=automatic,\ use_new_cursor=use_new_cursor, context=context) diff --git a/addons/project/project.py b/addons/project/project.py index 587d60ff86f..6bd17f98e92 100644 --- a/addons/project/project.py +++ b/addons/project/project.py @@ -586,6 +586,15 @@ class task(base_stage, osv.osv): }, } + def _get_default_partner(self, cr, uid, context=None): + """ Override of base_stage to add project specific behavior """ + project_id = self._get_default_project_id(cr, uid, context) + if project_id: + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) + if project and project.partner_id: + return project.partner_id.id + return super(task, self)._get_default_partner(cr, uid, context=context) + def _get_default_project_id(self, cr, uid, context=None): """ Gives default section by checking if present in the context """ return (self._resolve_project_id_from_context(cr, uid, context=context) or False) @@ -600,7 +609,8 @@ class task(base_stage, osv.osv): context key, or None if it cannot be resolved to a single project. """ - if context is None: context = {} + if context is None: + context = {} if type(context.get('default_project_id')) in (int, long): return context['default_project_id'] if isinstance(context.get('default_project_id'), basestring): @@ -681,13 +691,11 @@ class task(base_stage, osv.osv): def onchange_planned(self, cr, uid, ids, planned=0.0, effective=0.0): return {'value':{'remaining_hours': planned - effective}} - def onchange_project(self, cr, uid, id, project_id): - if not project_id: - return {} - data = self.pool.get('project.project').browse(cr, uid, [project_id]) - partner_id=data and data[0].partner_id - if partner_id: - return {'value':{'partner_id':partner_id.id}} + def onchange_project(self, cr, uid, id, project_id, context=None): + if project_id: + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) + if project and project.partner_id: + return {'value': {'partner_id': project.partner_id.id}} return {} def duplicate_task(self, cr, uid, map_ids, context=None): @@ -810,8 +818,9 @@ class task(base_stage, osv.osv): 'progress': 0, 'sequence': 10, 'active': True, - 'user_id': lambda obj, cr, uid, context: uid, - 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=c), + 'user_id': lambda obj, cr, uid, ctx=None: uid, + 'company_id': lambda self, cr, uid, ctx=None: self.pool.get('res.company')._company_default_get(cr, uid, 'project.task', context=ctx), + 'partner_id': lambda self, cr, uid, ctx=None: self._get_default_partner(cr, uid, context=ctx), } _order = "priority, sequence, date_start, name, id" @@ -1111,11 +1120,9 @@ class task(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): if context is None: context = {} - if not vals.get('stage_id'): - ctx = context.copy() - if vals.get('project_id'): - ctx['default_project_id'] = vals['project_id'] - vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) + if vals.get('project_id') and not context.get('default_project_id'): + context['default_project_id'] = vals.get('project_id') + # context: no_log, because subtype already handle this create_context = dict(context, mail_create_nolog=True) task_id = super(task, self).create(cr, uid, vals, context=create_context) @@ -1127,11 +1134,6 @@ class task(base_stage, osv.osv): def write(self, cr, uid, ids, vals, context=None): if isinstance(ids, (int, long)): ids = [ids] - if vals.get('project_id'): - project_id = self.pool.get('project.project').browse(cr, uid, vals.get('project_id'), context=context) - if project_id: - vals.setdefault('message_follower_ids', []) - vals['message_follower_ids'] += [(6, 0,[follower.id]) for follower in project_id.message_follower_ids] if vals and not 'kanban_state' in vals and 'stage_id' in vals: new_stage = vals.get('stage_id') vals_reset_kstate = dict(vals, kanban_state='normal') diff --git a/addons/project_issue/project_issue.py b/addons/project_issue/project_issue.py index a69d9356002..91b5633f6d6 100644 --- a/addons/project_issue/project_issue.py +++ b/addons/project_issue/project_issue.py @@ -65,15 +65,22 @@ class project_issue(base_stage, osv.osv): def create(self, cr, uid, vals, context=None): if context is None: context = {} - if not vals.get('stage_id'): - ctx = context.copy() - if vals.get('project_id'): - ctx['default_project_id'] = vals['project_id'] - vals['stage_id'] = self._get_default_stage_id(cr, uid, context=ctx) + if vals.get('project_id') and not context.get('default_project_id'): + context['default_project_id'] = vals.get('project_id') + # context: no_log, because subtype already handle this create_context = dict(context, mail_create_nolog=True) return super(project_issue, self).create(cr, uid, vals, context=create_context) + def _get_default_partner(self, cr, uid, context=None): + """ Override of base_stage to add project specific behavior """ + project_id = self._get_default_project_id(cr, uid, context) + if project_id: + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) + if project and project.partner_id: + return project.partner_id.id + return super(project_issue, self)._get_default_partner(cr, uid, context=context) + def _get_default_project_id(self, cr, uid, context=None): """ Gives default project by checking if present in the context """ return self._resolve_project_id_from_context(cr, uid, context=context) @@ -215,6 +222,10 @@ class project_issue(base_stage, osv.osv): return res def on_change_project(self, cr, uid, ids, project_id, context=None): + if project_id: + project = self.pool.get('project.project').browse(cr, uid, project_id, context=context) + if project and project.partner_id: + return {'value': {'partner_id': project.partner_id.id}} return {} def _get_issue_task(self, cr, uid, ids, context=None): @@ -309,6 +320,7 @@ class project_issue(base_stage, osv.osv): 'company_id': lambda s, cr, uid, c: s.pool.get('res.company')._company_default_get(cr, uid, 'crm.helpdesk', context=c), 'priority': crm.AVAILABLE_PRIORITIES[2][0], 'kanban_state': 'normal', + 'user_id': lambda obj, cr, uid, context: uid, } _group_by_full = { diff --git a/addons/project_mrp/project_mrp_view.xml b/addons/project_mrp/project_mrp_view.xml index 881ed9b6b29..499a0259214 100644 --- a/addons/project_mrp/project_mrp_view.xml +++ b/addons/project_mrp/project_mrp_view.xml @@ -26,9 +26,9 @@ project.task - + - + diff --git a/addons/report_webkit/webkit_report.py b/addons/report_webkit/webkit_report.py index b66c7ce6f3b..1a642463df9 100644 --- a/addons/report_webkit/webkit_report.py +++ b/addons/report_webkit/webkit_report.py @@ -173,7 +173,7 @@ class WebKitParser(report_sxw): ), 'w' ) - head_file.write(header) + head_file.write(header.encode('utf-8')) head_file.close() file_to_del.append(head_file.name) command.extend(['--header-html', head_file.name]) @@ -184,7 +184,7 @@ class WebKitParser(report_sxw): ), 'w' ) - foot_file.write(footer) + foot_file.write(footer.encode('utf-8')) foot_file.close() file_to_del.append(foot_file.name) command.extend(['--footer-html', foot_file.name]) @@ -205,7 +205,7 @@ class WebKitParser(report_sxw): for html in html_list : html_file = file(os.path.join(tmp_dir, str(time.time()) + str(count) +'.body.html'), 'w') count += 1 - html_file.write(html) + html_file.write(html.encode('utf-8')) html_file.close() file_to_del.append(html_file.name) command.append(html_file.name) diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index b1a1fa048be..14b3ba04eb5 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -918,7 +918,7 @@ - + @@ -1045,7 +1045,7 @@