diff --git a/addons/account/wizard/wizard_tax_adjustments.py b/addons/account/wizard/wizard_tax_adjustments.py index 8c5002347c0..22d2235ef04 100644 --- a/addons/account/wizard/wizard_tax_adjustments.py +++ b/addons/account/wizard/wizard_tax_adjustments.py @@ -18,24 +18,26 @@ class TaxAdjustments(models.TransientModel): debit_account_id = fields.Many2one('account.account', string='Debit account', required=True, domain=[('deprecated', '=', False)]) credit_account_id = fields.Many2one('account.account', string='Credit account', required=True, domain=[('deprecated', '=', False)]) amount = fields.Monetary(currency_field='company_currency_id', required=True) + adjustment_type = fields.Selection([('debit', 'Adjustment in favor of the Estate'), ('credit', 'Adjustment in your favor')], string="Adjustment Type", store=False, required=True) company_currency_id = fields.Many2one('res.currency', readonly=True, default=lambda self: self.env.user.company_id.currency_id) tax_id = fields.Many2one('account.tax', string='Adjustment Tax', ondelete='restrict', domain=[('type_tax_use', '=', 'none'), ('tax_adjustment', '=', True)], required=True) @api.multi def _create_move(self): + adjustment_type = self.env.context.get('adjustment_type', (self.amount > 0.0 and 'debit' or 'credit')) debit_vals = { 'name': self.reason, - 'debit': self.amount, + 'debit': abs(self.amount), 'credit': 0.0, 'account_id': self.debit_account_id.id, - 'tax_line_id': self.tax_id.id, + 'tax_line_id': adjustment_type == 'debit' and self.tax_id.id or False, } credit_vals = { 'name': self.reason, 'debit': 0.0, - 'credit': self.amount, + 'credit': abs(self.amount), 'account_id': self.credit_account_id.id, - 'tax_line_id': self.tax_id.id, + 'tax_line_id': adjustment_type == 'credit' and self.tax_id.id or False, } vals = { 'journal_id': self.journal_id.id, @@ -48,6 +50,13 @@ class TaxAdjustments(models.TransientModel): return move.id @api.multi + def create_move_debit(self): + return self.with_context(adjustment_type='debit').create_move() + + @api.multi + def create_move_credit(self): + return self.with_context(adjustment_type='credit').create_move() + def create_move(self): #create the adjustment move move_id = self._create_move() diff --git a/addons/account/wizard/wizard_tax_adjustments_view.xml b/addons/account/wizard/wizard_tax_adjustments_view.xml index 3d4ed0a9e9a..dba164388b9 100644 --- a/addons/account/wizard/wizard_tax_adjustments_view.xml +++ b/addons/account/wizard/wizard_tax_adjustments_view.xml @@ -12,6 +12,7 @@ + @@ -26,8 +27,14 @@ diff --git a/addons/account_asset/models/account_asset.py b/addons/account_asset/models/account_asset.py index 78cd786cda8..52d2c48a0d9 100644 --- a/addons/account_asset/models/account_asset.py +++ b/addons/account_asset/models/account_asset.py @@ -411,7 +411,7 @@ class AccountAssetAsset(models.Model): @api.model def create(self, vals): asset = super(AccountAssetAsset, self.with_context(mail_create_nolog=True)).create(vals) - asset.compute_depreciation_board() + asset.sudo().compute_depreciation_board() return asset @api.multi diff --git a/addons/hr_timesheet/report/report_timesheet_templates.xml b/addons/hr_timesheet/report/report_timesheet_templates.xml index 141eb0511e8..c706143dd93 100644 --- a/addons/hr_timesheet/report/report_timesheet_templates.xml +++ b/addons/hr_timesheet/report/report_timesheet_templates.xml @@ -36,7 +36,7 @@ - + @@ -72,4 +72,4 @@ name="hr_timesheet.report_timesheet" file="report_timesheet" /> - \ No newline at end of file + diff --git a/addons/payment_stripe/models/payment.py b/addons/payment_stripe/models/payment.py index 6cd4899bfc1..ca6a8d5f592 100644 --- a/addons/payment_stripe/models/payment.py +++ b/addons/payment_stripe/models/payment.py @@ -109,7 +109,7 @@ class PaymentTransactionStripe(models.Model): @api.multi def stripe_s2s_do_transaction(self, **kwargs): self.ensure_one() - result = self._create_stripe_charge(acquirer_ref=self.payment_token_id.acquirer_ref) + result = self._create_stripe_charge(acquirer_ref=self.payment_token_id.acquirer_ref, email=self.partner_email) return self._stripe_s2s_validate_tree(result) @api.model diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 6e12dc8b114..25b31fd0b8f 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1152,7 +1152,8 @@ exports.Orderline = Backbone.Model.extend({ if (unit.rounding) { this.quantity = round_pr(quant, unit.rounding); var decimals = this.pos.dp['Product Unit of Measure']; - this.quantityStr = formats.format_value(round_di(this.quantity, decimals), { type: 'float', digits: [69, decimals]}); + this.quantity = round_di(this.quantity, decimals) + this.quantityStr = formats.format_value(this.quantity, { type: 'float', digits: [69, decimals]}); } else { this.quantity = round_pr(quant, 1); this.quantityStr = this.quantity.toFixed(0); diff --git a/addons/pos_mercury/data/pos_mercury_demo.xml b/addons/pos_mercury/data/pos_mercury_demo.xml index 5ff1a0d70e4..b242868f8df 100644 --- a/addons/pos_mercury/data/pos_mercury_demo.xml +++ b/addons/pos_mercury/data/pos_mercury_demo.xml @@ -5,8 +5,8 @@ Mercury Demo - 334160 - 81303DUR + 755847002 + xyz diff --git a/addons/pos_mercury/models/pos_mercury.py b/addons/pos_mercury/models/pos_mercury.py index 707f85692e0..6af9d437af9 100644 --- a/addons/pos_mercury/models/pos_mercury.py +++ b/addons/pos_mercury/models/pos_mercury.py @@ -4,6 +4,7 @@ import logging from odoo import models, fields, api, _ +from odoo.tools.float_utils import float_compare _logger = logging.getLogger(__name__) @@ -71,8 +72,9 @@ class PosOrder(models.Model): statement_id = super(PosOrder, self).add_payment(data) statement_lines = self.env['account.bank.statement.line'].search([('statement_id', '=', statement_id), ('pos_statement_id', '=', self.id), - ('journal_id', '=', data['journal']), - ('amount', '=', data['amount'])]) + ('journal_id', '=', data['journal'])]) + statement_lines = statement_lines.filtered(lambda line: float_compare(line.amount, data['amount'], + precision_rounding=line.journal_currency_id.rounding) == 0) # we can get multiple statement_lines when there are >1 credit # card payments with the same amount. In that case it doesn't diff --git a/addons/pos_mercury/models/pos_mercury_transaction.py b/addons/pos_mercury/models/pos_mercury_transaction.py index cca78872ac5..4d8da0b9a98 100644 --- a/addons/pos_mercury/models/pos_mercury_transaction.py +++ b/addons/pos_mercury/models/pos_mercury_transaction.py @@ -63,7 +63,11 @@ class MercuryTransaction(models.Model): 'SOAPAction': 'http://www.mercurypay.com/CreditTransaction', } - r = urllib2.Request('https://w1.mercurypay.com/ws/ws.asmx', data=xml_transaction, headers=headers) + url = 'https://w1.mercurypay.com/ws/ws.asmx' + if self.env['ir.config_parameter'].sudo().get_param('pos_mercury.enable_test_env'): + url = 'https://w1.mercurycert.net/ws/ws.asmx' + + r = urllib2.Request(url, data=xml_transaction, headers=headers) try: u = urllib2.urlopen(r, timeout=65) response = werkzeug.utils.unescape(u.read()) diff --git a/addons/sale/models/account_invoice.py b/addons/sale/models/account_invoice.py index 1ed8cda461b..a0b1a51cde1 100644 --- a/addons/sale/models/account_invoice.py +++ b/addons/sale/models/account_invoice.py @@ -39,6 +39,9 @@ class AccountInvoice(models.Model): def _onchange_delivery_address(self): addr = self.partner_id.address_get(['delivery']) self.partner_shipping_id = addr and addr.get('delivery') + if self.env.context.get('type', 'out_invoice') == 'out_invoice': + company = self.company_id or self.env.user.company_id + self.comment = company.with_context(lang=self.partner_id.lang).sale_note @api.multi def action_invoice_paid(self): diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py index ac7d9587d22..c04685a84aa 100644 --- a/addons/sale/wizard/sale_make_invoice_advance.py +++ b/addons/sale/wizard/sale_make_invoice_advance.py @@ -65,7 +65,7 @@ class SaleAdvancePaymentInv(models.TransientModel): account_id = False if self.product_id.id: - account_id = self.product_id.property_account_income_id.id + account_id = self.product_id.property_account_income_id.id or self.product_id.categ_id.property_account_income_categ_id.id if not account_id: inc_acc = ir_property_obj.get('property_account_income_categ_id', 'product.category') account_id = order.fiscal_position_id.map_account(inc_acc).id if inc_acc else False diff --git a/addons/stock/report/report_location_barcode.xml b/addons/stock/report/report_location_barcode.xml index d67481ddbb9..a2c306c80b7 100644 --- a/addons/stock/report/report_location_barcode.xml +++ b/addons/stock/report/report_location_barcode.xml @@ -9,8 +9,8 @@