summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2017-02-10 11:21:14 +0100
committerChristophe Simonis <chs@odoo.com>2017-02-10 11:21:14 +0100
commit06e9e45d03680b84d4f3b9aec016cf0b28b6d2cd (patch)
tree50bdfe57f7f39ef53ac50073cd40d2971c7b24ee /addons
parentbd01714388d1bf145f7c6af8203a6e579e8a19f8 (diff)
parent6f29e7307e8a393223fa81a456378aaf47fe8dc3 (diff)
[MERGE] forward port branch 9.0 up to 6f29e7307e8
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/account_invoice.py8
-rw-r--r--addons/account/models/account_move.py25
-rw-r--r--addons/account/models/account_payment.py2
-rw-r--r--addons/account/views/account_view.xml1
-rw-r--r--addons/crm/data/sales_config_settings_data.xml4
-rw-r--r--addons/crm_partner_assign/crm_partner_assign.py2
-rw-r--r--addons/point_of_sale/models/pos_order.py9
-rw-r--r--addons/point_of_sale/static/src/xml/pos.xml2
-rw-r--r--addons/point_of_sale/views/pos_order_report_view.xml2
9 files changed, 41 insertions, 14 deletions
diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py
index d6d7be96a27..dfa950d8ca9 100644
--- a/addons/account/models/account_invoice.py
+++ b/addons/account/models/account_invoice.py
@@ -475,7 +475,7 @@ class AccountInvoice(models.Model):
account_id = pay_account.id
payment_term_id = p.property_supplier_payment_term_id.id
fiscal_position = p.property_account_position_id.id
- bank_id = p.bank_ids and p.bank_ids.ids[0] or False
+
# If partner has no warning, check its company
if p.invoice_warn == 'no-message' and p.parent_id:
@@ -496,8 +496,12 @@ class AccountInvoice(models.Model):
self.payment_term_id = payment_term_id
self.fiscal_position_id = fiscal_position
- if type in ('in_invoice', 'in_refund'):
+ if type in ('in_invoice', 'out_refund'):
+ bank_ids = p.commercial_partner_id.bank_ids
+ bank_id = bank_ids[0].id if bank_ids else False
self.partner_bank_id = bank_id
+ return {'domain': {'partner_bank_id': [('id', 'in', bank_ids.ids)]}}
+ return {}
@api.onchange('journal_id')
diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py
index e039f31353a..365095cfc5e 100644
--- a/addons/account/models/account_move.py
+++ b/addons/account/models/account_move.py
@@ -695,22 +695,37 @@ class AccountMoveLine(models.Model):
line_currency = (line.currency_id and line.amount_currency) and line.currency_id or company_currency
amount_currency_str = ""
total_amount_currency_str = ""
- if line_currency != company_currency and target_currency != company_currency:
+ if line_currency != company_currency and target_currency == line_currency:
+ # The payment currency is the invoice currency, but they are different than the company currency
+ # We use the `amount_currency` computed during the invoice validation, at the invoice date
+ # to avoid exchange gain/loss
+ # e.g. an invoice of 100€ must be paid with 100€, whatever the company currency and the exchange rates
total_amount = line.amount_currency
actual_debit = debit > 0 and amount_currency or 0.0
actual_credit = credit > 0 and -amount_currency or 0.0
+ currency = line_currency
else:
+ # Either:
+ # - the invoice, payment, company currencies are all the same,
+ # - the payment currency is the company currency, but the invoice currency is different,
+ # - the invoice currency is the company currency, but the payment currency is different,
+ # - the invoice, payment and company currencies are all different.
+ # For the two first cases, we can simply use the debit/credit of the invoice move line, which are always in the company currency,
+ # and this is what the target need.
+ # For the two last cases, we can use the debit/credit which are in the company currency, and then change them to the target currency
total_amount = abs(debit - credit)
actual_debit = debit > 0 and amount or 0.0
actual_credit = credit > 0 and -amount or 0.0
- if line_currency != target_currency and target_currency != company_currency:
+ currency = company_currency
+ if line_currency != target_currency:
amount_currency_str = formatLang(self.env, abs(actual_debit or actual_credit), currency_obj=line_currency)
total_amount_currency_str = formatLang(self.env, total_amount, currency_obj=line_currency)
+ if currency != target_currency:
ctx = context.copy()
ctx.update({'date': target_date or line.date})
- total_amount = line_currency.with_context(ctx).compute(total_amount, target_currency)
- actual_debit = line_currency.with_context(ctx).compute(actual_debit, target_currency)
- actual_credit = line_currency.with_context(ctx).compute(actual_credit, target_currency)
+ total_amount = currency.with_context(ctx).compute(total_amount, target_currency)
+ actual_debit = currency.with_context(ctx).compute(actual_debit, target_currency)
+ actual_credit = currency.with_context(ctx).compute(actual_credit, target_currency)
amount_str = formatLang(self.env, abs(actual_debit or actual_credit), currency_obj=target_currency)
total_amount_str = formatLang(self.env, total_amount, currency_obj=target_currency)
diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py
index dde50d41683..3a15fe24de8 100644
--- a/addons/account/models/account_payment.py
+++ b/addons/account/models/account_payment.py
@@ -388,7 +388,7 @@ class account_payment(models.Model):
# the writeoff debit and credit must be computed from the invoice residual in company currency
# minus the payment amount in company currency, and not from the payment difference in the payment currency
# to avoid loss of precision during the currency rate computations. See revision 20935462a0cabeb45480ce70114ff2f4e91eaf79 for a detailed example.
- total_residual_company_signed = self._compute_total_invoices_amount()
+ total_residual_company_signed = sum(invoice.residual_company_signed for invoice in self.invoice_ids)
total_payment_company_signed = self.currency_id.with_context(date=self.payment_date).compute(self.amount, self.company_id.currency_id)
if self.invoice_ids[0].type in ['in_invoice', 'out_refund']:
amount_wo = total_payment_company_signed - total_residual_company_signed
diff --git a/addons/account/views/account_view.xml b/addons/account/views/account_view.xml
index 2e4f132f27b..0658be752d7 100644
--- a/addons/account/views/account_view.xml
+++ b/addons/account/views/account_view.xml
@@ -1118,7 +1118,6 @@
<field name="move_id" required="False"/>
<newline/>
<field name="date_maturity"/>
- <field name="date"/>
<field name="blocked"/>
<newline/>
<field name="tax_ids" readonly="1"/>
diff --git a/addons/crm/data/sales_config_settings_data.xml b/addons/crm/data/sales_config_settings_data.xml
index 61bda872c46..331fe0514dc 100644
--- a/addons/crm/data/sales_config_settings_data.xml
+++ b/addons/crm/data/sales_config_settings_data.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
-
+ <data noupdate='1'>
<function id="default_generate_sales_team_alias"
model="ir.values" name="set_default"
eval="('sales.config.settings', 'generate_sales_team_alias', True)"/>
-
+ </data>
</odoo>
diff --git a/addons/crm_partner_assign/crm_partner_assign.py b/addons/crm_partner_assign/crm_partner_assign.py
index 433a3bdd5b9..48ca171dd58 100644
--- a/addons/crm_partner_assign/crm_partner_assign.py
+++ b/addons/crm_partner_assign/crm_partner_assign.py
@@ -14,7 +14,7 @@ class res_partner_grade(osv.osv):
_columns = {
'sequence': fields.integer('Sequence'),
'active': fields.boolean('Active'),
- 'name': fields.char('Level Name'),
+ 'name': fields.char('Level Name', translate=True),
'partner_weight': fields.integer('Level Weight',
help="Gives the probability to assign a lead to this partner. (0 means no assignation.)"),
}
diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py
index 77a3c91ec7c..fd2794b9d35 100644
--- a/addons/point_of_sale/models/pos_order.py
+++ b/addons/point_of_sale/models/pos_order.py
@@ -197,6 +197,7 @@ class PosOrder(models.Model):
grouped_data = {}
have_to_group_by = session and session.config_id.group_by or False
+ rounding_method = session and session.config_id.company_id.tax_calculation_rounding_method
for order in self.filtered(lambda o: not o.account_move or order.state == 'paid'):
current_company = order.sale_journal.company_id
@@ -303,6 +304,14 @@ class PosOrder(models.Model):
'partner_id': partner_id
})
+ # round tax lines per order
+ if rounding_method == 'round_globally':
+ for group_key, group_value in grouped_data.iteritems():
+ if group_key[0] == 'tax':
+ for line in group_value:
+ line['credit'] = cur.round(line['credit'])
+ line['debit'] = cur.round(line['debit'])
+
# counterpart
insert_data('counter_part', {
'name': _("Trade Receivables"), # order.name,
diff --git a/addons/point_of_sale/static/src/xml/pos.xml b/addons/point_of_sale/static/src/xml/pos.xml
index bdfbb6d94bd..27966c44edd 100644
--- a/addons/point_of_sale/static/src/xml/pos.xml
+++ b/addons/point_of_sale/static/src/xml/pos.xml
@@ -336,7 +336,7 @@
</div>
<div class='client-detail'>
<span class='label'>Country</span>
- <select class='detail client-address-country' name='country_id'>
+ <select class='detail client-address-country needsclick' name='country_id'>
<option value=''>None</option>
<t t-foreach='widget.pos.countries' t-as='country'>
<option t-att-value='country.id' t-att-selected="partner.country_id ? ((country.id === partner.country_id[0]) ? true : undefined) : undefined">
diff --git a/addons/point_of_sale/views/pos_order_report_view.xml b/addons/point_of_sale/views/pos_order_report_view.xml
index 148b4e2b0bf..86a101bdde5 100644
--- a/addons/point_of_sale/views/pos_order_report_view.xml
+++ b/addons/point_of_sale/views/pos_order_report_view.xml
@@ -4,7 +4,7 @@
<field name="name">report.pos.order.pivot</field>
<field name="model">report.pos.order</field>
<field name="arch" type="xml">
- <pivot string="Point of Sale Analysis">
+ <pivot string="Point of Sale Analysis" disable_linking="True">
<field name="product_categ_id" type="row"/>
<field name="date" interval="month" type="col"/>
<field name="product_qty" type="measure"/>