[FIX] account: base field in account.invoice.tax

The field base is obligatory according to a european law.
This field existed in saas-6.

opw:674713
This commit is contained in:
Goffin Simon
2016-05-11 13:54:39 +02:00
parent 0a5b943d19
commit 8ad0c0f3ab
3 changed files with 18 additions and 0 deletions
+11
View File
@@ -1233,6 +1233,14 @@ class AccountInvoiceTax(models.Model):
_description = "Invoice Tax"
_order = 'sequence'
def _compute_base_amount(self):
for tax in self:
base = 0.0
for line in tax.invoice_id.invoice_line_ids:
if tax.tax_id in line.invoice_line_tax_ids:
base += line.price_subtotal
tax.base = base
invoice_id = fields.Many2one('account.invoice', string='Invoice', ondelete='cascade', index=True)
name = fields.Char(string='Tax Description', required=True)
tax_id = fields.Many2one('account.tax', string='Tax')
@@ -1243,6 +1251,9 @@ class AccountInvoiceTax(models.Model):
sequence = fields.Integer(help="Gives the sequence order when displaying a list of invoice tax.")
company_id = fields.Many2one('res.company', string='Company', related='account_id.company_id', store=True, readonly=True)
currency_id = fields.Many2one('res.currency', related='invoice_id.currency_id', store=True, readonly=True)
base = fields.Monetary(string='Base', compute='_compute_base_amount')
class AccountPaymentTerm(models.Model):
@@ -93,6 +93,7 @@
<field name="manual"/>
<field name="name"/>
<field name="account_id" groups="base.group_account_user"/>
<field name="base"/>
<field name="amount"/>
<field name="currency_id" invisible="1"/>
</tree>
@@ -111,6 +112,7 @@
<field name="account_analytic_id" domain="[('company_id', '=', parent.company_id), ('account_type', '=', 'normal')]" groups="analytic.group_analytic_accounting"/>
<field name="manual"/>
<field name="amount"/>
<field name="base"/>
<field name="currency_id" invisible="1"/>
</group>
</form>
+5
View File
@@ -122,12 +122,17 @@
<thead>
<tr>
<th>Tax</th>
<th class="text-right">Base</th>
<th class="text-right">Amount</th>
</tr>
</thead>
<tbody>
<tr t-foreach="o.tax_line_ids" t-as="t">
<td><span t-field="t.name"/></td>
<td class="text-right">
<span t-field="t.base"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</td>
<td class="text-right">
<span t-field="t.amount"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>