Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

issue #19840: quote boxes in prospect, customer, opportunity #230

Merged
merged 21 commits into from

2 participants

@shackbarth

No description provided.

@mikerodonnell89 mikerodonnell89 merged commit 1b2b6f5 into xtuple:master
@mikerodonnell89

Maybe we should disable the attach/detach button?

@shackbarth shackbarth deleted the shackbarth:19840 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. @mikerodonnell89
Commits on Mar 27, 2013
  1. @mikerodonnell89

    Merge pull request #54 from xtuple/master

    mikerodonnell89 authored
    quote should work
Commits on Mar 28, 2013
  1. @mikerodonnell89
  2. @mikerodonnell89

    Merge pull request #55 from xtuple/master

    mikerodonnell89 authored
    catching up
  3. @mikerodonnell89
  4. @mikerodonnell89

    Merge branch 'xtuple'

    mikerodonnell89 authored
  5. @mikerodonnell89
  6. @mikerodonnell89
  7. @mikerodonnell89
  8. @mikerodonnell89
  9. @mikerodonnell89
Commits on Mar 29, 2013
  1. @mikerodonnell89
  2. @mikerodonnell89

    Merge branch 'xtuple'

    mikerodonnell89 authored
Commits on Apr 1, 2013
  1. @mikerodonnell89

    Merge branch 'xtuple'

    mikerodonnell89 authored
  2. @mikerodonnell89
  3. @mikerodonnell89
  4. @mikerodonnell89

    changes

    mikerodonnell89 authored
  5. @mikerodonnell89

    changes

    mikerodonnell89 authored
Commits on Apr 2, 2013
  1. @shackbarth
  2. @shackbarth
  3. @shackbarth

    issue #19840: cleanup

    shackbarth authored
