summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-09-17 17:02:40 +0200
committerChristophe Simonis <chs@odoo.com>2018-09-17 17:02:40 +0200
commitf2b8caff07ba41b851ae9d5015e317753f3eb1a1 (patch)
treec15d51b41884f0e3bd8b196d94e74c7f6c69a001
parent5da419a4fef48b36857593dd08346c68b0ba74c5 (diff)
parent03b83abb7f2956ba20feb985c12f404a00398810 (diff)
[MERGE] forward port branch saas-15 up to 03b83abb7f2
-rw-r--r--addons/account_asset/models/account_asset.py9
-rw-r--r--addons/l10n_be_intrastat/wizard/xml_decl.py2
-rw-r--r--addons/point_of_sale/models/pos_order.py6
-rw-r--r--addons/point_of_sale/models/pos_session.py2
-rw-r--r--addons/report_intrastat/report/report_intrastat_report.py2
5 files changed, 17 insertions, 4 deletions
diff --git a/addons/account_asset/models/account_asset.py b/addons/account_asset/models/account_asset.py
index b589dbe7e3b..19d58a423b6 100644
--- a/addons/account_asset/models/account_asset.py
+++ b/addons/account_asset/models/account_asset.py
@@ -217,7 +217,14 @@ class AccountAssetAsset(models.Model):
# depreciation_date = 1st of January of purchase year if annual valuation, 1st of
# purchase month in other cases
if self.method_period >= 12:
- asset_date = datetime.strptime(self.date[:4] + '-01-01', DF).date()
+ if self.company_id.fiscalyear_last_month:
+ asset_date = date(year=int(self.date[:4]),
+ month=self.company_id.fiscalyear_last_month,
+ day=self.company_id.fiscalyear_last_day) + \
+ relativedelta(days=1) + \
+ relativedelta(year=int(self.date[:4])) # e.g. 2018-12-31 +1 -> 2019
+ else:
+ asset_date = datetime.strptime(self.date[:4] + '-01-01', DF).date()
else:
asset_date = datetime.strptime(self.date[:7] + '-01', DF).date()
# if we already have some previous validated entries, starting date isn't 1st January but last entry + method period
diff --git a/addons/l10n_be_intrastat/wizard/xml_decl.py b/addons/l10n_be_intrastat/wizard/xml_decl.py
index 989d7aa51c0..f5b9bdcf6b6 100644
--- a/addons/l10n_be_intrastat/wizard/xml_decl.py
+++ b/addons/l10n_be_intrastat/wizard/xml_decl.py
@@ -177,7 +177,7 @@ class XmlDeclaration(models.TransientModel):
if inv_line.invoice_id.intrastat_country_id:
excnt = inv_line.invoice_id.intrastat_country_id.code
else:
- excnt = inv_line.invoice_id.partner_id.country_id.code
+ excnt = inv_line.invoice_id.partner_shipping_id.country_id.code or inv_line.invoice_id.partner_id.country_id.code
#Check region
#If purchase, comes from purchase order, linked to a location,
diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py
index e5da2dd479f..cc32abc6fd3 100644
--- a/addons/point_of_sale/models/pos_order.py
+++ b/addons/point_of_sale/models/pos_order.py
@@ -462,6 +462,12 @@ class PosOrder(models.Model):
# for debugging and support purposes
_logger.exception('Reconciliation did not work for order %s', order.name)
+ def _filtered_for_reconciliation(self):
+ filter_states = ['invoiced', 'done']
+ if self.env['ir.config_parameter'].get_param('point_of_sale.order_reconcile_mode', 'all') == 'partner_only':
+ return self.filtered(lambda order: order.state in filter_states and order.partner_id)
+ return self.filtered(lambda order: order.state in filter_states)
+
def _default_session(self):
return self.env['pos.session'].search([('state', '=', 'opened'), ('user_id', '=', self.env.uid)], limit=1)
diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py
index f219847c8d7..a38505ab06a 100644
--- a/addons/point_of_sale/models/pos_session.py
+++ b/addons/point_of_sale/models/pos_session.py
@@ -38,7 +38,7 @@ class PosSession(models.Model):
paid=order.amount_paid,
))
order.action_pos_order_done()
- orders_to_reconcile = session.order_ids.filtered(lambda order: order.state in ['invoiced', 'done'] and order.partner_id)
+ orders_to_reconcile = session.order_ids._filtered_for_reconciliation()
orders_to_reconcile.sudo()._reconcile_payments()
config_id = fields.Many2one(
diff --git a/addons/report_intrastat/report/report_intrastat_report.py b/addons/report_intrastat/report/report_intrastat_report.py
index 40dd21df0a8..012fd84ea1b 100644
--- a/addons/report_intrastat/report/report_intrastat_report.py
+++ b/addons/report_intrastat/report/report_intrastat_report.py
@@ -66,7 +66,7 @@ class ReportIntrastat(models.Model):
left join report_intrastat_code intrastat on pt.intrastat_id = intrastat.id
left join (res_partner inv_address
left join res_country inv_country on (inv_country.id = inv_address.country_id))
- on (inv_address.id = inv.partner_id)
+ on (inv_address.id = coalesce(inv.partner_shipping_id, inv.partner_id))
where
inv.state in ('open','paid')
and inv_line.product_id is not null