[MERGE] forward port of branch saas-6 up to 8846dcb

This commit is contained in:
Christophe Simonis
2015-04-17 17:41:48 +02:00
2 changed files with 19 additions and 11 deletions
+18 -10
View File
@@ -1214,20 +1214,28 @@ class account_invoice_line(models.Model):
_order = "invoice_id,sequence,id"
@api.one
@api.depends('price_unit', 'discount', 'invoice_line_tax_id', 'quantity',
'product_id', 'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id')
@api.depends('price_unit', 'discount', 'invoice_line_tax_id', 'quantity', 'product_id',
'invoice_id.partner_id', 'invoice_id.currency_id', 'invoice_id.company_id')
def _compute_price(self):
price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)
taxes = self.invoice_line_tax_id.compute_all(price, self.quantity, product=self.product_id, partner=self.invoice_id.partner_id)
taxes = self.invoice_line_tax_id.compute_all(price, self.quantity,
product=self.product_id,
partner=self.invoice_id.partner_id)
self.price_subtotal = price_subtotal_signed = taxes['total']
if self.invoice_id.currency_id != self.invoice_id.company_id.currency_id:
price_subtotal_signed = self.invoice_id.currency_id.with_context(date=self.invoice_id.date_invoice).compute(price_subtotal_signed, self.company_id.currency_id)
sign = self.invoice_id.type in ['in_invoice', 'out_refund'] and -1 or 1
self.price_subtotal_signed = price_subtotal_signed * sign
if self.invoice_id:
self.price_subtotal = self.invoice_id.currency_id.round(self.price_subtotal)
self.price_subtotal_signed = self.invoice_id.currency_id.round(self.price_subtotal_signed)
if not self.invoice_id:
self.price_subtotal_signed = price_subtotal_signed
else:
inv_cur = self.invoice_id.currency_id
comp_cur = self.invoice_id.company_id.currency_id
if inv_cur != comp_cur:
inv_cur = inv_cur.with_context(date=self.invoice_id.date_invoice)
price_subtotal_signed = inv_cur.compute(price_subtotal_signed, comp_cur)
sign = -1 if self.invoice_id.type in ['in_invoice', 'out_refund'] else 1
self.price_subtotal = inv_cur.round(self.price_subtotal)
self.price_subtotal_signed = inv_cur.round(self.price_subtotal_signed * sign)
@api.model
def _default_price_unit(self):
@@ -36,7 +36,7 @@
<field name="res_model">account.aged.trial.balance</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="account_aged_balance_view"/>
<field name="context">{}</field>
<field name="target">new</field>