Merge PR #60 into 11.0

Signed-off-by rousseldenis
This commit is contained in:
OCA-git-bot
2019-06-18 18:13:58 +00:00
3 changed files with 24 additions and 18 deletions

View File

@@ -8,7 +8,7 @@
{
"name": "Valued Picking Report",
"summary": "Adding Valued Picking on Delivery Slip report",
"version": "11.0.1.0.2",
"version": "11.0.1.0.3",
"author": "Tecnativa, "
"Odoo Community Association (OCA)",
"website": "https://www.tecnativa.com",

View File

@@ -63,14 +63,17 @@ class StockMoveLine(models.Model):
records...).
"""
for line in self:
sale_line = line.sale_line
price_unit = (
sale_line.price_subtotal / sale_line.product_uom_qty
if sale_line.product_uom_qty else sale_line.price_reduce)
taxes = line.sale_tax_id.compute_all(
price_unit=line.sale_line.price_subtotal / (
line.sale_line.product_uom_qty or 0.0),
price_unit=price_unit,
currency=line.currency_id,
quantity=line.qty_done or line.product_qty,
product=line.product_id,
partner=line.sale_line.order_id.partner_shipping_id)
if line.sale_line.company_id.tax_calculation_rounding_method == (
partner=sale_line.order_id.partner_shipping_id)
if sale_line.company_id.tax_calculation_rounding_method == (
'round_globally'):
price_tax = sum(
t.get('amount', 0.0) for t in taxes.get('taxes', []))

View File

@@ -42,10 +42,11 @@ class StockPicking(models.Model):
"""
for pick in self:
round_curr = pick.sale_id.currency_id.round
amount_untaxed = amount_tax = 0.0
amount_tax = 0.0
for tax_id, tax_group in pick.get_taxes_values().items():
amount_untaxed += round_curr(tax_group['base'])
amount_tax += round_curr(tax_group['amount'])
amount_untaxed = sum(
l.sale_price_subtotal for l in pick.move_line_ids)
pick.update({
'amount_untaxed': amount_untaxed,
'amount_tax': amount_tax,
@@ -56,15 +57,17 @@ class StockPicking(models.Model):
def get_taxes_values(self):
tax_grouped = {}
for line in self.move_line_ids:
tax = line.sale_line.tax_id
tax_id = tax.id
if tax_id not in tax_grouped:
tax_grouped[tax_id] = {
'amount': line.sale_price_tax,
'base': line.sale_price_subtotal,
'tax': tax,
}
else:
tax_grouped[tax_id]['amount'] += line.sale_price_tax
tax_grouped[tax_id]['base'] += line.sale_price_subtotal
for tax in line.sale_line.tax_id:
tax_id = tax.id
if tax_id not in tax_grouped:
tax_grouped[tax_id] = {
'base': line.sale_price_subtotal,
'tax': tax,
}
else:
tax_grouped[tax_id]['base'] += line.sale_price_subtotal
for tax_id, tax_group in tax_grouped.items():
tax_grouped[tax_id]['amount'] = tax_group['tax'].compute_all(
tax_group['base'], self.sale_id.currency_id
)['taxes'][0]['amount']
return tax_grouped