diff options
| author | Christophe Simonis <chs@odoo.com> | 2017-08-23 18:12:24 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2017-08-23 18:12:24 +0200 |
| commit | f8bf335aea42e2390559073337c525fbbb902fc4 (patch) | |
| tree | 8d7f950da428f9c45f990f54fe68b166e74d33b8 /addons | |
| parent | fa36e9836886848168070936c135112dbfebe2dd (diff) | |
| parent | 420e433fa3a6b671868fa578e6006dd215570706 (diff) | |
[MERGE] forward port branch 10.0 up to 420e433fa3a
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/account/models/account_move.py | 46 | ||||
| -rw-r--r-- | addons/link_tracker/models/link_tracker.py | 2 | ||||
| -rw-r--r-- | addons/mrp/wizard/mrp_product_produce_views.xml | 2 | ||||
| -rw-r--r-- | addons/product_extended/views/product_views.xml | 1 | ||||
| -rw-r--r-- | addons/stock/models/stock_pack_operation.py | 2 | ||||
| -rw-r--r-- | addons/website_sale/models/product.py | 6 |
6 files changed, 33 insertions, 26 deletions
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index f0557d90321..115bf98de0d 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -965,26 +965,10 @@ class AccountMoveLine(models.Model): vals['amount_currency'] = sign * abs(sum([r.amount_residual_currency for r in self])) # Writeoff line in the account of self - first_line_dict = vals.copy() - first_line_dict['account_id'] = self[0].account_id.id - if 'analytic_account_id' in first_line_dict: - del first_line_dict['analytic_account_id'] - if 'tax_ids' in first_line_dict: - tax_ids = [] - #vals['tax_ids'] is a list of commands [[4, tax_id, None], ...] - for tax_id in vals['tax_ids']: - tax_ids.append(tax_id[1]) - amount = first_line_dict['credit'] - first_line_dict['debit'] - amount_tax = self.env['account.tax'].browse(tax_ids).compute_all(amount)['total_included'] - first_line_dict['credit'] = amount_tax > 0 and amount_tax or 0.0 - first_line_dict['debit'] = amount_tax < 0 and abs(amount_tax) or 0.0 - del first_line_dict['tax_ids'] + first_line_dict = self._prepare_writeoff_first_line_values(vals) # Writeoff line in specified writeoff account - second_line_dict = vals.copy() - second_line_dict['debit'], second_line_dict['credit'] = second_line_dict['credit'], second_line_dict['debit'] - if 'amount_currency' in vals: - second_line_dict['amount_currency'] = -second_line_dict['amount_currency'] + second_line_dict = self._prepare_writeoff_second_line_values(vals) # Create the move writeoff_move = self.env['account.move'].with_context(apply_taxes=True).create({ @@ -998,6 +982,32 @@ class AccountMoveLine(models.Model): # Return the writeoff move.line which is to be reconciled return writeoff_move.line_ids.filtered(lambda r: r.account_id == self[0].account_id) + @api.multi + def _prepare_writeoff_first_line_values(self, values): + line_values = values.copy() + line_values['account_id'] = self[0].account_id.id + if 'analytic_account_id' in line_values: + del line_values['analytic_account_id'] + if 'tax_ids' in line_values: + tax_ids = [] + # vals['tax_ids'] is a list of commands [[4, tax_id, None], ...] + for tax_id in values['tax_ids']: + tax_ids.append(tax_id[1]) + amount = line_values['credit'] - line_values['debit'] + amount_tax = self.env['account.tax'].browse(tax_ids).compute_all(amount)['total_included'] + line_values['credit'] = amount_tax > 0 and amount_tax or 0.0 + line_values['debit'] = amount_tax < 0 and abs(amount_tax) or 0.0 + del line_values['tax_ids'] + return line_values + + @api.multi + def _prepare_writeoff_second_line_values(self, values): + line_values = values.copy() + line_values['debit'], line_values['credit'] = line_values['credit'], line_values['debit'] + if 'amount_currency' in values: + line_values['amount_currency'] = -line_values['amount_currency'] + return line_values + @api.model def compute_full_after_batch_reconcile(self): """ After running the manual reconciliation wizard and making full reconciliation, we need to run this method to create diff --git a/addons/link_tracker/models/link_tracker.py b/addons/link_tracker/models/link_tracker.py index 9d688121423..bdc97778543 100644 --- a/addons/link_tracker/models/link_tracker.py +++ b/addons/link_tracker/models/link_tracker.py @@ -15,7 +15,7 @@ from werkzeug import url_encode, unescape from odoo import models, fields, api, _ from odoo.tools import ustr -URL_REGEX = r'(\bhref=[\'"](?!mailto:)([^\'"]+)[\'"])' +URL_REGEX = r'(\bhref=[\'"](?!mailto:|tel:|sms:)([^\'"]+)[\'"])' def VALIDATE_URL(url): if urlparse(url).scheme not in ('http', 'https', 'ftp', 'ftps'): diff --git a/addons/mrp/wizard/mrp_product_produce_views.xml b/addons/mrp/wizard/mrp_product_produce_views.xml index 805d05b7549..c3df10ddbbe 100644 --- a/addons/mrp/wizard/mrp_product_produce_views.xml +++ b/addons/mrp/wizard/mrp_product_produce_views.xml @@ -29,8 +29,6 @@ <field name="quantity_done"/> <field name="lot_id" context="{'default_product_id': product_id}"/> <field name="move_id" invisible="1"/> - <button name="do_minus" type="object" icon="fa-minus-square" attrs="{'invisible': [('quantity_done', '<=', 0.99)]}" invisible="context.get('state_done')"/> - <button name="do_plus" type="object" icon="fa-plus-square" attrs="{'invisible': [('plus_visible', '=', False)]}" invisible="context.get('state_done')"/> </tree> </field> </group> diff --git a/addons/product_extended/views/product_views.xml b/addons/product_extended/views/product_views.xml index 2867a33f868..4e065e19604 100644 --- a/addons/product_extended/views/product_views.xml +++ b/addons/product_extended/views/product_views.xml @@ -23,6 +23,7 @@ <field name="model">product.product</field> <field name="priority">4</field> <field name="inherit_id" ref="product.product_normal_form_view"/> + <field name="groups_id" eval="[(4, ref('mrp.group_mrp_user'))]"/> <field name="arch" type="xml"> <div name="standard_price_uom" position="after"> <button name="compute_price" diff --git a/addons/stock/models/stock_pack_operation.py b/addons/stock/models/stock_pack_operation.py index 5de33d40631..edeba5e2c7b 100644 --- a/addons/stock/models/stock_pack_operation.py +++ b/addons/stock/models/stock_pack_operation.py @@ -90,7 +90,7 @@ class PackOperation(models.Model): res = self.package_id._get_all_products_quantities() # reduce by the quantities linked to a move for record in self.linked_move_operation_ids: - if record.move_id.product_id.id not in res: + if record.move_id.product_id not in res: res[record.move_id.product_id] = 0 res[record.move_id.product_id] -= record.qty return res diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index 5d372588088..d3e1c6b893a 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -190,9 +190,7 @@ class Product(models.Model): def _website_price(self): qty = self._context.get('quantity', 1.0) partner = self.env.user.partner_id - current_website = self.env['website'].get_current_website() - pricelist = current_website.get_current_pricelist() - company_id = current_website.company_id + pricelist = self.env['website'].get_current_website().get_current_pricelist() context = dict(self._context, pricelist=pricelist.id, partner=partner) self2 = self.with_context(context) if self._context != context else self @@ -200,7 +198,7 @@ class Product(models.Model): ret = self.env.user.has_group('sale.group_show_price_subtotal') and 'total_excluded' or 'total_included' for p, p2 in zip(self, self2): - taxes = partner.property_account_position_id.map_tax(p.taxes_id.filtered(lambda x: x.company_id == company_id)) + taxes = partner.property_account_position_id.map_tax(p.taxes_id) p.website_price = taxes.compute_all(p2.price, pricelist.currency_id, quantity=qty, product=p2, partner=partner)[ret] p.website_public_price = taxes.compute_all(p2.lst_price, quantity=qty, product=p2, partner=partner)[ret] |
