diff --git a/addons/account/report/account_invoice_report.py b/addons/account/report/account_invoice_report.py index 1e051fa90a8..495a3f2088e 100644 --- a/addons/account/report/account_invoice_report.py +++ b/addons/account/report/account_invoice_report.py @@ -108,7 +108,7 @@ class AccountInvoiceReport(models.Model): 1 AS nbr, ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id AS account_line_id, ai.partner_bank_id, - SUM ((invoice_type.sign * ail.quantity) / u.factor * u2.factor) AS product_qty, + SUM ((invoice_type.sign_qty * ail.quantity) / u.factor * u2.factor) AS product_qty, SUM(ail.price_subtotal_signed * invoice_type.sign) AS price_total, SUM(ABS(ail.price_subtotal_signed)) / CASE WHEN SUM(ail.quantity / u.factor * u2.factor) <> 0::numeric @@ -137,7 +137,11 @@ class AccountInvoiceReport(models.Model): WHEN ai.type::text = ANY (ARRAY['in_refund'::character varying::text, 'in_invoice'::character varying::text]) THEN -1 ELSE 1 - END) AS sign + END) AS sign,(CASE + WHEN ai.type::text = ANY (ARRAY['out_refund'::character varying::text, 'in_invoice'::character varying::text]) + THEN -1 + ELSE 1 + END) AS sign_qty FROM account_invoice ai ) AS invoice_type ON invoice_type.id = ai.id """ diff --git a/addons/sale_timesheet/models/account.py b/addons/sale_timesheet/models/account.py index c880d88ea5c..2c15a829172 100644 --- a/addons/sale_timesheet/models/account.py +++ b/addons/sale_timesheet/models/account.py @@ -38,10 +38,10 @@ class AccountAnalyticLine(models.Model): return {} unit_amount = values.get('unit_amount', 0.0) or self.unit_amount user_id = values.get('user_id') or self.user_id.id or self._default_user() - project = values.get('project_id') and self.env['project.project'].browse([values['project_id']]) or self.project_id emp = self.env['hr.employee'].search([('user_id', '=', user_id)], limit=1) + account = values.get('account_id') and self.env['account.analytic.account'].browse([values['account_id']]) or self.account_id or emp.account_id cost = emp and emp.timesheet_cost or 0.0 - uom = project.company_id.project_time_mode_id + uom = account.company_id.sudo().project_time_mode_id # Nominal employee cost = 1 * company project UoM (project_time_mode_id) return { 'amount': -unit_amount * cost, diff --git a/odoo/addons/base/res/res_country_data.xml b/odoo/addons/base/res/res_country_data.xml index be6af58350f..3a1f07df536 100644 --- a/odoo/addons/base/res/res_country_data.xml +++ b/odoo/addons/base/res/res_country_data.xml @@ -1775,6 +1775,13 @@ + + Kosovo + xk + + + + Europe diff --git a/odoo/addons/base/static/img/country_flags/xk.png b/odoo/addons/base/static/img/country_flags/xk.png new file mode 100644 index 00000000000..cbabf92cdcf Binary files /dev/null and b/odoo/addons/base/static/img/country_flags/xk.png differ