summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-11-07 18:25:31 +0100
committerChristophe Simonis <chs@odoo.com>2018-11-07 18:25:31 +0100
commit190b522e036f425fc834dafd712b94ddfa3dfc7f (patch)
tree0601eb30d2ed4644f686094845fa1f1c3b5a9543
parent03a35392da975f2f14bf921b5258ca1877645503 (diff)
parente6ff16cbba3802ca17c7bc110d91674580edd38b (diff)
[MERGE] forward port branch 10.0 up to e6ff16cbba3
-rw-r--r--addons/account/report/account_aged_partner_balance.py21
-rw-r--r--addons/account_asset/views/account_asset_views.xml8
-rw-r--r--addons/mrp/report/mrp_bom_cost_report_templates.xml2
-rw-r--r--addons/sale/models/sale.py3
-rw-r--r--doc/cla/individual/ugaitzolaizola.md11
5 files changed, 30 insertions, 15 deletions
diff --git a/addons/account/report/account_aged_partner_balance.py b/addons/account/report/account_aged_partner_balance.py
index 40f9842a12b..8cf5fd99a7f 100644
--- a/addons/account/report/account_aged_partner_balance.py
+++ b/addons/account/report/account_aged_partner_balance.py
@@ -31,7 +31,10 @@ class ReportAgedPartnerBalance(models.AbstractModel):
res = []
total = []
cr = self.env.cr
- company_ids = self.env.context.get('company_ids', (self.env.user.company_id.id,))
+ user_company = self.env.user.company_id
+ user_currency = user_company.currency_id
+ ResCurrency = self.env['res.currency'].with_context(date=date_from)
+ company_ids = self._context.get('company_ids') or [user_company.id]
move_state = ['draft', 'posted']
if target_move == 'posted':
move_state = ['posted']
@@ -88,15 +91,15 @@ class ReportAgedPartnerBalance(models.AbstractModel):
partner_id = line.partner_id.id or False
if partner_id not in undue_amounts:
undue_amounts[partner_id] = 0.0
- line_amount = line.balance
- if line.balance == 0:
+ line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance)
+ if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.create_date[:10] <= date_from:
- line_amount += partial_line.amount
+ line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.create_date[:10] <= date_from:
- line_amount -= partial_line.amount
+ line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
if not self.env.user.company_id.currency_id.is_zero(line_amount):
undue_amounts[partner_id] += line_amount
lines[partner_id].append({
@@ -140,15 +143,15 @@ class ReportAgedPartnerBalance(models.AbstractModel):
partner_id = line.partner_id.id or False
if partner_id not in partners_amount:
partners_amount[partner_id] = 0.0
- line_amount = line.balance
- if line.balance == 0:
+ line_amount = ResCurrency._compute(line.company_id.currency_id, user_currency, line.balance)
+ if user_currency.is_zero(line_amount):
continue
for partial_line in line.matched_debit_ids:
if partial_line.create_date[:10] <= date_from:
- line_amount += partial_line.amount
+ line_amount += ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
for partial_line in line.matched_credit_ids:
if partial_line.create_date[:10] <= date_from:
- line_amount -= partial_line.amount
+ line_amount -= ResCurrency._compute(partial_line.company_id.currency_id, user_currency, partial_line.amount)
if not self.env.user.company_id.currency_id.is_zero(line_amount):
partners_amount[partner_id] += line_amount
diff --git a/addons/account_asset/views/account_asset_views.xml b/addons/account_asset/views/account_asset_views.xml
index f569a6b60b1..6689500c0ac 100644
--- a/addons/account_asset/views/account_asset_views.xml
+++ b/addons/account_asset/views/account_asset_views.xml
@@ -28,18 +28,18 @@
<label for="account_asset_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_asset_id" string="Deferred Revenue Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
- <field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}"/>
+ <field name="account_asset_id" nolabel="1" attrs="{'invisible': [('type','=', False)]}" domain="[('company_id', '=', company_id)]"/>
<div>
<label for="account_depreciation_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_id" string="Recognition Income Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
- <field name="account_depreciation_id" nolabel="1"/>
+ <field name="account_depreciation_id" nolabel="1" domain="[('company_id', '=', company_id)]"/>
<div>
<label for="account_depreciation_expense_id" attrs="{'invisible': [('type','!=','purchase')]}"/>
<label for="account_depreciation_expense_id" string="Recognition Account" attrs="{'invisible': [('type','!=','sale')]}"/>
</div>
- <field name="account_depreciation_expense_id" nolabel="1"/>
- <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
+ <field name="account_depreciation_expense_id" nolabel="1" domain="[('company_id', '=', company_id)]"/>
+ <field name="account_analytic_id" domain="[('company_id', '=', company_id)]" groups="analytic.group_analytic_accounting"/>
</group>
<group string="Periodicity">
<field name="method_time" string="Time Method Based On" widget="radio" attrs="{'invisible': [('type','!=','purchase')]}"/>
diff --git a/addons/mrp/report/mrp_bom_cost_report_templates.xml b/addons/mrp/report/mrp_bom_cost_report_templates.xml
index 14f51211aa6..9ff424fc6bf 100644
--- a/addons/mrp/report/mrp_bom_cost_report_templates.xml
+++ b/addons/mrp/report/mrp_bom_cost_report_templates.xml
@@ -33,7 +33,7 @@
<tbody>
<tr t-foreach="line['lines']" t-as="bom_line">
<td colspan="3">
- <span t-att-res-id="bom_line['product_id'].id" res-model="product.product" view-type="form" t-esc="bom_line['product_id'].name"/>
+ <span t-att-res-id="bom_line['product_id'].id" res-model="product.product" view-type="form" t-esc="bom_line['product_id'].display_name"/>
</td>
<td class="text-right">
<span t-esc="bom_line['product_uom_qty']"/> <span t-esc="bom_line['product_uom'].name" groups="product.group_uom"/>
diff --git a/addons/sale/models/sale.py b/addons/sale/models/sale.py
index e94ba3eac75..ad0a327d591 100644
--- a/addons/sale/models/sale.py
+++ b/addons/sale/models/sale.py
@@ -374,10 +374,11 @@ class SaleOrder(models.Model):
raise UserError(_('There is no invoicable line.'))
for invoice in invoices.values():
+ invoice.compute_taxes()
if not invoice.invoice_line_ids:
raise UserError(_('There is no invoicable line.'))
# If invoice is negative, do a refund invoice instead
- if invoice.amount_untaxed < 0:
+ if invoice.amount_total < 0:
invoice.type = 'out_refund'
for line in invoice.invoice_line_ids:
line.quantity = -line.quantity
diff --git a/doc/cla/individual/ugaitzolaizola.md b/doc/cla/individual/ugaitzolaizola.md
new file mode 100644
index 00000000000..535dad871ab
--- /dev/null
+++ b/doc/cla/individual/ugaitzolaizola.md
@@ -0,0 +1,11 @@
+Spain, 2018-10-17
+
+I hereby agree to the terms of the Odoo Individual Contributor License
+Agreement v1.0.
+
+I declare that I am authorized and able to make this agreement and sign this
+declaration.
+
+Signed,
+
+Ugaitz Olaizola Arbelaitz uolaizola@binovo.es