[MERGE] forward port branch saas-15 up to 03b83abb7f
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user