diff options
| author | Christophe Simonis <chs@odoo.com> | 2015-02-20 18:16:01 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2015-02-20 18:16:01 +0100 |
| commit | aec02cb4935103aa7d158b56397c191932b35fa7 (patch) | |
| tree | 82915059f96448510e6b1c5183611175c483e579 /addons | |
| parent | e13923c0db1fd4ba9c98eacdcd987c6be7575a5f (diff) | |
| parent | d350f5b59e8905a76e965b6f34a0db14dbb53af0 (diff) | |
[MERGE] forward port of branch 8.0 up to d350f5b
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/account_move_line.py | 13 | ||||
| -rw-r--r-- | addons/calendar/calendar.py | 2 | ||||
| -rw-r--r-- | addons/delivery/stock.py | 21 | ||||
| -rw-r--r-- | addons/google_drive/static/src/js/gdrive.js | 2 | ||||
| -rw-r--r-- | addons/hr_expense/hr_expense.py | 4 | ||||
| -rw-r--r-- | addons/hr_expense/tests/__init__.py | 1 | ||||
| -rw-r--r-- | addons/hr_expense/tests/test_journal_entries.py | 60 | ||||
| -rw-r--r-- | addons/mail/static/src/xml/mail.xml | 4 | ||||
| -rw-r--r-- | addons/report_webkit/__openerp__.py | 4 | ||||
| -rw-r--r-- | addons/report_webkit/i18n/es_MX.po | 4 | ||||
| -rw-r--r-- | addons/report_webkit/i18n/es_VE.po | 4 | ||||
| -rw-r--r-- | addons/web/controllers/main.py | 4 | ||||
| -rw-r--r-- | addons/web/static/src/js/views.js | 3 | ||||
| -rw-r--r-- | addons/website_blog/views/website_blog_templates.xml | 8 | ||||
| -rw-r--r-- | addons/website_forum/data/forum_data.xml | 15 | ||||
| -rw-r--r-- | addons/website_forum_doc/data/doc_data.xml | 14 |
16 files changed, 120 insertions, 43 deletions
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index d75d4eb3d61..2c1422c1369 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -1176,9 +1176,11 @@ class account_move_line(osv.osv): raise UserError(_('You cannot change the tax, you should remove and recreate lines.')) if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']: raise UserError(_('You cannot use an inactive account.')) - if update_check: - if ('account_id' in vals) or ('journal_id' in vals) or ('period_id' in vals) or ('move_id' in vals) or ('debit' in vals) or ('credit' in vals) or ('date' in vals): - self._update_check(cr, uid, ids, context) + + affects_move = any(f in vals for f in ('account_id', 'journal_id', 'period_id', 'move_id', 'debit', 'credit', 'date')) + + if update_check and affects_move: + self._update_check(cr, uid, ids, context) todo_date = None if vals.get('date', False): @@ -1202,7 +1204,8 @@ class account_move_line(osv.osv): if journal.centralisation: self._check_moves(cr, uid, context=ctx) result = super(account_move_line, self).write(cr, uid, ids, vals, context) - if check and not context.get('novalidate'): + + if affects_move and check and not context.get('novalidate'): done = [] for line in self.browse(cr, uid, ids): if line.move_id.id not in done: @@ -1378,7 +1381,7 @@ class account_move_line(osv.osv): } self.create(cr, uid, data, context) #create the Tax movement - if not tax['amount']: + if not tax['amount'] and not tax[tax_code]: continue data = { 'move_id': vals['move_id'], diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index 8a2cac738b4..19aa9ed7d0b 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -1826,6 +1826,8 @@ class invite_wizard(osv.osv_memory): ''' in case someone clicked on 'invite others' wizard in the followers widget, transform virtual ids in real ids ''' + if 'default_res_id' in context: + context = dict(context, default_res_id=get_real_ids(context['default_res_id'])) result = super(invite_wizard, self).default_get(cr, uid, fields, context=context) if 'res_id' in result: result['res_id'] = get_real_ids(result['res_id']) diff --git a/addons/delivery/stock.py b/addons/delivery/stock.py index 3f28e553a29..28040e25553 100644 --- a/addons/delivery/stock.py +++ b/addons/delivery/stock.py @@ -117,15 +117,22 @@ class stock_picking(osv.osv): 'invoice_line_tax_id': [(6, 0, taxes_ids)], } - def _create_invoice_from_picking(self, cr, uid, picking, vals, context=None): + def _invoice_create_line(self, cr, uid, moves, journal_id, inv_type='out_invoice', context=None): invoice_obj = self.pool.get('account.invoice') invoice_line_obj = self.pool.get('account.invoice.line') - invoice_id = super(stock_picking, self)._create_invoice_from_picking(cr, uid, picking, vals, context=context) - invoice = invoice_obj.browse(cr, uid, invoice_id, context=context) - invoice_line = self._prepare_shipping_invoice_line(cr, uid, picking, invoice, context=context) - if invoice_line: - invoice_line_obj.create(cr, uid, invoice_line) - return invoice_id + invoice_ids = super(stock_picking, self)._invoice_create_line(cr, uid, moves, journal_id, inv_type=inv_type, context=context) + delivey_invoices = {} + for move in moves: + for invoice in move.picking_id.sale_id.invoice_ids: + if invoice.id in invoice_ids: + delivey_invoices[invoice] = move.picking_id + if delivey_invoices: + for invoice, picking in delivey_invoices.items(): + invoice_line = self._prepare_shipping_invoice_line(cr, uid, picking, invoice, context=context) + if invoice_line: + invoice_line_obj.create(cr, uid, invoice_line) + invoice_obj.button_compute(cr, uid, [invoice.id], context=context, set_total=(inv_type in ('in_invoice', 'in_refund'))) + return invoice_ids def _get_default_uom(self, cr, uid, context=None): uom_categ_id = self.pool.get('ir.model.data').xmlid_to_res_id(cr, uid, 'product.product_uom_categ_kgm') diff --git a/addons/google_drive/static/src/js/gdrive.js b/addons/google_drive/static/src/js/gdrive.js index 98324c1c288..07f0e9e37eb 100644 --- a/addons/google_drive/static/src/js/gdrive.js +++ b/addons/google_drive/static/src/js/gdrive.js @@ -64,7 +64,7 @@ openerp.google_drive = function (instance, m) { var loaded = self.fetch('google.drive.config', ['google_drive_resource_id', 'google_drive_client_id'], [['id', '=', doc_item.config_id]]) .then(function (configs) { var ds = new instance.web.DataSet(self, 'google.drive.config'); - ds.call('get_google_drive_url', [doc_item.config_id, doc_item.res_id,configs[0].google_drive_resource_id]).done(function (url) { + ds.call('get_google_drive_url', [doc_item.config_id, doc_item.res_id,configs[0].google_drive_resource_id, self.dataset.context]).done(function (url) { if (url){ window.open(url, '_blank'); } diff --git a/addons/hr_expense/hr_expense.py b/addons/hr_expense/hr_expense.py index 09c6d4bee84..e260bf47a37 100644 --- a/addons/hr_expense/hr_expense.py +++ b/addons/hr_expense/hr_expense.py @@ -318,7 +318,7 @@ class hr_expense_expense(osv.osv): is_price_include = tax_obj.read(cr,uid,tax['id'],['price_include'],context)['price_include'] if is_price_include: ## We need to deduce the price for the tax - res[-1]['price'] = res[-1]['price'] - (tax['amount'] * tax['base_sign'] or 0.0) + res[-1]['price'] = res[-1]['price'] - tax['amount'] # tax amount countains base amount without the tax base_tax_amount = (base_tax_amount - tax['amount']) * tax['base_sign'] else: @@ -329,7 +329,7 @@ class hr_expense_expense(osv.osv): 'name':tax['name'], 'price_unit': tax['price_unit'], 'quantity': 1, - 'price': tax['amount'] * tax['base_sign'] or 0.0, + 'price': tax['amount'] or 0.0, 'account_id': tax['account_collected_id'] or mres['account_id'], 'tax_code_id': tax['tax_code_id'], 'tax_amount': tax['amount'] * tax['base_sign'], diff --git a/addons/hr_expense/tests/__init__.py b/addons/hr_expense/tests/__init__.py new file mode 100644 index 00000000000..ddaeb0a7612 --- /dev/null +++ b/addons/hr_expense/tests/__init__.py @@ -0,0 +1 @@ +from . import test_journal_entries diff --git a/addons/hr_expense/tests/test_journal_entries.py b/addons/hr_expense/tests/test_journal_entries.py new file mode 100644 index 00000000000..4df277c3f49 --- /dev/null +++ b/addons/hr_expense/tests/test_journal_entries.py @@ -0,0 +1,60 @@ +from openerp.tests.common import TransactionCase +from openerp import netsvc, workflow + + +class TestCheckJournalEntry(TransactionCase): + """ + Check journal entries when the expense product is having tax which is tax included. + """ + + def setUp(self): + super(TestCheckJournalEntry, self).setUp() + cr, uid = self.cr, self.uid + self.expense_obj = self.registry('hr.expense.expense') + self.exp_line_obj = self.registry('hr.expense.line') + self.product_obj = self.registry('product.product') + self.tax_obj = self.registry('account.tax') + self.code_obj = self.registry('account.tax.code') + _, self.product_id = self.registry("ir.model.data").get_object_reference(cr, uid, "hr_expense", "air_ticket") + _, self.employee_id = self.registry("ir.model.data").get_object_reference(cr, uid, "hr", "employee_mit") + self.base_code_id = self.code_obj.create(cr, uid, {'name': 'Expense Base Code'}) + self.tax_id = self.tax_obj.create(cr, uid, { + 'name': 'Expense 10%', + 'amount': 0.10, + 'type': 'percent', + 'type_tax_use': 'purchase', + 'price_include': True, + 'base_code_id': self.base_code_id, + 'base_sign': -1, + }) + self.product_obj.write(cr, uid, self.product_id, {'supplier_taxes_id': [(6, 0, [self.tax_id])]}) + self.expense_id = self.expense_obj.create(cr, uid, { + 'name': 'Expense for Minh Tran', + 'employee_id': self.employee_id, + }) + self.exp_line_obj.create(cr, uid, { + 'name': 'Car Travel Expenses', + 'product_id': self.product_id, + 'unit_amount': 700.00, + 'expense_id': self.expense_id + }) + + def test_journal_entry(self): + cr, uid = self.cr, self.uid + #Submit to Manager + workflow.trg_validate(uid, 'hr.expense.expense', self.expense_id, 'confirm', cr) + #Approve + workflow.trg_validate(uid, 'hr.expense.expense', self.expense_id, 'validate', cr) + #Create Expense Entries + workflow.trg_validate(uid, 'hr.expense.expense', self.expense_id, 'done', cr) + self.expense = self.expense_obj.browse(cr, uid, self.expense_id) + self.assertEquals(self.expense.state, 'done', 'Expense is not in Waiting Payment state') + self.assertTrue(self.expense.account_move_id.id, 'Expense Journal Entry is not created') + for line in self.expense.account_move_id.line_id: + if line.credit: + self.assertEquals(line.credit, 700.00, 'Expense Payable Amount is not matched for journal item') + else: + if line.tax_code_id: + self.assertEquals(line.debit, 636.36, 'Tax Amount is not matched for journal item') + else: + self.assertEquals(line.debit, 63.64, 'Tax Base Amount is not matched for journal item') diff --git a/addons/mail/static/src/xml/mail.xml b/addons/mail/static/src/xml/mail.xml index bb5a41cccd6..05ed0debb5d 100644 --- a/addons/mail/static/src/xml/mail.xml +++ b/addons/mail/static/src/xml/mail.xml @@ -95,7 +95,7 @@ <img t-att-src="'/mail/static/src/img/mimetypes/' + attachment.file_type_icon + '.png'"></img> <div class='oe_name'><t t-raw='attachment.name' /></div> </a> - <div class="oe_delete"> + <div class="oe_delete" t-if="!attachment.upload"> <i class='fa fa-times-circle' title="Delete this attachment" t-att-data-id="attachment.id"/> </div> <div class='oe_progress_bar'> @@ -109,7 +109,7 @@ <img t-att-src="widget.attachments_resize_image(attachment.id, [100,80])"></img> <div class='oe_name'><t t-raw='attachment.name' /></div> </a> - <div class="oe_delete"> + <div class="oe_delete" t-if="!attachment.upload"> <i class='fa fa-times-circle' title="Delete this attachment" t-att-data-id="attachment.id"/> </div> <div class='oe_progress_bar'> diff --git a/addons/report_webkit/__openerp__.py b/addons/report_webkit/__openerp__.py index 923006965eb..c5442e0e5be 100644 --- a/addons/report_webkit/__openerp__.py +++ b/addons/report_webkit/__openerp__.py @@ -58,12 +58,12 @@ For a sample report see also the webkit_report_sample module, and this video: Requirements and Installation: ------------------------------ -This module requires the ``wkthtmltopdf`` library to render HTML documents as +This module requires the ``wkhtmltopdf`` library to render HTML documents as PDF. Version 0.9.9 or later is necessary, and can be found at http://code.google.com/p/wkhtmltopdf/ for Linux, Mac OS X (i386) and Windows (32bits). After installing the library on the OpenERP Server machine, you may need to set -the path to the ``wkthtmltopdf`` executable file in a system parameter named +the path to the ``wkhtmltopdf`` executable file in a system parameter named ``webkit_path`` in Settings -> Customization -> Parameters -> System Parameters If you are experiencing missing header/footer problems on Linux, be sure to diff --git a/addons/report_webkit/i18n/es_MX.po b/addons/report_webkit/i18n/es_MX.po index 8e0b1ac5a2a..af7d0c90935 100644 --- a/addons/report_webkit/i18n/es_MX.po +++ b/addons/report_webkit/i18n/es_MX.po @@ -259,7 +259,7 @@ msgid "" "\n" "After installing the wkhtmltopdf library on the OpenERP Server machine, you " "need to set the\n" -"path to the wkthtmltopdf executable file on the Company.\n" +"path to the wkhtmltopdf executable file on the Company.\n" "\n" "For a sample report see also the webkit_report_sample module, and this " "video:\n" @@ -300,7 +300,7 @@ msgstr "" "\n" "Después de instalar la biblioteca wkhtmltopdf en el servidor de OpenERP, es " "necesario establecer la\n" -"ruta de acceso al archivo ejecutable wkthtmltopdf en la compañía.\n" +"ruta de acceso al archivo ejecutable wkhtmltopdf en la compañía.\n" "\n" "Para obtener un informe de ejemplo véase también el módulo " "webkit_report_sample, y este vídeo:\n" diff --git a/addons/report_webkit/i18n/es_VE.po b/addons/report_webkit/i18n/es_VE.po index 8e0b1ac5a2a..af7d0c90935 100644 --- a/addons/report_webkit/i18n/es_VE.po +++ b/addons/report_webkit/i18n/es_VE.po @@ -259,7 +259,7 @@ msgid "" "\n" "After installing the wkhtmltopdf library on the OpenERP Server machine, you " "need to set the\n" -"path to the wkthtmltopdf executable file on the Company.\n" +"path to the wkhtmltopdf executable file on the Company.\n" "\n" "For a sample report see also the webkit_report_sample module, and this " "video:\n" @@ -300,7 +300,7 @@ msgstr "" "\n" "Después de instalar la biblioteca wkhtmltopdf en el servidor de OpenERP, es " "necesario establecer la\n" -"ruta de acceso al archivo ejecutable wkthtmltopdf en la compañía.\n" +"ruta de acceso al archivo ejecutable wkhtmltopdf en la compañía.\n" "\n" "Para obtener un informe de ejemplo véase también el módulo " "webkit_report_sample, y este vídeo:\n" diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 2ed235c979e..7bea7f50111 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1255,7 +1255,7 @@ class Action(http.Controller): except Exception: action_id = 0 # force failed read - base_action = Actions.read([action_id], ['name', 'type'], request.context) + base_action = Actions.read([action_id], ['type'], request.context) if base_action: ctx = request.context action_type = base_action[0]['type'] @@ -1265,7 +1265,7 @@ class Action(http.Controller): ctx.update(additional_context) action = request.session.model(action_type).read([action_id], False, ctx) if action: - value = clean_action(dict(action[0], **base_action[0])) + value = clean_action(action[0]) return value @http.route('/web/action/run', type='json', auth="user") diff --git a/addons/web/static/src/js/views.js b/addons/web/static/src/js/views.js index e374350397d..3b6ec4d794c 100644 --- a/addons/web/static/src/js/views.js +++ b/addons/web/static/src/js/views.js @@ -1144,7 +1144,8 @@ instance.web.Sidebar = instance.web.Widget.extend({ self.rpc("/web/action/load", { action_id: item.action.id, - context: c + context: new instance.web.CompoundContext( + self.dataset.get_context(), active_ids_context).eval() }).done(function(result) { result.context = new instance.web.CompoundContext( result.context || {}, active_ids_context) diff --git a/addons/website_blog/views/website_blog_templates.xml b/addons/website_blog/views/website_blog_templates.xml index 66c4a10d08b..0dc46173502 100644 --- a/addons/website_blog/views/website_blog_templates.xml +++ b/addons/website_blog/views/website_blog_templates.xml @@ -178,8 +178,8 @@ <xpath expr="//*[@name='blog_post_data']" position="inside"> <p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)"> <span class="fa fa-tags"/> - <t t-foreach="blog_post.tag_ids" t-as="tag"> - <a t-attf-href="#{blog_url(tag=tag.id, date_begin=False, date_end=False)}" t-esc="tag.name"/> &nbsp; + <t t-foreach="blog_post.tag_ids" t-as="one_tag"> + <a t-attf-href="#{blog_url(tag=one_tag.id, date_begin=False, date_end=False)}" t-esc="one_tag.name"/> &nbsp; </t> </p> </xpath> @@ -334,8 +334,8 @@ <xpath expr="//p[@name='blog_post_data']" position="after"> <p class="post-meta text-muted text-center" t-if="len(blog_post.tag_ids)"> <span class="fa fa-tags"/> - <t t-foreach="blog_post.tag_ids" t-as="tag"> - <a t-attf-href="#{blog_url(tag=tag.id)}" t-esc="tag.name"/> &nbsp; + <t t-foreach="blog_post.tag_ids" t-as="one_tag"> + <a t-attf-href="#{blog_url(tag=one_tag.id)}" t-esc="one_tag.name"/> &nbsp; </t> </p> </xpath> diff --git a/addons/website_forum/data/forum_data.xml b/addons/website_forum/data/forum_data.xml index ba317fba4f7..e804525be18 100644 --- a/addons/website_forum/data/forum_data.xml +++ b/addons/website_forum/data/forum_data.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> - <data> - + <data noupdate="1"> <record id="forum_help" model="forum.forum"> <field name="name">Help</field> </record> @@ -12,7 +11,8 @@ <field name="parent_id" ref="website.main_menu"/> <field name="sequence" type="int">35</field> </record> - + </data> + <data> <function model="ir.config_parameter" name="set_param" eval="('auth_signup.allow_uninvited', True)" /> <!-- JUMP TO FORUM AT INSTALL --> @@ -21,10 +21,6 @@ <field name="target">self</field> <field name="url" eval="'/forum/'+str(ref('website_forum.forum_help'))"/> </record> - <record id="base.open_menu" model="ir.actions.todo"> - <field name="action_id" ref="action_open_forum"/> - <field name="state">open</field> - </record> <!-- Set Admin karma --> <record id="base.user_root" model="res.users"> @@ -79,6 +75,11 @@ </data> <data noupdate="1"> + <record id="base.open_menu" model="ir.actions.todo"> + <field name="action_id" ref="action_open_forum"/> + <field name="state">open</field> + </record> + <!-- Reasons for closing Post --> <record id="reason_1" model="forum.post.reason"> <field name="name">duplicate post</field> diff --git a/addons/website_forum_doc/data/doc_data.xml b/addons/website_forum_doc/data/doc_data.xml index 8252ff99d89..d9a6566d908 100644 --- a/addons/website_forum_doc/data/doc_data.xml +++ b/addons/website_forum_doc/data/doc_data.xml @@ -1,7 +1,15 @@ <?xml version="1.0" encoding="utf-8"?> <openerp> <data> + <!-- JUMP TO DOCUMENTATION AT INSTALL --> + <record id="action_open_documentation" model="ir.actions.act_url"> + <field name="name">Documentation</field> + <field name="target">self</field> + <field name="url" eval="'/forum/how-to'"/> + </record> + </data> + <data noupdate="1"> <record id="menu_questions" model="website.menu"> <field name="name">Documentation</field> <field name="url" eval="'/forum/how-to'"/> @@ -9,12 +17,6 @@ <field name="sequence" type="int">65</field> </record> - <!-- JUMP TO DOCUMENTATION AT INSTALL --> - <record id="action_open_documentation" model="ir.actions.act_url"> - <field name="name">Documentation</field> - <field name="target">self</field> - <field name="url" eval="'/forum/how-to'"/> - </record> <record id="base.open_menu" model="ir.actions.todo"> <field name="action_id" ref="action_open_documentation"/> <field name="state">open</field> |
