Skip to content

Commit ed901be

Browse files
committed
[MERGE] forward port branch saas-16 up to 80f916e
2 parents 2dea77f + 80f916e commit ed901be

File tree

21 files changed

+268
-27
lines changed

21 files changed

+268
-27
lines changed

addons/account/i18n/account.pot

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9688,6 +9688,12 @@ msgstr ""
96889688
msgid "You have"
96899689
msgstr ""
96909690

9691+
#. module: account
9692+
#: code:addons/account/models/account_payment.py:360
9693+
#, python-format
9694+
msgid "You have to define a sequence for %s in your company."
9695+
msgstr ""
9696+
96919697
#. module: account
96929698
#: code:addons/account/wizard/account_report_general_ledger.py:21
96939699
#, python-format

addons/account/models/account_invoice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _compute_residual(self):
116116
def _get_outstanding_info_JSON(self):
117117
self.outstanding_credits_debits_widget = json.dumps(False)
118118
if self.state == 'open':
119-
domain = [('account_id', '=', self.account_id.id), ('partner_id', '=', self.env['res.partner']._find_accounting_partner(self.partner_id).id), ('reconciled', '=', False), ('amount_residual', '!=', 0.0)]
119+
domain = [('account_id', '=', self.account_id.id), ('partner_id', '=', self.env['res.partner']._find_accounting_partner(self.partner_id).id), ('reconciled', '=', False), '|', ('amount_residual', '!=', 0.0), ('amount_residual_currency', '!=', 0.0)]
120120
if self.type in ('out_invoice', 'in_refund'):
121121
domain.extend([('credit', '>', 0), ('debit', '=', 0)])
122122
type_payment = _('Outstanding credits')

addons/account/models/account_payment.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,8 @@ def post(self):
455455
if rec.payment_type == 'outbound':
456456
sequence_code = 'account.payment.supplier.invoice'
457457
rec.name = self.env['ir.sequence'].with_context(ir_sequence_date=rec.payment_date).next_by_code(sequence_code)
458+
if not rec.name and self.payment_type != 'transfer':
459+
raise UserError(_("You have to define a sequence for %s in your company.") % (sequence_code,))
458460

459461
# Create the journal entry
460462
amount = rec.amount * (rec.payment_type in ('outbound', 'transfer') and 1 or -1)

addons/account/report/account_invoice_report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def _sub_select(self):
110110
ai.type, ai.state, pt.categ_id, ai.date_due, ai.account_id, ail.account_id AS account_line_id,
111111
ai.partner_bank_id,
112112
SUM ((invoice_type.sign * ail.quantity) / u.factor * u2.factor) AS product_qty,
113-
SUM(ail.price_subtotal_signed) AS price_total,
113+
SUM(ail.price_subtotal_signed * invoice_type.sign) AS price_total,
114114
SUM(ABS(ail.price_subtotal_signed)) / CASE
115115
WHEN SUM(ail.quantity / u.factor * u2.factor) <> 0::numeric
116116
THEN SUM(ail.quantity / u.factor * u2.factor)

addons/l10n_mx/models/chart_template.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def generate_journals(self, acc_template_ref, company, journals_dict=None):
1616
if not self == self.env.ref('l10n_mx.mx_coa'):
1717
return res
1818
journal_basis = self.env['account.journal'].search([
19+
('company_id', '=', company.id),
1920
('type', '=', 'general'),
2021
('code', '=', 'CBMX')], limit=1)
2122
company.write({'tax_cash_basis_journal_id': journal_basis.id})

addons/mass_mailing/models/mass_mailing_stats.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class MailMailStats(models.Model):
2020
string='Mail ID (tech)',
2121
help='ID of the related mail_mail. This field is an integer field because '
2222
'the related mail_mail can be deleted separately from its statistics. '
23-
'However the ID is needed for several action and controllers.'
23+
'However the ID is needed for several action and controllers.',
24+
index=True,
2425
)
2526
message_id = fields.Char(string='Message-ID')
2627
model = fields.Char(string='Document model')

