[MERGE] forward port branch saas-15 up to 9878db14f5
This commit is contained in:
@@ -887,6 +887,7 @@ class AccountInvoice(models.Model):
|
|||||||
@api.multi
|
@api.multi
|
||||||
def get_taxes_values(self):
|
def get_taxes_values(self):
|
||||||
tax_grouped = {}
|
tax_grouped = {}
|
||||||
|
round_curr = self.currency_id.round
|
||||||
for line in self.invoice_line_ids:
|
for line in self.invoice_line_ids:
|
||||||
price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
|
price_unit = line.price_unit * (1 - (line.discount or 0.0) / 100.0)
|
||||||
taxes = line.invoice_line_tax_ids.compute_all(price_unit, self.currency_id, line.quantity, line.product_id, self.partner_id)['taxes']
|
taxes = line.invoice_line_tax_ids.compute_all(price_unit, self.currency_id, line.quantity, line.product_id, self.partner_id)['taxes']
|
||||||
@@ -896,9 +897,10 @@ class AccountInvoice(models.Model):
|
|||||||
|
|
||||||
if key not in tax_grouped:
|
if key not in tax_grouped:
|
||||||
tax_grouped[key] = val
|
tax_grouped[key] = val
|
||||||
|
tax_grouped[key]['base'] = round_curr(val['base'])
|
||||||
else:
|
else:
|
||||||
tax_grouped[key]['amount'] += val['amount']
|
tax_grouped[key]['amount'] += val['amount']
|
||||||
tax_grouped[key]['base'] += val['base']
|
tax_grouped[key]['base'] += round_curr(val['base'])
|
||||||
return tax_grouped
|
return tax_grouped
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
|
|||||||
@@ -101,3 +101,66 @@ class TestAccountCustomerInvoice(AccountTestUsers):
|
|||||||
|
|
||||||
# I clicked on Add Credit Note button.
|
# I clicked on Add Credit Note button.
|
||||||
self.account_invoice_refund_0.invoice_refund()
|
self.account_invoice_refund_0.invoice_refund()
|
||||||
|
|
||||||
|
def test_customer_invoice_tax(self):
|
||||||
|
|
||||||
|
self.env.user.company_id.tax_calculation_rounding_method = 'round_globally'
|
||||||
|
|
||||||
|
payment_term = self.env.ref('account.account_payment_term_advance')
|
||||||
|
journalrec = self.env['account.journal'].search([('type', '=', 'sale')])[0]
|
||||||
|
partner3 = self.env.ref('base.res_partner_3')
|
||||||
|
account_id = self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id
|
||||||
|
|
||||||
|
tax = self.env['account.tax'].create({
|
||||||
|
'name': 'Tax 15.0',
|
||||||
|
'amount': 15.0,
|
||||||
|
'amount_type': 'percent',
|
||||||
|
'type_tax_use': 'sale',
|
||||||
|
})
|
||||||
|
|
||||||
|
invoice_line_data = [
|
||||||
|
(0, 0,
|
||||||
|
{
|
||||||
|
'product_id': self.env.ref('product.product_product_1').id,
|
||||||
|
'quantity': 40.0,
|
||||||
|
'account_id': account_id,
|
||||||
|
'name': 'product test 1',
|
||||||
|
'discount' : 10.00,
|
||||||
|
'price_unit': 2.27,
|
||||||
|
'invoice_line_tax_ids': [(6, 0, [tax.id])],
|
||||||
|
}
|
||||||
|
),
|
||||||
|
(0, 0,
|
||||||
|
{
|
||||||
|
'product_id': self.env.ref('product.product_product_2').id,
|
||||||
|
'quantity': 21.0,
|
||||||
|
'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
|
||||||
|
'name': 'product test 2',
|
||||||
|
'discount' : 10.00,
|
||||||
|
'price_unit': 2.77,
|
||||||
|
'invoice_line_tax_ids': [(6, 0, [tax.id])],
|
||||||
|
}
|
||||||
|
),
|
||||||
|
(0, 0,
|
||||||
|
{
|
||||||
|
'product_id': self.env.ref('product.product_product_3').id,
|
||||||
|
'quantity': 21.0,
|
||||||
|
'account_id': self.env['account.account'].search([('user_type_id', '=', self.env.ref('account.data_account_type_revenue').id)], limit=1).id,
|
||||||
|
'name': 'product test 3',
|
||||||
|
'discount' : 10.00,
|
||||||
|
'price_unit': 2.77,
|
||||||
|
'invoice_line_tax_ids': [(6, 0, [tax.id])],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
|
invoice = self.env['account.invoice'].create(dict(
|
||||||
|
name="Test Customer Invoice",
|
||||||
|
reference_type="none",
|
||||||
|
payment_term_id=payment_term.id,
|
||||||
|
journal_id=journalrec.id,
|
||||||
|
partner_id=partner3.id,
|
||||||
|
invoice_line_ids=invoice_line_data
|
||||||
|
))
|
||||||
|
|
||||||
|
self.assertEquals(invoice.amount_untaxed, sum([x.base for x in invoice.tax_line_ids]))
|
||||||
|
|||||||
@@ -648,7 +648,7 @@ a.no-decoration {
|
|||||||
|
|
||||||
.o_website_sale_animate {
|
.o_website_sale_animate {
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
position: absolute;
|
position: absolute !important;
|
||||||
height: 150px;
|
height: 150px;
|
||||||
width: 150px;
|
width: 150px;
|
||||||
z-index: 1020;
|
z-index: 1020;
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ a.no-decoration
|
|||||||
|
|
||||||
.o_website_sale_animate
|
.o_website_sale_animate
|
||||||
opacity: 0.7
|
opacity: 0.7
|
||||||
position: absolute
|
position: absolute !important
|
||||||
height: 150px
|
height: 150px
|
||||||
width: 150px
|
width: 150px
|
||||||
z-index: 1020
|
z-index: 1020
|
||||||
|
|||||||
@@ -676,8 +676,26 @@ class GroupsImplied(models.Model):
|
|||||||
if values.get('users') or values.get('implied_ids'):
|
if values.get('users') or values.get('implied_ids'):
|
||||||
# add all implied groups (to all users of each group)
|
# add all implied groups (to all users of each group)
|
||||||
for group in self:
|
for group in self:
|
||||||
vals = {'users': list(pycompat.izip(repeat(4), group.with_context(active_test=False).users.ids))}
|
self._cr.execute("""
|
||||||
super(GroupsImplied, group.trans_implied_ids).write(vals)
|
WITH RECURSIVE group_imply(gid, hid) AS (
|
||||||
|
SELECT gid, hid
|
||||||
|
FROM res_groups_implied_rel
|
||||||
|
UNION
|
||||||
|
SELECT i.gid, r.hid
|
||||||
|
FROM res_groups_implied_rel r
|
||||||
|
JOIN group_imply i ON (i.hid = r.gid)
|
||||||
|
)
|
||||||
|
INSERT INTO res_groups_users_rel (gid, uid)
|
||||||
|
SELECT i.hid, r.uid
|
||||||
|
FROM group_imply i, res_groups_users_rel r
|
||||||
|
WHERE r.gid = i.gid
|
||||||
|
AND i.gid = %(gid)s
|
||||||
|
EXCEPT
|
||||||
|
SELECT r.gid, r.uid
|
||||||
|
FROM res_groups_users_rel r
|
||||||
|
JOIN group_imply i ON (r.gid = i.hid)
|
||||||
|
WHERE i.gid = %(gid)s
|
||||||
|
""", dict(gid=group.id))
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user