|
@@ -24,6 +24,34 @@ openerp.eiru_purchase_to_sale = function (instance, local) {
|
|
|
self.fecthInitial();
|
|
|
});
|
|
|
},
|
|
|
+ showMensaje : function(){
|
|
|
+ var self = this;
|
|
|
+ $("#dialog" ).dialog({
|
|
|
+ autoOpen: true,
|
|
|
+ resizable: false,
|
|
|
+ modal: true,
|
|
|
+ title: 'Atención',
|
|
|
+ width: 500,
|
|
|
+ open: function() {
|
|
|
+ $(this).html('Debe guardar el pedido anter de continuar');
|
|
|
+ },
|
|
|
+ show: {
|
|
|
+ effect: "fade",
|
|
|
+ duration: 200
|
|
|
+ },
|
|
|
+ hide: {
|
|
|
+ effect: "fade",
|
|
|
+ duration: 200
|
|
|
+ },
|
|
|
+ buttons: {
|
|
|
+ Aceptar: function() {
|
|
|
+ $(this).dialog('close');
|
|
|
+ // self.renderReport();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return
|
|
|
+ },
|
|
|
|
|
|
fecthInitial: function(){
|
|
|
var id= openerp.webclient._current_state.id;
|
|
@@ -108,20 +136,25 @@ openerp.eiru_purchase_to_sale = function (instance, local) {
|
|
|
factInsertProduct:function(selectProduct){
|
|
|
var self = this;
|
|
|
var data = [];
|
|
|
+ console.log(self);
|
|
|
var order = selectProduct.value.split('-');
|
|
|
var order_line = self.getPurchaseOrderLine(order[0]);
|
|
|
- _.each(order_line, function(item){
|
|
|
- data.push({
|
|
|
- order_id: self.SaleOrder[0].id,
|
|
|
- product_id: item.product_id[0],
|
|
|
- product_uom_qty: item.product_qty
|
|
|
+ if(self.SaleOrder.length > 0){
|
|
|
+ _.each(order_line, function(item){
|
|
|
+ data.push({
|
|
|
+ order_id: self.SaleOrder[0].id,
|
|
|
+ product_id: item.product_id[0],
|
|
|
+ product_uom_qty: item.product_qty
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
- self.joinSaleLine(data).then(function(results) {
|
|
|
- return results;
|
|
|
- }).then(function(){
|
|
|
- self.reloadLine();
|
|
|
- });
|
|
|
+ self.joinSaleLine(data).then(function(results) {
|
|
|
+ return results;
|
|
|
+ }).then(function(){
|
|
|
+ self.reloadLine();
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ self.showMensaje();
|
|
|
+ }
|
|
|
},
|
|
|
|
|
|
joinSaleLine: function(data) {
|