Skip to content

Commit

Permalink
Cherry pick of b0c5370 failed
Browse files Browse the repository at this point in the history
stdout:

stderr:

closes odoo#48197

Error: could not apply b0c5370... Revert "[FIX] web, purchase, sale: fix no currency in calendar view"
Hint: after resolving the conflicts, mark the corrected paths
Hint: with 'git add <paths>' or 'git rm <paths>'
Hint: and commit the result with 'git commit'
X-original-commit: e8d6f1e
Signed-off-by: Nicolas Lempereur (nle) <[email protected]>
Signed-off-by: Jason Van Malder (jvm) <[email protected]>
  • Loading branch information
fw-bot authored and jvm-odoo committed Mar 23, 2020
1 parent 1e35fff commit 94fee8a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions addons/purchase/views/purchase_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="Calendar View" date_start="date_planned" color="partner_id" hide_time="true" event_limit="5">
<field name="currency_id" invisible="1"/>
<field name="name"/>
<field name="partner_ref"/>
<field name="amount_total" widget="monetary"/>
Expand Down
1 change: 1 addition & 0 deletions addons/sale/views/sale_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
<field name="model">sale.order</field>
<field name="arch" type="xml">
<calendar string="Sales Orders" date_start="date_order" color="state" hide_time="true" event_limit="5">
<field name="currency_id" invisible="1"/>
<field name="partner_id" avatar_field="image_128"/>
<field name="amount_total" widget="monetary"/>
<field name="payment_term_id"/>
Expand Down
14 changes: 12 additions & 2 deletions addons/web/static/src/js/views/calendar/calendar_popover.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ var CalendarPopover = Widget.extend(StandaloneFieldManagerMixin, {
_processFields: function () {
var self = this;
var fieldsToGenerate = [];
_.each(this.displayFields, function (displayFieldInfo, fieldName) {
var fields = _.keys(this.displayFields);
for (var i=0; i<fields.length; i++) {
var fieldName = fields[i];
var displayFieldInfo = self.displayFields[fieldName] || {attrs: {invisible: 1}};
var fieldInfo = self.fields[fieldName];
var field = {
name: fieldName,
Expand All @@ -93,6 +96,12 @@ var CalendarPopover = Widget.extend(StandaloneFieldManagerMixin, {
if (field.type === 'selection') {
field.selection = fieldInfo.selection;
}
if (field.type === 'monetary') {
var currencyField = field.currency_field || 'currency_id';
if (!fields.includes(currencyField) && _.has(self.event.record, currencyField)) {
fields.push(currencyField);
}
}
if (fieldInfo.relation) {
field.relation = fieldInfo.relation;
}
Expand All @@ -111,14 +120,15 @@ var CalendarPopover = Widget.extend(StandaloneFieldManagerMixin, {
}];
}
fieldsToGenerate.push(field);
});
};

this.$fieldsList = [];
return this.model.makeRecord(this.modelName, fieldsToGenerate).then(function (recordID) {
var defs = [];

var record = self.model.get(recordID);
_.each(fieldsToGenerate, function (field) {
if (field.invisible) return;
var FieldClass = fieldRegistry.getAny([field.widget, field.type]);
var fieldWidget = new FieldClass(self, field.name, record, self.displayFields[field.name]);
self._registerWidget(recordID, field.name, fieldWidget);
Expand Down

0 comments on commit 94fee8a

Please sign in to comment.