[MERGE] forward port branch 9.0 up to b9131adb48
This commit is contained in:
@@ -445,7 +445,7 @@ class AccountInvoice(models.Model):
|
||||
@api.onchange('invoice_line_ids')
|
||||
def _onchange_invoice_line_ids(self):
|
||||
taxes_grouped = self.get_taxes_values()
|
||||
tax_lines = self.tax_line_ids.browse([])
|
||||
tax_lines = self.tax_line_ids.filtered('manual')
|
||||
for tax in taxes_grouped.values():
|
||||
tax_lines += tax_lines.new(tax)
|
||||
self.tax_line_ids = tax_lines
|
||||
|
||||
@@ -102,7 +102,7 @@ class AccountMove(models.Model):
|
||||
"""
|
||||
moves = self.search([('state', '=', 'posted'),
|
||||
('company_id', '=', company_id),
|
||||
('l10n_fr_secure_sequence_number', '!=', False)],
|
||||
('l10n_fr_secure_sequence_number', '!=', 0)],
|
||||
order="l10n_fr_secure_sequence_number ASC")
|
||||
|
||||
if not moves:
|
||||
|
||||
@@ -757,21 +757,14 @@ class PosOrderLine(models.Model):
|
||||
@api.depends('price_unit', 'tax_ids', 'qty', 'discount', 'product_id')
|
||||
def _compute_amount_line_all(self):
|
||||
for line in self:
|
||||
currency = line.order_id.pricelist_id.currency_id
|
||||
taxes = line.tax_ids.filtered(lambda tax: tax.company_id.id == line.order_id.company_id.id)
|
||||
fiscal_position_id = line.order_id.fiscal_position_id
|
||||
if fiscal_position_id:
|
||||
taxes = fiscal_position_id.map_tax(taxes)
|
||||
price = self.env['account.tax']._fix_tax_included_price(
|
||||
line.price_unit * (1 - (line.discount or 0.0) / 100.0), line.product_id.taxes_id, taxes)
|
||||
line.price_subtotal = line.price_subtotal_incl = price * line.qty
|
||||
if taxes:
|
||||
taxes = taxes.compute_all(price, currency, line.qty, product=line.product_id, partner=line.order_id.partner_id or False)
|
||||
line.price_subtotal = taxes['total_excluded']
|
||||
line.price_subtotal_incl = taxes['total_included']
|
||||
|
||||
line.price_subtotal = currency.round(line.price_subtotal)
|
||||
line.price_subtotal_incl = currency.round(line.price_subtotal_incl)
|
||||
fpos = line.order_id.fiscal_position_id
|
||||
tax_ids_after_fiscal_position = fpos.map_tax(line.tax_ids) if fpos else line.tax_ids
|
||||
price = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
|
||||
taxes = tax_ids_after_fiscal_position.compute_all(price, line.order_id.pricelist_id.currency_id, line.qty, product=line.product_id, partner=line.order_id.partner_id)
|
||||
line.update({
|
||||
'price_subtotal_incl': taxes['total_included'],
|
||||
'price_subtotal': taxes['total_excluded'],
|
||||
})
|
||||
|
||||
@api.onchange('product_id')
|
||||
def _onchange_product_id(self):
|
||||
@@ -783,8 +776,10 @@ class PosOrderLine(models.Model):
|
||||
price = self.order_id.pricelist_id.price_get(
|
||||
self.product_id.id, self.qty or 1.0, self.order_id.partner_id.id)[self.order_id.pricelist_id.id]
|
||||
self._onchange_qty()
|
||||
self.price_unit = price
|
||||
self.tax_ids = self.product_id.taxes_id
|
||||
self.tax_ids = self.product_id.taxes_id.filtered(lambda r: not self.company_id or r.company_id == self.company_id)
|
||||
fpos = self.order_id.fiscal_position_id
|
||||
tax_ids_after_fiscal_position = fpos.map_tax(self.tax_ids) if fpos else self.tax_ids
|
||||
self.price_unit = self.env['account.tax']._fix_tax_included_price(price, self.product_id.taxes_id, tax_ids_after_fiscal_position)
|
||||
|
||||
@api.onchange('qty', 'discount', 'price_unit', 'tax_ids')
|
||||
def _onchange_qty(self):
|
||||
|
||||
@@ -11,6 +11,6 @@ class ir_http(orm.AbstractModel):
|
||||
request.context['editable'] = True
|
||||
if 'edit_translations' in request.httprequest.args and 'edit_translations' not in request.context:
|
||||
request.context['edit_translations'] = True
|
||||
if request.context.get('lang') != "en_US" and 'translatable' not in request.context:
|
||||
if request.context.get('edit_translations') and 'translatable' not in request.context:
|
||||
request.context['translatable'] = True
|
||||
return super(ir_http, self)._dispatch()
|
||||
|
||||
@@ -160,7 +160,7 @@ class ir_http(orm.AbstractModel):
|
||||
request.uid = None
|
||||
path.pop(1)
|
||||
return self.reroute('/'.join(path) or '/')
|
||||
if path[1] == request.website.default_lang_code:
|
||||
if request.lang == request.website.default_lang_code:
|
||||
request.context['edit_translations'] = False
|
||||
if not request.context.get('tz'):
|
||||
request.context['tz'] = request.session.get('geoip', {}).get('time_zone')
|
||||
|
||||
Reference in New Issue
Block a user