diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 19274d1d8ac..d1d20e5fea2 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -624,7 +624,8 @@ class account_move_line(osv.osv): res = super(account_move_line, self)._auto_init(cr, context=context) cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = \'account_move_line_journal_id_period_id_index\'') if not cr.fetchone(): - cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ON account_move_line (journal_id, period_id)') + cr.execute('CREATE INDEX account_move_line_journal_id_period_id_index ' + 'ON account_move_line (journal_id, period_id, state, create_uid, id DESC)') cr.execute('SELECT indexname FROM pg_indexes WHERE indexname = %s', ('account_move_line_date_id_index',)) if not cr.fetchone(): cr.execute('CREATE INDEX account_move_line_date_id_index ON account_move_line (date DESC, id desc)') diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py index 76bc8339beb..04752036ca5 100644 --- a/addons/account/report/account_aged_partner_balance.py +++ b/addons/account/report/account_aged_partner_balance.py @@ -75,7 +75,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (account_account.type IN %s)\ AND account_account.active\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND (l.partner_id=res_partner.id)\ AND (l.date <= %s)\ AND ' + self.query + ' \ @@ -99,7 +99,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (account_account.type IN %s)\ AND (l.partner_id IN %s)\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND ' + self.query + '\ AND account_account.active\ AND (l.date <= %s)\ @@ -119,7 +119,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (COALESCE(l.date_maturity, l.date) < %s)\ AND (l.partner_id IN %s)\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND '+ self.query + '\ AND account_account.active\ AND (l.date <= %s)\ @@ -136,7 +136,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (COALESCE(l.date_maturity,l.date) > %s)\ AND (l.partner_id IN %s)\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND '+ self.query + '\ AND account_account.active\ AND (l.date <= %s)\ @@ -168,7 +168,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (account_account.type IN %s) AND (l.partner_id IN %s) AND ((l.reconcile_id IS NULL) - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s ))) + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation))) AND ''' + self.query + ''' AND account_account.active AND ''' + dates_query + ''' @@ -264,7 +264,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (l.partner_id IS NULL)\ AND (account_account.type IN %s)\ AND ((l.reconcile_id IS NULL) \ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND ' + self.query + '\ AND (l.date <= %s)\ AND account_account.active ',(tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from,)) @@ -281,7 +281,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (account_account.type IN %s)\ AND (COALESCE(l.date_maturity, l.date) < %s)\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND '+ self.query + '\ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from)) t = self.cr.fetchall() @@ -296,7 +296,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (account_account.type IN %s)\ AND (COALESCE(l.date_maturity,l.date) > %s)\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND '+ self.query + '\ AND account_account.active ', (tuple(move_state), tuple(self.ACCOUNT_TYPE), self.date_from, self.date_from)) t = self.cr.fetchall() @@ -324,7 +324,7 @@ class aged_trial_report(report_sxw.rml_parse, common_report_header): AND (account_account.type IN %s)\ AND (l.partner_id IS NULL)\ AND ((l.reconcile_id IS NULL)\ - OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s )))\ + OR (l.reconcile_id IN (SELECT recon.id FROM account_move_reconcile AS recon WHERE recon.create_date > %s AND not recon.opening_reconciliation)))\ AND '+ self.query + '\ AND account_account.active\ AND ' + dates_query + '\ diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 196508cc1ae..8d8be98e38f 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -694,6 +694,28 @@ class account_analytic_account(osv.osv): } return invoice + def _prepare_invoice_line(self, cr, uid, line, fiscal_position, context=None): + fpos_obj = self.pool.get('account.fiscal.position') + res = line.product_id + account_id = res.property_account_income.id + if not account_id: + account_id = res.categ_id.property_account_income_categ.id + account_id = fpos_obj.map_account(cr, uid, fiscal_position, account_id) + + taxes = res.taxes_id or False + tax_id = fpos_obj.map_tax(cr, uid, fiscal_position, taxes) + values = { + 'name': line.name, + 'account_id': account_id, + 'account_analytic_id': line.analytic_account_id.id, + 'price_unit': line.price_unit or 0.0, + 'quantity': line.quantity, + 'uos_id': line.uom_id.id or False, + 'product_id': line.product_id.id or False, + 'invoice_line_tax_id': [(6, 0, tax_id)], + } + return values + def _prepare_invoice_lines(self, cr, uid, contract, fiscal_position_id, context=None): fpos_obj = self.pool.get('account.fiscal.position') fiscal_position = None @@ -701,26 +723,8 @@ class account_analytic_account(osv.osv): fiscal_position = fpos_obj.browse(cr, uid, fiscal_position_id, context=context) invoice_lines = [] for line in contract.recurring_invoice_line_ids: - - res = line.product_id - account_id = res.property_account_income.id - if not account_id: - account_id = res.categ_id.property_account_income_categ.id - account_id = fpos_obj.map_account(cr, uid, fiscal_position, account_id) - - taxes = res.taxes_id or False - tax_id = fpos_obj.map_tax(cr, uid, fiscal_position, taxes) - - invoice_lines.append((0, 0, { - 'name': line.name, - 'account_id': account_id, - 'account_analytic_id': contract.id, - 'price_unit': line.price_unit or 0.0, - 'quantity': line.quantity, - 'uos_id': line.uom_id.id or False, - 'product_id': line.product_id.id or False, - 'invoice_line_tax_id': [(6, 0, tax_id)], - })) + values = self._prepare_invoice_line(cr, uid, line, fiscal_position, context=context) + invoice_lines.append((0, 0, values)) return invoice_lines def _prepare_invoice(self, cr, uid, contract, context=None): diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 15ea283faa4..32baf5b302a 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -899,7 +899,7 @@ class account_voucher(osv.osv): else: currency_id = journal.company_id.currency_id.id - period_ids = self.pool['account.period'].find(cr, uid, context=dict(context, company_id=company_id)) + period_ids = self.pool['account.period'].find(cr, uid, dt=date, context=dict(context, company_id=company_id)) vals['value'].update({ 'currency_id': currency_id, 'payment_rate_currency_id': currency_id, diff --git a/addons/auth_oauth/res_users.py b/addons/auth_oauth/res_users.py index d2aed236f75..f2c6be389f1 100644 --- a/addons/auth_oauth/res_users.py +++ b/addons/auth_oauth/res_users.py @@ -46,6 +46,20 @@ class res_users(osv.Model): validation.update(data) return validation + def _generate_signup_values(self, cr, uid, provider, validation, params, context=None): + oauth_uid = validation['user_id'] + email = validation.get('email', 'provider_%s_user_%s' % (provider, oauth_uid)) + name = validation.get('name', email) + return { + 'name': name, + 'login': email, + 'email': email, + 'oauth_provider_id': provider, + 'oauth_uid': oauth_uid, + 'oauth_access_token': params['access_token'], + 'active': True, + } + def _auth_oauth_signin(self, cr, uid, provider, validation, params, context=None): """ retrieve and sign in the user corresponding to provider and validated access token :param provider: oauth provider id (int) @@ -70,18 +84,7 @@ class res_users(osv.Model): return None state = simplejson.loads(params['state']) token = state.get('t') - oauth_uid = validation['user_id'] - email = validation.get('email', 'provider_%s_user_%s' % (provider, oauth_uid)) - name = validation.get('name', email) - values = { - 'name': name, - 'login': email, - 'email': email, - 'oauth_provider_id': provider, - 'oauth_uid': oauth_uid, - 'oauth_access_token': params['access_token'], - 'active': True, - } + values = self._generate_signup_values(cr, uid, provider, validation, params, context=context) try: _, login, _ = self.signup(cr, uid, values, token, context=context) return login diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index e8b56ef7f0c..42149aca344 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -96,7 +96,7 @@ class calendar_attendee(osv.Model): 'email': fields.char('Email', help="Email of Invited Person"), 'availability': fields.selection([('free', 'Free'), ('busy', 'Busy')], 'Free/Busy', readonly="True"), 'access_token': fields.char('Invitation Token'), - 'event_id': fields.many2one('calendar.event', 'Meeting linked'), + 'event_id': fields.many2one('calendar.event', 'Meeting linked', ondelete='cascade'), } _defaults = { 'state': 'needsAction', diff --git a/addons/event/email_template.xml b/addons/event/email_template.xml index 26a9341b756..75686a842ef 100644 --- a/addons/event/email_template.xml +++ b/addons/event/email_template.xml @@ -1,6 +1,6 @@ - + Event subscription diff --git a/addons/l10n_ro/partner_view.xml b/addons/l10n_ro/partner_view.xml index 46c0cef1149..d13148160aa 100644 --- a/addons/l10n_ro/partner_view.xml +++ b/addons/l10n_ro/partner_view.xml @@ -3,7 +3,7 @@ res.partner.form.ro - + res.partner diff --git a/addons/payment_ogone/models/ogone.py b/addons/payment_ogone/models/ogone.py index 2d83b3dc5ac..4ffdd7518de 100644 --- a/addons/payment_ogone/models/ogone.py +++ b/addons/payment_ogone/models/ogone.py @@ -17,7 +17,7 @@ from openerp.addons.payment_ogone.controllers.main import OgoneController from openerp.addons.payment_ogone.data import ogone from openerp.osv import osv, fields from openerp.tools import float_round, DEFAULT_SERVER_DATE_FORMAT -from openerp.tools.float_utils import float_compare +from openerp.tools.float_utils import float_compare, float_repr from openerp.tools.safe_eval import safe_eval _logger = logging.getLogger(__name__) @@ -148,12 +148,11 @@ class PaymentAcquirerOgone(osv.Model): def ogone_form_generate_values(self, cr, uid, id, partner_values, tx_values, context=None): base_url = self.pool['ir.config_parameter'].get_param(cr, uid, 'web.base.url') acquirer = self.browse(cr, uid, id, context=context) - ogone_tx_values = dict(tx_values) temp_ogone_tx_values = { 'PSPID': acquirer.ogone_pspid, 'ORDERID': tx_values['reference'], - 'AMOUNT': '%d' % int(float_round(tx_values['amount'], 2) * 100), + 'AMOUNT': float_repr(float_round(tx_values['amount'], 2) * 100, 0), 'CURRENCY': tx_values['currency'] and tx_values['currency'].name or '', 'LANGUAGE': partner_values['lang'], 'CN': partner_values['name'], diff --git a/addons/point_of_sale/views/report_receipt.xml b/addons/point_of_sale/views/report_receipt.xml index 4bbd44afbe4..39192072514 100644 --- a/addons/point_of_sale/views/report_receipt.xml +++ b/addons/point_of_sale/views/report_receipt.xml @@ -31,7 +31,7 @@ - + diff --git a/addons/procurement/procurement.py b/addons/procurement/procurement.py index 816d999da47..83ad22c32c4 100644 --- a/addons/procurement/procurement.py +++ b/addons/procurement/procurement.py @@ -81,7 +81,7 @@ class procurement_rule(osv.osv): return [] _columns = { - 'name': fields.char('Name', required=True, + 'name': fields.char('Name', required=True, translate=True, help="This field will fill the packing origin and the name of its moves"), 'active': fields.boolean('Active', help="If unchecked, it will allow you to hide the rule without removing it."), 'group_propagation_option': fields.selection([('none', 'Leave Empty'), ('propagate', 'Propagate'), ('fixed', 'Fixed')], string="Propagation of Procurement Group"), diff --git a/addons/purchase/stock.py b/addons/purchase/stock.py index d7906c83f3b..64032bc5bc6 100644 --- a/addons/purchase/stock.py +++ b/addons/purchase/stock.py @@ -228,7 +228,7 @@ class stock_warehouse(osv.osv): _columns = { 'buy_to_resupply': fields.boolean('Purchase to resupply this warehouse', help="When products are bought, they can be delivered to this warehouse"), - 'buy_pull_id': fields.many2one('procurement.rule', 'BUY rule'), + 'buy_pull_id': fields.many2one('procurement.rule', 'Buy rule'), } _defaults = { 'buy_to_resupply': True, diff --git a/addons/purchase/stock_view.xml b/addons/purchase/stock_view.xml index fcfe2229c76..532f7fc6b25 100644 --- a/addons/purchase/stock_view.xml +++ b/addons/purchase/stock_view.xml @@ -18,7 +18,7 @@ - + diff --git a/addons/sale/sale.py b/addons/sale/sale.py index 1de3281091a..a10e396ef5b 100644 --- a/addons/sale/sale.py +++ b/addons/sale/sale.py @@ -573,8 +573,31 @@ class sale_order(osv.osv): return True def action_button_confirm(self, cr, uid, ids, context=None): + if not context: + context = {} assert len(ids) == 1, 'This option should only be used for a single id at a time.' self.signal_workflow(cr, uid, ids, 'order_confirm') + if context.get('send_email'): + order_id = ids[0] + email_act = self.action_quotation_send(cr, uid, [order_id], context=context) + if email_act and email_act.get('context'): + composer_obj = self.pool['mail.compose.message'] + composer_values = {} + email_ctx = email_act['context'] + template_values = [ + email_ctx.get('default_template_id'), + email_ctx.get('default_composition_mode'), + email_ctx.get('default_model'), + email_ctx.get('default_res_id'), + ] + composer_values.update(composer_obj.onchange_template_id(cr, uid, None, *template_values, context=context).get('value', {})) + if not composer_values.get('email_from'): + composer_values['email_from'] = self.browse(cr, uid, order_id, context=context).company_id.email + for key in ['attachment_ids', 'partner_ids']: + if composer_values.get(key): + composer_values[key] = [(6, 0, composer_values[key])] + composer_id = composer_obj.create(cr, uid, composer_values, context=email_ctx) + composer_obj.send_mail(cr, uid, [composer_id], context=email_ctx) return True def action_wait(self, cr, uid, ids, context=None): diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 8f5c0571abc..5f5cf3b1491 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -435,7 +435,7 @@ - + diff --git a/addons/sale_stock/i18n/sale_stock.pot b/addons/sale_stock/i18n/sale_stock.pot index 32b9977a1b6..db2bf052fb0 100644 --- a/addons/sale_stock/i18n/sale_stock.pot +++ b/addons/sale_stock/i18n/sale_stock.pot @@ -360,8 +360,3 @@ msgstr "" msgid "days" msgstr "" -#. module: sale_stock -#: view:sale.order:sale_stock.view_order_form_inherit -msgid "{\"shipping_except\":\"red\",\"invoice_except\":\"red\",\"waiting_date\":\"blue\"}" -msgstr "" - diff --git a/addons/stock/product.py b/addons/stock/product.py index db5866180d3..21e5512383d 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -74,9 +74,9 @@ class product_product(osv.osv): location_ids = [] if context.get('location', False): - if type(context['location']) == type(1): + if isinstance(context['location'], (int, long)): location_ids = [context['location']] - elif type(context['location']) in (type(''), type(u'')): + elif isinstance(context['location'], basestring): domain = [('complete_name','ilike',context['location'])] if context.get('force_company', False): domain += [('company_id', '=', context['force_company'])] @@ -85,7 +85,15 @@ class product_product(osv.osv): location_ids = context['location'] else: if context.get('warehouse', False): - wids = [context['warehouse']] + if isinstance(context['warehouse'], (int, long)): + wids = [context['warehouse']] + elif isinstance(context['warehouse'], basestring): + domain = [('name', 'ilike', context['warehouse'])] + if context.get('force_company', False): + domain += [('company_id', '=', context['force_company'])] + wids = warehouse_obj.search(cr, uid, domain, context=context) + else: + wids = context['warehouse'] else: wids = warehouse_obj.search(cr, uid, [], context=context) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 2a904e0cde1..50982815dc4 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -213,7 +213,7 @@ class stock_location_route(osv.osv): _order = 'sequence' _columns = { - 'name': fields.char('Route Name', required=True), + 'name': fields.char('Route Name', required=True, translate=True), 'sequence': fields.integer('Sequence'), 'pull_ids': fields.one2many('procurement.rule', 'route_id', 'Procurement Rules', copy=True), 'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the route without removing it."), diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 0020b7d5bb7..06dd3974122 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -653,7 +653,7 @@