This page is out of date. Refresh to see the latest.
View
33 enyo-client/application/source/models/quote.js
@@ -134,7 +134,7 @@ white:true*/
// ..........................................................
// METHODS
//
-
+
applyCustomerSettings: function () {
var customer = this.get("customer"),
isFreeFormBillto = customer ? customer.get("isFreeFormBillto") : false,
@@ -152,7 +152,7 @@ white:true*/
// Set read only state for free form shipto
this.setReadOnly(this.shiptoAttrArray, !isFreeFormShipto);
},
-
+
bindEvents: function () {
XM.Document.prototype.bindEvents.apply(this, arguments);
var pricePolicy = XT.session.settings.get("soPriceEffective");
@@ -295,7 +295,7 @@ white:true*/
that.off('change:freight', that.freightDidChange);
that.set("freight", freight);
that.on('change:freight', that.freightDidChange);
-
+
// Now calculate tax
that.calculateFreightTax();
}
@@ -508,15 +508,16 @@ white:true*/
unsetBilltoContact();
}
},
-
+
/**
Fetch selling units of measure after a regular fetch
and also silence `add` and `remove` events.
*/
fetch: function (options) {
+ options = options ? _.clone(options) : {};
+
var that = this,
success = options.success;
- options = options ? _.clone(options) : {};
this.off('add:lineItems remove:lineItems', this.lineItemsDidChange);
this.off('add:lineItems remove:lineItems', this.calculateTotals);
options.success = function (model, resp, options) {
@@ -777,7 +778,7 @@ white:true*/
lineItems = this.get("lineItems"),
params = {},
error;
-
+
error = XM.Document.prototype.validate.apply(this, arguments);
if (error) { return error; }
@@ -884,7 +885,7 @@ white:true*/
}
});
-
+
// ..........................................................
// CLASS METHODS
//
@@ -941,7 +942,7 @@ white:true*/
scheduleDate: allowASAP ? new Date() : undefined
};
},
-
+
bindEvents: function (attributes, options) {
XM.Model.prototype.bindEvents.apply(this, arguments);
var settings = XT.session.settings;
@@ -1269,7 +1270,7 @@ white:true*/
var unit = XM.units.get(id);
that.sellingUnits.add(unit);
});
-
+
// Set the item default selections
if (resetDefaults) {
that.set({
@@ -1388,7 +1389,7 @@ white:true*/
}
return asOf;
},
-
+
priceDidChange: function () {
this.calculateExtendedPrice();
this.calculatePercentages();
@@ -1421,7 +1422,7 @@ white:true*/
item.unitToUnitRatio(priceUnit, inventoryUnit, options);
}
},
-
+
quantityDidChange: function () {
this.calculatePrice();
this.recalculateParent();
@@ -1583,7 +1584,7 @@ white:true*/
setPrice = function () {
// Allow editing again if we could before
that.setReadOnly("price", readOnlyCache);
-
+
// If price was requested before this response,
// then bail out and start over
if (that._invalidPriceRequest) {
@@ -1592,7 +1593,7 @@ white:true*/
that._calculatePrice();
return;
}
-
+
var totalPrice = XT.math.add(prices, XT.SALES_PRICE_SCALE);
that.set("customerPrice", totalPrice);
if (that._updatePrice) {
@@ -1606,7 +1607,7 @@ white:true*/
parentDate = parent.get(parent.documentDateKey);
customer = parent.get("customer");
currency = parent.get("currency");
-
+
// If we already have a request pending we need to indicate
// when that is done to start over because something has changed.
if (this._pendingPriceRequest) {
@@ -1850,7 +1851,7 @@ white:true*/
recordType: 'XM.QuoteListItem',
editableModel: 'XM.Quote',
-
+
/**
Returns quote status as a localized string.
@@ -1863,7 +1864,7 @@ white:true*/
}
});
-
+
// Add in quote mixin
XM.QuoteListItem = XM.QuoteListItem.extend(XM.QuoteMixin);
View
75 enyo-client/application/source/views/list_relations.js
@@ -298,6 +298,81 @@ trailing:true white:true*/
});
// ..........................................................
+ // OPPORTUNITY QUOTE
+ //
+
+ enyo.kind({
+ name: "XV.OpportunityQuoteListRelations",
+ kind: "XV.ListRelations",
+ orderBy: [
+ {attribute: 'id', descending: true}
+ ],
+ parentKey: "opportunity",
+ components: [
+ {kind: "XV.ListItem", components: [
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListColumn", classes: "first", components: [
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListAttr", attr: "number", classes: "bold"},
+ {kind: "XV.ListAttr", attr: "shipVia", classes: "right"}
+ ]}
+ ]}
+ ]}
+ ]}
+ ]
+ });
+
+ // ..........................................................
+ // CUSTOMER QUOTE
+ //
+
+ enyo.kind({
+ name: "XV.CustomerQuoteListRelations",
+ kind: "XV.ListRelations",
+ orderBy: [
+ {attribute: 'id', descending: true}
+ ],
+ parentKey: "customer",
+ components: [
+ {kind: "XV.ListItem", components: [
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListColumn", classes: "first", components: [
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListAttr", attr: "number", classes: "bold"},
+ {kind: "XV.ListAttr", attr: "shipVia", classes: "right"}
+ ]}
+ ]}
+ ]}
+ ]}
+ ]
+ });
+
+ // ..........................................................
+ // PROSPECT QUOTE
+ //
+
+ enyo.kind({
+ name: "XV.ProspectQuoteListRelations",
+ kind: "XV.ListRelations",
+ orderBy: [
+ {attribute: 'id', descending: true}
+ ],
+ parentKey: "customer",
+ components: [
+ {kind: "XV.ListItem", components: [
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListColumn", classes: "first", components: [
+ {kind: "FittableColumns", components: [
+ {kind: "XV.ListAttr", attr: "number", classes: "bold"},
+ {kind: "XV.ListAttr", attr: "shipVia", classes: "right"}
+ ]}
+ ]}
+ ]}
+ ]}
+ ]
+ });
+
+ // ..........................................................
// QUOTE LINE ITEM
//
View
39 enyo-client/application/source/views/list_relations_box.js
@@ -31,4 +31,43 @@ trailing:true white:true*/
canOpen: false
});
+ // ..........................................................
+ // OPPORTUNITY QUOTE
+ //
+
+ enyo.kind({
+ name: "XV.OpportunityQuoteListRelationsBox",
+ kind: "XV.ListRelationsBox",
+ title: "_quotes".loc(),
+ parentKey: "opportunity",
+ listRelations: "XV.OpportunityQuoteListRelations",
+ searchList: "XV.QuoteList"
+ });
+
+ // ..........................................................
+ // CUSTOMER QUOTE
+ //
+
+ enyo.kind({
+ name: "XV.CustomerQuoteListRelationsBox",
+ kind: "XV.ListRelationsBox",
+ title: "_quotes".loc(),
+ parentKey: "customer",
+ listRelations: "XV.CustomerQuoteListRelations",
+ searchList: "XV.QuoteList"
+ });
+
+ // ..........................................................
+ // PROSPECT QUOTE
+ //
+
+ enyo.kind({
+ name: "XV.ProspectQuoteListRelationsBox",
+ kind: "XV.ListRelationsBox",
+ title: "_quotes".loc(),
+ parentKey: "customer",
+ listRelations: "XV.ProspectQuoteListRelations",
+ searchList: "XV.QuoteList"
+ });
+
}());
View
7 enyo-client/application/source/views/workspace.js
@@ -504,6 +504,7 @@ trailing:true white:true*/
{kind: "XV.TaxZonePicker", attr: "taxZone", label: "_defaultTaxZone".loc()}
]}
]},
+ {kind: "XV.CustomerQuoteListRelationsBox", attr: "quoteRelations"},
{kind: "XV.CustomerShipToBox", attr: "shiptos"},
{kind: "XV.CustomerCommentBox", attr: "comments"},
{kind: "XV.TaxRegistrationBox", attr: "taxRegistration"},
@@ -1178,10 +1179,10 @@ trailing:true white:true*/
{kind: "XV.ContactWidget", attr: "contact",
showAddress: true, label: "_name".loc()},
{kind: "onyx.GroupboxHeader", content: "_notes".loc()},
- {kind: "XV.TextArea", attr: "notes"}//,
- //{kind: "onyx.GroupboxHeader", content: "_quotes".loc()}
+ {kind: "XV.TextArea", attr: "notes"}
]}
- ]}
+ ]},
+ {kind: "XV.ProspectQuoteListRelationsBox", attr: "quoteRelations"}
]},
{kind: "onyx.Popup", name: "findExistingAccountPopup", centered: true,
modal: true, floating: true, scrim: true, onShow: "popupShown",
View
12 enyo-client/database/orm/models/quote.json
@@ -1382,10 +1382,16 @@
}
},
{
+ "name": "number",
+ "attr": {
+ "type": "String",
+ "column": "quhead_number"
+ }
+ },
+ {
"name": "customer",
- "toOne": {
- "isNested": true,
- "type": "CustomerProspectRelation",
+ "attr": {
+ "type": "Number",
"column": "quhead_cust_id"
}
},
View
8 enyo-client/extensions/source/crm/database/orm/ext/crm.json
@@ -384,6 +384,14 @@
"column": "ophead_id",
"inverse": "opportunity"
}
+ },
+ {
+ "name": "quoteRelations",
+ "toMany": {
+ "type": "QuoteRelation",
+ "column": "ophead_id",
+ "inverse": "opportunity"
+ }
}
],
"sequence": 0,
View
10 enyo-client/extensions/source/sales/client/views/workspace.js
@@ -6,6 +6,7 @@ trailing:true white:true*/
(function () {
XT.extensions.sales.initWorkspaces = function () {
+ var extensions;
// ..........................................................
// ACCOUNT
@@ -160,6 +161,15 @@ trailing:true white:true*/
]
});
+ // ..........................................................
+ // INCIDENT
+ //
+
+ extensions = [
+ {kind: "XV.OpportunityQuoteListRelationsBox", container: "panels", attr: "quoteRelations"}
+ ];
+
+ XV.appendExtension("XV.OpportunityWorkspace", extensions);
};
View
61 enyo-client/extensions/source/sales/database/orm/ext/quote.json
@@ -21,6 +21,39 @@
"column": "quhead_id",
"inverse": "source"
}
+ },
+ {
+ "name": "opportunity",
+ "toOne": {
+ "isNested": true,
+ "type": "OpportunityRelation",
+ "column": "quhead_ophead_id"
+ }
+ }
+ ],
+ "sequence": 0,
+ "isSystem": true
+ },
+ {
+ "context": "sales",
+ "nameSpace": "XM",
+ "type": "QuoteListItem",
+ "table": "xt.quheadinfo",
+ "isExtension": true,
+ "comment": "Extended by Sales",
+ "relations": [
+ {
+ "column": "quhead_id",
+ "inverse": "id"
+ }
+ ],
+ "properties": [
+ {
+ "name": "opportunity",
+ "attr": {
+ "type": "Number",
+ "column": "quhead_ophead_id"
+ }
}
],
"sequence": 0,
@@ -77,5 +110,31 @@
],
"sequence": 0,
"isSystem": true
+ },
+ {
+ "context": "sales",
+ "nameSpace": "XM",
+ "type": "Customer",
+ "table": "custinfo",
+ "isExtension": true,
+ "comment": "Extended by Sales",
+ "relations": [
+ {
+ "column": "cust_id",
+ "inverse": "id"
+ }
+ ],
+ "properties": [
+ {
+ "name": "quoteRelations",
+ "toMany": {
+ "type": "QuoteRelation",
+ "column": "cust_id",
+ "inverse": "customer"
+ }
+ }
+ ],
+ "sequence": 0,
+ "isSystem": true
}
-]
+]
View
13 lib/enyo-x/source/views/list_relations_box.js
@@ -114,9 +114,16 @@ trailing:true white:true, bitwise:false*/
// of the item that we've just selected, as selectedModel refers
// to an info model, which is not the type of model we want
// to use in the list
- var Klass = XT.getObjectByName(selectedModel.editableModel),
- model = Klass.findOrCreate({id: selectedModel.id}),
- InfoKlass = model.getRelation(key).relatedModel,
+ var Klass = XT.getObjectByName(selectedModel.editableModel);
+ var model = Klass.findOrCreate({id: selectedModel.id});
+ if (!model.getRelation(key)) {
+ XT.log("Model", model.recordType, "has no relation", key,
+ ". It's likely that the property is on the list relation",
+ "but not the editable orm, or you have it as a number",
+ "in the editable orm instead of a nested object");
+ }
+
+ var InfoKlass = model.getRelation(key).relatedModel,
infoModel = InfoKlass.findOrCreate({id: parent.get(attr)}),
listModel = ListModel.findOrCreate({id : selectedModel.id}),
setAndSave = function () {
Something went wrong with that request. Please try again.