From f5e145d2b9bc79553ea14876679b1677b59a1c0b Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Mon, 10 Sep 2018 17:03:33 +0200 Subject: [PATCH 1/5] [FIX] payment_stripe: regex to match so_ID Before this commit, when paying a confirmed SO with the token access with Stripe, Clicking on the button "pay now" wouldn't do anything, because the id of the SO couldn't be retrieved After this commit, the regex that does just that is more generic and the flow works OPW 1881192 closes #26884 --- addons/payment_stripe/static/src/js/stripe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/payment_stripe/static/src/js/stripe.js b/addons/payment_stripe/static/src/js/stripe.js index 4bbc57cfe9d..be767d31161 100644 --- a/addons/payment_stripe/static/src/js/stripe.js +++ b/addons/payment_stripe/static/src/js/stripe.js @@ -93,7 +93,7 @@ odoo.define('payment_stripe.stripe', function(require) { } var access_token = $("input[name='access_token']").val() || $("input[name='token']").val() || ''; - var so_id = $("input[name='return_url']").val().match(/quote\/([0-9]+)/) || undefined; + var so_id = $("input[name='return_url']").val().match(/[quote|order]s?\/([0-9]+)/) || undefined; if (so_id) { so_id = parseInt(so_id[1]); } From 816f386161f8903d000ffcce0b45de046e02d678 Mon Sep 17 00:00:00 2001 From: "Lucas Perais (lpe)" Date: Tue, 28 Aug 2018 09:53:01 +0200 Subject: [PATCH 2/5] [FIX] mail: action send mail no default_type Have a send email automated action on invoices upon validation (write) Go onto the credit notes, create one, and validate Before this commit, at the creation of the attachment (the invoice pdf), there was a traceback because default_type was in the context containing 'out_refund' And that attachments also have a field 'type' So the default_get of the latter got a value that wasn't correct for its field After this commit, we clean the context of the default_type context key since it is irrelevant beyond that point OPW 1868638 closes #26621 --- addons/mail/models/ir_actions.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/mail/models/ir_actions.py b/addons/mail/models/ir_actions.py index a8faa2703b8..12c04b38626 100644 --- a/addons/mail/models/ir_actions.py +++ b/addons/mail/models/ir_actions.py @@ -48,7 +48,11 @@ class ServerActions(models.Model): # TDE CLEANME: when going to new api with server action, remove action if not action.template_id or not self._context.get('active_id'): return False - action.template_id.send_mail(self._context.get('active_id'), force_send=False, raise_exception=False) + # Clean context from default_type to avoid making attachment + # with wrong values in subsequent operations + cleaned_ctx = dict(self.env.context) + cleaned_ctx.pop('default_type', None) + action.template_id.with_context(cleaned_ctx).send_mail(self._context.get('active_id'), force_send=False, raise_exception=False) return False @api.model From 097963624f565d480f70aa9615fbff6a25745f28 Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Mon, 10 Sep 2018 14:26:09 +0200 Subject: [PATCH 3/5] [FIX] stock: prevent location change Changing the partner on a picking triggers an onchange which might modify `location_id` or `location_dest_id`. However, when the picking is not draft anymore, these fields are not supposed to be changed. opw-1872635 --- addons/stock/models/stock_picking.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 1638d1d4356..47828768f1e 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -470,8 +470,9 @@ class Picking(models.Model): else: location_dest_id, supplierloc = self.env['stock.warehouse']._get_partner_locations() - self.location_id = location_id - self.location_dest_id = location_dest_id + if self.state == 'draft': + self.location_id = location_id + self.location_dest_id = location_dest_id # TDE CLEANME move into onchange_partner_id if self.partner_id: if self.partner_id.picking_warn == 'no-message' and self.partner_id.parent_id: From 1b475753723c81f46414357dfd449a47fe342dff Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Thu, 6 Sep 2018 11:14:01 +0200 Subject: [PATCH 4/5] [FIX] account: cash basis in statement - Set up a 10 % tax with a 'Tax Due' as 'Based on Payment' - Create a bank statement of 110, Reconcile - Create a new AML for the reconciliation using the mentioned tax for an amount of 100 - Validate The tax amount does not appear in the Generic Tax Report. This is a specific case where the reconciliation process creates the payment itself. Therefore, the tax amount should appear in the report. To do so, we explicitly send the `tax_exigible` value on the AML, and propagate it to the tax line. opw-1858492 --- addons/account/models/account.py | 1 + addons/account/models/account_move.py | 2 ++ .../static/src/js/reconciliation/reconciliation_model.js | 2 ++ 3 files changed, 5 insertions(+) diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 4642cacd9b5..0a274a89275 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -994,6 +994,7 @@ class AccountTax(models.Model): 'refund_account_id': tax.refund_account_id.id, 'analytic': tax.analytic, 'price_include': tax.price_include, + 'tax_exigibility': tax.tax_exigibility, }) return { diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 67ec719a655..ca1dfbd98a2 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -1313,6 +1313,8 @@ class AccountMoveLine(models.Model): ctx['date'] = vals['date'] temp['currency_id'] = bank.currency_id.id temp['amount_currency'] = bank.company_id.currency_id.with_context(ctx).compute(tax_vals['amount'], bank.currency_id, round=True) + if vals.get('tax_exigible'): + temp['tax_exigible'] = True tax_lines_vals.append(temp) #Toggle the 'tax_exigible' field to False in case it is not yet given and the tax in 'tax_line_id' or one of diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 538b8c83369..9748f6c63e3 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -819,6 +819,7 @@ var StatementModel = BasicModel.extend({ prop.computed_with_tax = tax.price_include prop.tax_amount = tax.amount + prop.tax_exigible = tax.tax_exigibility === 'on_payment' ? true : undefined prop.amount = tax.base; prop.amount_str = field_utils.format.monetary(Math.abs(prop.amount), {}, formatOptions); prop.invalid = !self._isValid(prop); @@ -1105,6 +1106,7 @@ var StatementModel = BasicModel.extend({ name : prop.label, debit : amount > 0 ? amount : 0, credit : amount < 0 ? -amount : 0, + tax_exigible: prop.tax_exigible, // This one isn't usefull for the server, // But since we need to change the amount (and thus its semantics) into base_amount // It might be useful to have a trace in the RPC for debugging purposes From 5a1f874602ee649dfedf01c1be8f33d133677d00 Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 11 Sep 2018 11:24:49 +0200 Subject: [PATCH 5/5] [FIX] base_address_extended: contact address is not updated When the module "base_address_extended" was installed, the contact addresses of a company were not updated when the company address was updated. opw:1879968 --- addons/base_address_extended/models/base_address_extended.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/addons/base_address_extended/models/base_address_extended.py b/addons/base_address_extended/models/base_address_extended.py index fe5ff88019b..052a461814f 100644 --- a/addons/base_address_extended/models/base_address_extended.py +++ b/addons/base_address_extended/models/base_address_extended.py @@ -33,6 +33,11 @@ class Partner(models.Model): street_number2 = fields.Char('Door Number', compute='_split_street', inverse='_set_street', store=True) + @api.model + def _address_fields(self): + """Returns the list of address fields that are synced from the parent.""" + return super(Partner, self)._address_fields() + ['street_name', 'street_number', 'street_number2'] + def get_street_fields(self): """Returns the fields that can be used in a street format. Overwrite this function if you want to add your own fields."""