addons/purchase/models/stock.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ def _create_backorder(self, backorder_moves=[]):
1616
res = super(StockPicking, self)._create_backorder(backorder_moves)
1717
for picking in self:
1818
if picking.picking_type_id.code == 'incoming':
19-
backorder = self.search([('backorder_id', '=', picking.id)])
20-
backorder.message_post_with_view('mail.message_origin_link',
21-
values={'self': backorder, 'origin': backorder.purchase_id},
22-
subtype_id=self.env.ref('mail.mt_note').id)
19+
for backorder in self.search([('backorder_id', '=', picking.id)]):
20+
backorder.message_post_with_view('mail.message_origin_link',
21+
values={'self': backorder, 'origin': backorder.purchase_id},
22+
subtype_id=self.env.ref('mail.mt_note').id)
2323
return res
2424

2525

addons/web/static/src/js/fields/relational_fields.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,12 @@ var FieldMany2One = AbstractField.extend({
9393
this._super.apply(this, arguments);
9494
this.limit = 7;
9595
this.orderer = new concurrency.DropMisordered();
96-
this.can_create = ('can_create' in this.attrs ? this.attrs.can_create : true) && !this.nodeOptions.no_create;
97-
this.can_write = 'can_write' in this.attrs ? this.attrs.can_write : true;
96+
97+
// should normally also be set, except in standalone M20
98+
this.can_create = ('can_create' in this.attrs ? JSON.parse(this.attrs.can_create) : true) &&
99+
!this.nodeOptions.no_create;
100+
this.can_write = 'can_write' in this.attrs ? JSON.parse(this.attrs.can_write) : true;
101+
98102
this.nodeOptions = _.defaults(this.nodeOptions, {
99103
quick_create: true,
100104
});

addons/web/static/src/js/fields/upgrade_fields.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ var AbstractFieldUpgrade = {
5252
*
5353
* @abstract
5454
* @private
55-
* @param {JQuery} the 'Enterprise' label to insert
55+
* @param {jQuery} $enterpriseLabel the 'Enterprise' label to insert
5656
*/
57-
_insertEnterpriseLabel: function ($enterprise_label) {},
57+
_insertEnterpriseLabel: function ($enterpriseLabel) {},
5858
/**
5959
* Opens the Upgrade dialog.
6060
*
@@ -127,6 +127,15 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, {
127127
events: _.extend({}, AbstractField.prototype.events, {
128128
'click input': '_onInputClicked',
129129
}),
130+
/**
131+
* Re-renders the widget with the label
132+
*
133+
* @param {jQuery} $label
134+
*/
135+
renderWithLabel: function ($label) {
136+
this.$label = $label;
137+
this._render();
138+
},
130139

131140
//--------------------------------------------------------------------------
132141
// Private
@@ -136,8 +145,9 @@ var UpgradeBoolean = FieldBoolean.extend(AbstractFieldUpgrade, {
136145
* @override
137146
* @private
138147
*/
139-
_insertEnterpriseLabel: function ($enterprise_label) {
140-
this.$el.append('&nbsp;').append($enterprise_label);
148+
_insertEnterpriseLabel: function ($enterpriseLabel) {
149+
var $el = this.$label || this.$el;
150+
$el.append('&nbsp;').append($enterpriseLabel);
141151
},
142152
/**
143153
* @override
@@ -170,8 +180,8 @@ var UpgradeRadio = FieldRadio.extend(AbstractFieldUpgrade, {
170180
* @override
171181
* @private
172182
*/
173-
_insertEnterpriseLabel: function ($enterprise_label) {
174-
this.$('label').last().append('&nbsp;').append($enterprise_label);
183+
_insertEnterpriseLabel: function ($enterpriseLabel) {
184+
this.$('label').last().append('&nbsp;').append($enterpriseLabel);
175185
},
176186
/**
177187
* @override

addons/web/static/src/js/views/form/form_renderer.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,11 +808,16 @@ var FormRenderer = BasicRenderer.extend({
808808

809809
// Attach the tooltips on the fields' label
810810
_.each(this.allFieldWidgets[this.state.id], function (widget) {
811+
var idForLabel = self.idsForLabels[widget.name];
812+
var $label = idForLabel ? self.$('label[for=' + idForLabel + ']') : $();
811813
if (core.debug || widget.attrs.help || widget.field.help) {
812-
var idForLabel = self.idsForLabels[widget.name];
813-
var $label = idForLabel ? self.$('label[for=' + idForLabel + ']') : $();
814814
self._addFieldTooltip(widget, $label);
815815
}
816+
if (widget.attrs.widget === 'upgrade_boolean') {
817+
// this widget needs a reference to its $label to be correctly
818+
// rendered
819+
widget.renderWithLabel($label);
820+
}
816821
});
817822
},
818823
/**

0 commit comments

Comments
 (0)