From cf8581e99cdd711e48083f2c8806a8a548b4198a Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 11 Jun 2012 12:50:42 +0530
Subject: [PATCH 001/166] [ADD] directory structure for web addons
bzr revid: rgaopenerp-20120611072042-r5lj4z6p3tqsonx8
---
addons/account/__openerp__.py | 6 ++++++
addons/account/static/src/js/account.js | 1 +
addons/account/static/src/xml/account.xml | 11 +++++++++++
3 files changed, 18 insertions(+)
create mode 100644 addons/account/static/src/js/account.js
create mode 100644 addons/account/static/src/xml/account.xml
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index cd19c730a3f..6657ab7c7b5 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -128,6 +128,12 @@ module named account_voucher.
"res_config_view.xml",
"account_pre_install.yml"
],
+ 'js': [
+ 'static/src/js/account.js',
+ ],
+ 'qweb' : [
+ "static/src/xml/*",
+ ],
'demo_xml': [
'demo/account_demo.xml',
'project/project_demo.xml',
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
new file mode 100644
index 00000000000..a6f266b54e1
--- /dev/null
+++ b/addons/account/static/src/js/account.js
@@ -0,0 +1 @@
+console.log('loading account.....')
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
new file mode 100644
index 00000000000..2e7dbc48ff6
--- /dev/null
+++ b/addons/account/static/src/xml/account.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
From 2b229fa7aa43f01d957c56bc60f48a6ec8cbdc57 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 11 Jun 2012 14:56:19 +0530
Subject: [PATCH 002/166] [IMP] Extend ViewManagerAction to add fromview
bzr revid: rgaopenerp-20120611092619-6l8h7atm43fimeg6
---
addons/account/static/src/xml/account.xml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index 2e7dbc48ff6..082e875239f 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -3,8 +3,9 @@
-->
-
-
+
+
+
From 8b2beb7975a8fae12423a88e90dc62323daa8cfe Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 11 Jun 2012 15:14:44 +0530
Subject: [PATCH 003/166] [FIX] typo
bzr revid: rgaopenerp-20120611094444-vhr01bggrza11hhe
---
addons/account/static/src/xml/account.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index 082e875239f..388cd96f49b 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -5,7 +5,7 @@
-
+ test
From fb41245f7843bdedfea2e621698927b83c079c6b Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 12 Jun 2012 12:49:58 +0530
Subject: [PATCH 004/166] [IMP] added form view at header on list view
bzr revid: rgaopenerp-20120612071958-2wlk6b4gek0xjc8v
---
addons/account/account_view.xml | 36 ++++++++++++++++++-----
addons/account/static/src/js/account.js | 20 ++++++++++++-
addons/account/static/src/xml/account.xml | 9 ++++--
3 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 274a8993dc4..0a29167fa7a 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1139,6 +1139,22 @@
+
+
+ account.move.line.form
+ account.move.line
+ form
+
+
+
+
+
Journal Items
@@ -1161,9 +1177,7 @@
-
-
-
+
@@ -1192,7 +1206,9 @@
{}
This view can be used by accountants in order to quickly record entries in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account. OpenERP will propose to you automatically the Tax related to this account and the counterpart "Account Payable".
-
+
+
+
+
- Journal Items
+ Journal sssssdfdsItems
account.move.line
form
tree,form
+
{'search_default_account_id': [active_id]}
@@ -1456,13 +1474,14 @@
src_model="account.move"/>
- Journal Items
+ Journssssal Items
ir.actions.act_window
account.move.line
form
tree,form
+
@@ -1900,12 +1919,13 @@
- Journal Items
+ Journal Itemaaaaas
account.move.line
form
tree,form
[('account_id','child_of', [active_id]),('state','<>','draft')]
{'account_id':active_id}
+
@@ -1933,7 +1953,7 @@
- Journal Items
+ Jouffffffffrnal Items
account.move.line
form
tree,form
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index a6f266b54e1..5bb8236fde3 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -1 +1,19 @@
-console.log('loading account.....')
+openerp.account = function(instance) {
+ instance.account.extend_view = instance.web.ViewManager.include({
+ start : function(){
+ this._super()
+ this.setup_exended_list_view()
+ },
+
+ setup_exended_list_view: function(parent){
+ if (this.action && this.action.extended_form_view_id){
+ view_id = this.action.extended_form_view_id[0]
+ var from_view = this.registry.get_object('form');
+ var options = {}
+ var obj_from_view = new from_view(this, this.dataset, view_id, options);
+ obj_from_view.template = 'ExtendedFormView'
+ obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
+ }
+ },
+ })
+}
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index 388cd96f49b..9b3ae75cc9b 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -3,10 +3,15 @@
-->
-
+
test
-
+
+
+
+
From 3a6097e85ea7d1d8bb62d0f16bbf372f4551f762 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 12 Jun 2012 15:50:38 +0530
Subject: [PATCH 005/166] [IMP] account reconcilation action
bzr revid: rgaopenerp-20120612102038-o96d42kipvkdttcq
---
addons/account/account_view.xml | 62 ++++++++++++++++-----------------
1 file changed, 30 insertions(+), 32 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 0a29167fa7a..d65483a543b 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -974,6 +974,21 @@
+
+ account.move.line.form
+ account.move.line
+ form
+
+
+
+
+
account.move.line.tree
@@ -1139,22 +1154,6 @@
-
-
- account.move.line.form
- account.move.line
- form
-
-
-
-
-
Journal Items
@@ -1206,9 +1205,7 @@
{}
This view can be used by accountants in order to quickly record entries in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account. OpenERP will propose to you automatically the Tax related to this account and the counterpart "Account Payable".
-
-
-
+
-
- Journal sssssdfdsItems
+ Journal Items
account.move.line
form
tree,form
-
{'search_default_account_id': [active_id]}
@@ -1474,14 +1469,13 @@
src_model="account.move"/>
- Journssssal Items
+ Journal Items
ir.actions.act_window
account.move.line
form
tree,form
-
@@ -1495,11 +1489,16 @@
-
+
+
+ Entries To Reconcile
+ account.move.line
+ form
+ tree,form
+
+
+ {'search_default_next_partner':1,'view_mode':True}
+
- Journal Itemaaaaas
+ Journal Items
account.move.line
form
tree,form
[('account_id','child_of', [active_id]),('state','<>','draft')]
{'account_id':active_id}
-
@@ -1953,7 +1951,7 @@
- Jouffffffffrnal Items
+ Journal Items
account.move.line
form
tree,form
From 9a0277e1d1edf5368fbd3169c2203c13149d5ac7 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 15 Jun 2012 17:50:16 +0530
Subject: [PATCH 006/166] [IMP] on pager action reload list view
bzr revid: rgaopenerp-20120615122016-2m982b7cgfjzkzk9
---
addons/account/account_move_line.py | 20 ++++++++++++++-
addons/account/static/src/js/account.js | 31 ++++++++++++++++++++---
addons/account/static/src/xml/account.xml | 1 +
3 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 892747c849f..475abd5651a 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -708,8 +708,26 @@ class account_move_line(osv.osv):
if not partner:
return []
args.append(('partner_id', '=', partner[0]))
- return super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
+ ids = super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
+ if context.get('extended_from'):
+ return self.get_move_by_unique_partner(cr, uid, offset, context)
+ return ids
+ def get_move_by_unique_partner(self, cr, uid, offset=0, context=None):
+ cr.execute(
+ """
+ SELECT l.id ,l.partner_id AS partner_id
+ FROM account_move_line l
+ LEFT JOIN account_account a ON (a.id = l.account_id)
+
+ WHERE a.reconcile IS TRUE
+ AND l.reconcile_id IS NULL
+
+ AND l.state <> 'draft'
+ GROUP BY l.id, l.partner_id OFFSET %s""", (offset, )
+ )
+ return dict(cr.fetchall()).keys()
+
def get_next_partner_only(self, cr, uid, offset=0, context=None):
cr.execute(
"""
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 5bb8236fde3..87ca083c10a 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -4,16 +4,39 @@ openerp.account = function(instance) {
this._super()
this.setup_exended_list_view()
},
-
setup_exended_list_view: function(parent){
if (this.action && this.action.extended_form_view_id){
+ var self = this
view_id = this.action.extended_form_view_id[0]
var from_view = this.registry.get_object('form');
- var options = {}
- var obj_from_view = new from_view(this, this.dataset, view_id, options);
+ this.dataset_form.context.extended_from = true
+ this.dataset_form.read_slice()
+ this.dataset_form.context.extended_from = false
+ var obj_from_view = new from_view(this, this.dataset_form, view_id, options={});
+ this.obj_from_view = obj_from_view
obj_from_view.template = 'ExtendedFormView'
- obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
+ view_promise = obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
+ $.when(view_promise).then(function() {
+ obj_from_view.on_pager_action('first')
+ })
}
},
})
+ instance.account.extend_view_action = instance.web.ViewManagerAction.include({
+ init: function(parent, action) {
+ this._super(parent, action)
+ this.dataset_form = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain);
+ },
+ })
+ instance.account.extend_form_view = instance.web.FormView.include({
+ on_pager_action: function(action) {
+ var self = this
+ var viewmanager = self.__parentedParent
+ $.when(this._super(action)).then(function() {
+ var id = self.get_fields_values().partner_id
+ viewmanager.action.domain = [["partner_id", "=", id]]
+ viewmanager.searchview.do_search()
+ })
+ }
+ })
}
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index 9b3ae75cc9b..8dac02dd491 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -10,6 +10,7 @@
From dce2c2363f1c0b3714d3290bcc61d4fbb9a357b2 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 20 Jun 2012 18:56:21 +0530
Subject: [PATCH 007/166] [IMP] Change list view domin on pager next/previous
click
bzr revid: rgaopenerp-20120620132621-882na1igz4t64kwo
---
addons/account/account_move_line.py | 23 +++-
addons/account/account_view.xml | 10 +-
addons/account/static/src/js/account.js | 158 ++++++++++++++++++------
3 files changed, 149 insertions(+), 42 deletions(-)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 475abd5651a..4cd070d0965 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -470,6 +470,22 @@ class account_move_line(osv.osv):
for line in move.line_id:
result.append(line.id)
return result
+
+ def _latest_entry_date(self, cr, uid, ids, prop, unknow_none, context=None):
+ res = {}
+ # ToDo write query to fetch the same date
+ for accout_move_line in self.browse(cr, uid, ids, context=context):
+ ids = self.search(cr, uid, [('partner_id','=',accout_move_line.partner_id.id)], context=context, limit=1, order='date')
+ date = self.browse(cr, uid, ids, context=context)[0].date
+ res[accout_move_line.id] = date
+ return res
+
+ def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
+ #ToDo
+ res = {}
+ for id in ids:
+ res[id] = 0.5
+ return res
_columns = {
'name': fields.char('Name', size=64, required=True),
@@ -517,7 +533,12 @@ class account_move_line(osv.osv):
type='many2one', relation='account.invoice', fnct_search=_invoice_search),
'account_tax_id':fields.many2one('account.tax', 'Tax'),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),
- 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
+ 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
+ 'last_reconciliation_date': fields.related('partner_id', 'last_reconciliation_date', type='datetime', relation='res.partner', string='Latest Reconciliation Date',readonly=True),
+ 'lastest_entry': fields.function(_latest_entry_date, type='date', string="Latest Entry"),
+ 'lastest_entry2': fields.function(_latest_entry_date, type='date', string="Latest Recnciliation"),
+ 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float')
+
}
def _get_date(self, cr, uid, context=None):
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index d65483a543b..f5bba9361cb 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -982,9 +982,13 @@
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 87ca083c10a..7381a6e99c8 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -1,42 +1,124 @@
openerp.account = function(instance) {
- instance.account.extend_view = instance.web.ViewManager.include({
- start : function(){
- this._super()
- this.setup_exended_list_view()
- },
- setup_exended_list_view: function(parent){
- if (this.action && this.action.extended_form_view_id){
- var self = this
- view_id = this.action.extended_form_view_id[0]
- var from_view = this.registry.get_object('form');
- this.dataset_form.context.extended_from = true
- this.dataset_form.read_slice()
- this.dataset_form.context.extended_from = false
- var obj_from_view = new from_view(this, this.dataset_form, view_id, options={});
- this.obj_from_view = obj_from_view
- obj_from_view.template = 'ExtendedFormView'
- view_promise = obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
- $.when(view_promise).then(function() {
- obj_from_view.on_pager_action('first')
- })
- }
- },
- })
- instance.account.extend_view_action = instance.web.ViewManagerAction.include({
- init: function(parent, action) {
- this._super(parent, action)
- this.dataset_form = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain);
- },
- })
- instance.account.extend_form_view = instance.web.FormView.include({
- on_pager_action: function(action) {
- var self = this
- var viewmanager = self.__parentedParent
- $.when(this._super(action)).then(function() {
- var id = self.get_fields_values().partner_id
- viewmanager.action.domain = [["partner_id", "=", id]]
- viewmanager.searchview.do_search()
- })
+var _t = instance.web._t,
+ _lt = instance.web._lt;
+instance.web.views.add('form_clone', 'instance.account.extend_form_view');
+instance.web.form.tags.add('list_button','instance.account.list_button')
+instance.account.extend_actionmanager = instance.web.ActionManager.include({
+ ir_actions_act_window: function (action, on_close) {
+ var self = this;
+ if (_(['base.module.upgrade', 'base.setup.installer'])
+ .contains(action.res_model)) {
+ var old_close = on_close;
+ on_close = function () {
+ instance.webclient.do_reload().then(old_close);
+ };
}
+ if (action.target === 'new') {
+ if (this.dialog == null) {
+ this.dialog = new instance.web.Dialog(this, { width: '80%' });
+ if(on_close)
+ this.dialog.on_close.add(on_close);
+ } else {
+ this.dialog_viewmanager.destroy();
+ }
+ this.dialog.dialog_title = action.name;
+ this.dialog_viewmanager = new instance.web.ViewManagerAction(this, action);
+ this.dialog_viewmanager.appendTo(this.dialog.$element);
+ this.dialog.open();
+ } else {
+ this.dialog_stop();
+ this.content_stop();
+ if(action.menu_id) {
+ return this.getParent().do_action(action, function () {
+ instance.webclient.menu.open_menu(action.menu_id);
+ });
+ }
+ this.inner_action = action;
+ if (action.extended_form_view_id){
+ this.inner_viewmanager = new instance.account.extend_viewmanager(this, action);
+ }else{
+ this.inner_viewmanager = new instance.web.ViewManagerAction(this, action);
+ }
+ this.inner_viewmanager.appendTo(this.$element);
+ }
+ },
})
+
+instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
+ init: function(parent, action) {
+ this._super.apply(this,arguments);
+ this.dataset_form = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain);
+ },
+ start : function(){
+ this._super()
+ this.setup_exended_list_view(this)
+ },
+ on_mode_switch: function (view_type, no_store, options) {
+ self = this
+ self.list_loaded = $.when(this._super.apply(this, arguments)).then(function () {
+ self.list_view = self.views['list']
+ })
+ },
+ setup_exended_list_view: function(parent){
+ var from_view,
+ obj_from_view;
+ view_id = this.action.extended_form_view_id[0]
+ from_view = this.registry.get_object('form_clone');
+ this.dataset_form.context.extended_from = true
+ this.dataset_loaded = this.dataset_form.read_slice()
+ this.dataset_form.context.extended_from = false
+ obj_from_view = new from_view(self, this.dataset_form, view_id, options={});
+ obj_from_view.template = 'ExtendedFormView'
+ view_promise = obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
+ $.when(view_promise && this.dataset_loaded).then(function() {
+ obj_from_view.on_pager_action('first')
+ })
+ }
+
+})
+instance.account.extend_form_view = instance.web.FormView.extend({
+ init :function(){
+ this._super.apply(this,arguments);
+ this.original_domain = this.getParent().action.domain;
+ },
+ on_pager_action: function(action) {
+ var self = this
+ var viewmanager = self.getParent();
+ viewmanager.action.domain = this.original_domain
+ $.when(this._super(action)).then(function() {
+ var id = self.get_fields_values().partner_id;
+ viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
+ viewmanager.searchview.do_search()
+ })
+ }
+})
+instance.account.list_button = instance.web.form.WidgetButton.extend({
+ on_click: function() {
+ var list_view = this.view.getParent().list_view.controller
+ ids = list_view.get_selected_ids()
+ if (ids.length == 0) {
+ instance.web.dialog($("
").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
+ return false;
+ }
+ var additional_context = _.extend({
+ active_id: ids[0],
+ active_ids: ids,
+ active_model: list_view.dataset.model
+ });
+ self.rpc("/web/action/load", {
+ action_id: py.eval(this.node.attrs.name),
+ context: additional_context
+ }, function(result) {
+ result.result.context = _.extend(result.result.context || {},
+ additional_context);
+ result.result.flags = result.result.flags || {};
+ result.result.flags.new_window = true;
+ self.do_action(result.result, function () {
+ // reload view
+ list_view.reload();
+ });
+ });
+ }
+})
+
}
From 1e4c2e4fb463e6c43bbf62e50431d794a194aefd Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 20 Jun 2012 19:05:45 +0530
Subject: [PATCH 008/166] typo
bzr revid: rgaopenerp-20120620133545-0x7vfsodplb6j2zx
---
addons/account/static/src/xml/account.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index 8dac02dd491..e43b6bafb3f 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -5,7 +5,7 @@
- test
+
From 8b06240a61848bc6b2077df04c3efec58f0bbe0a Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 20 Jun 2012 19:53:42 +0530
Subject: [PATCH 009/166] [IMP] apply button widget attribute
bzr revid: rgaopenerp-20120620142342-aemmc5nmbte5qzw2
---
addons/account/account_view.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index f5bba9361cb..5edb23cb258 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -985,8 +985,8 @@
-
-
+
+
From a14e4b502c01b830ce32307485abe56071177a21 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 22 Jun 2012 11:12:34 +0530
Subject: [PATCH 010/166] [IMP] form view and apply css
bzr revid: rgaopenerp-20120622054234-cj001wr9crf7chyi
---
addons/account/__openerp__.py | 8 +++++---
addons/account/account_move_line.py | 1 -
addons/account/account_view.xml | 18 +++++++++---------
addons/account/static/src/js/account.js | 9 ++++++---
4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 6657ab7c7b5..aecc326f39c 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -66,6 +66,8 @@ module named account_voucher.
'wizard/account_use_model_view.xml',
'account_installer.xml',
'wizard/account_period_close_view.xml',
+ 'wizard/account_reconcile_view.xml',
+ 'wizard/account_unreconcile_view.xml',
'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
@@ -88,14 +90,12 @@ module named account_voucher.
'wizard/account_journal_select_view.xml',
'wizard/account_change_currency_view.xml',
'wizard/account_validate_move_view.xml',
- 'wizard/account_unreconcile_view.xml',
'wizard/account_report_general_ledger_view.xml',
'wizard/account_invoice_state_view.xml',
'wizard/account_report_partner_balance_view.xml',
'wizard/account_report_account_balance_view.xml',
'wizard/account_report_aged_partner_balance_view.xml',
'wizard/account_report_partner_ledger_view.xml',
- 'wizard/account_reconcile_view.xml',
'wizard/account_reconcile_partner_process_view.xml',
'wizard/account_automatic_reconcile_view.xml',
'wizard/account_financial_report_view.xml',
@@ -132,7 +132,9 @@ module named account_voucher.
'static/src/js/account.js',
],
'qweb' : [
- "static/src/xml/*",
+ "static/src/xml/account.xml",
+ ],
+ 'css':['static/src/css/account.css'
],
'demo_xml': [
'demo/account_demo.xml',
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index af43fa7311c..835456ce2c0 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -536,7 +536,6 @@ class account_move_line(osv.osv):
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
'last_reconciliation_date': fields.related('partner_id', 'last_reconciliation_date', type='datetime', relation='res.partner', string='Latest Reconciliation Date',readonly=True),
'lastest_entry': fields.function(_latest_entry_date, type='date', string="Latest Entry"),
- 'lastest_entry2': fields.function(_latest_entry_date, type='date', string="Latest Recnciliation"),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float')
}
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 1555f2b0559..b02f3d211fb 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -980,15 +980,15 @@
form
-
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 7381a6e99c8..66dea644b53 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -60,7 +60,8 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
})
},
setup_exended_list_view: function(parent){
- var from_view,
+ var self = this,
+ from_view,
obj_from_view;
view_id = this.action.extended_form_view_id[0]
from_view = this.registry.get_object('form_clone');
@@ -70,8 +71,10 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
obj_from_view = new from_view(self, this.dataset_form, view_id, options={});
obj_from_view.template = 'ExtendedFormView'
view_promise = obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
- $.when(view_promise && this.dataset_loaded).then(function() {
- obj_from_view.on_pager_action('first')
+ $.when(view_promise, this.dataset_loaded).then(function() {
+ if (!_.isEmpty(self.dataset_form.ids)) {
+ obj_from_view.on_pager_action('first')
+ }
})
}
From 02b60d587b1ea01bbdba21ffab5ff614164d7763 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 22 Jun 2012 12:51:43 +0530
Subject: [PATCH 011/166] [IMP] added many2one pager widget
bzr revid: rgaopenerp-20120622072143-k7y0sd1d3tj2gnd1
---
addons/account/static/src/js/account.js | 40 +++++++++++++++++++++++
addons/account/static/src/xml/account.xml | 31 +++++++++++++++++-
2 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 66dea644b53..a08866613d9 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -3,6 +3,7 @@ var _t = instance.web._t,
_lt = instance.web._lt;
instance.web.views.add('form_clone', 'instance.account.extend_form_view');
instance.web.form.tags.add('list_button','instance.account.list_button')
+instance.web.form.widgets.add('many2one_pager','instance.account.many2one_pager')
instance.account.extend_actionmanager = instance.web.ActionManager.include({
ir_actions_act_window: function (action, on_close) {
var self = this;
@@ -84,6 +85,19 @@ instance.account.extend_form_view = instance.web.FormView.extend({
this._super.apply(this,arguments);
this.original_domain = this.getParent().action.domain;
},
+ on_loaded: function(data) {
+ this._super.apply(this,arguments);
+ var self = this
+ this.$element.on('click','a[data-pager-action]',function() {
+ var action = $(this).data('pager-action');
+ self.on_pager_action(action);
+ });
+ },
+ do_update_pager: function(hide_index) {
+ var index = hide_index ? '-' : this.dataset.index + 1;
+ this.$element.find('span.oe_pager_index_extend').html(index).end()
+ .find('span.oe_pager_count_extend').html(this.dataset.ids.length);
+ },
on_pager_action: function(action) {
var self = this
var viewmanager = self.getParent();
@@ -95,6 +109,32 @@ instance.account.extend_form_view = instance.web.FormView.extend({
})
}
})
+instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
+ template: "FieldMany2One_Pager",
+ display_string: function(str) {
+ var self = this;
+ if (!this.get("effective_readonly")) {
+ this.$input.val(str);
+ } else {
+ this.$element.find('a.oe_form_uri')
+ .unbind('click')
+ .text(str)
+ .click(function () {
+ self.do_action({
+ type: 'ir.actions.act_window',
+ res_model: self.field.relation,
+ res_id: self.get("value"),
+ context: self.build_context(),
+ views: [[false, 'form']],
+ target: 'current'
+ });
+ return false;
+ });
+ }
+ },
+})
+
+
instance.account.list_button = instance.web.form.WidgetButton.extend({
on_click: function() {
var list_view = this.view.getParent().list_view.controller
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index e43b6bafb3f..506d2c862dc 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -10,9 +10,38 @@
+
+
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
From 7ab3d9962170b7f85076b8ebf4f40a5390d4215f Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 22 Jun 2012 14:47:17 +0530
Subject: [PATCH 012/166] [IMP] wizard view
bzr revid: rgaopenerp-20120622091717-ryzukodk5n2irhe2
---
addons/account/account_view.xml | 2 +-
addons/account/wizard/account_reconcile_view.xml | 10 +++-------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index b02f3d211fb..8c754533024 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -982,7 +982,7 @@
-
+
diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml
index 959c4ceddcf..2a8494e5923 100644
--- a/addons/account/wizard/account_reconcile_view.xml
+++ b/addons/account/wizard/account_reconcile_view.xml
@@ -9,17 +9,13 @@
-
-
-
+
-
From 4647ff5b8fc155b06af19c95b468bc2ca5be52f3 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 27 Jun 2012 18:35:29 +0530
Subject: [PATCH 013/166] [IMP] create sql view(model) to fecth appropriate
data from various tables, improve view as per mock-up specification
bzr revid: rgaopenerp-20120627130529-5jonfjm2fkoh61vu
---
addons/account/__init__.py | 1 +
addons/account/__openerp__.py | 1 +
addons/account/account_move_line_extended.py | 69 +++++++++++++++++++
addons/account/account_move_line_extended.xml | 31 +++++++++
addons/account/account_view.xml | 5 +-
addons/account/static/src/css/account.css | 38 ++++++++++
addons/account/static/src/js/account.js | 5 +-
addons/account/static/src/xml/account.xml | 13 +++-
8 files changed, 155 insertions(+), 8 deletions(-)
create mode 100644 addons/account/account_move_line_extended.py
create mode 100644 addons/account/account_move_line_extended.xml
create mode 100644 addons/account/static/src/css/account.css
diff --git a/addons/account/__init__.py b/addons/account/__init__.py
index 90fbdb83980..3a2273379da 100644
--- a/addons/account/__init__.py
+++ b/addons/account/__init__.py
@@ -38,5 +38,6 @@ import company
import res_currency
import edi
import res_config
+import account_move_line_extended
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index aecc326f39c..59abf719a3c 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -68,6 +68,7 @@ module named account_voucher.
'wizard/account_period_close_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_unreconcile_view.xml',
+ 'account_move_line_extended.xml',
'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
new file mode 100644
index 00000000000..b04d86284b6
--- /dev/null
+++ b/addons/account/account_move_line_extended.py
@@ -0,0 +1,69 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import tools
+from osv import fields,osv
+
+
+class account_move_partner_info(osv.osv):
+ _name = "account.move.partner.info"
+ _description = "All partner info related account move line"
+ _auto = False
+
+ def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
+ #ToDo
+ res = {}
+ for id in ids:
+ res[id] = 50
+ return res
+
+ _columns = {
+ 'partner_id':fields.many2one('res.partner', 'Partner'),
+ 'last_reconciliation_date':fields.datetime('Last Reconciliation'),
+ 'latest_date' :fields.date('Latest Entry'),
+ 'followup_date': fields.date('Latest Follow-up'),
+ 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float')
+
+ }
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'analytic_entries_report')
+ cr.execute("""
+ create or replace view account_move_partner_info as (
+ SELECT p.id, p.id as partner_id,
+ max(p.last_reconciliation_date) as last_reconciliation_date,
+ max(l.date) as latest_date,
+ max(l.followup_date) as followup_date
+ FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
+ group by p.id
+ )
+ """)
+account_move_partner_info()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
+
+
+#SELECT p.id as partner_id,
+# max(p.last_reconciliation_date) as last_reconciliation_date,
+# max(l.date) as latest_date,
+# max(l.followup_date) as followup_date
+#From account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
+#group by p.id
\ No newline at end of file
diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_line_extended.xml
new file mode 100644
index 00000000000..911c0d43f81
--- /dev/null
+++ b/addons/account/account_move_line_extended.xml
@@ -0,0 +1,31 @@
+
+
+
+
+ account.move.partner.info.form
+ account.move.partner.info
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 8c754533024..686d0a51e40 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -974,7 +974,7 @@
-
+
account.move.line.tree
account.move.line
diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css
new file mode 100644
index 00000000000..963c4391595
--- /dev/null
+++ b/addons/account/static/src/css/account.css
@@ -0,0 +1,38 @@
+
+.openerp .oe_extended_form_view .oe_formview {
+ background-color: #eeeeee;
+ -webkit-border-radius: 10px;
+ -moz-border-radius: 10px;
+ border-radius: 10px;
+ border:2px solid;
+ }
+
+.openerp .oe_pager_m2o li {
+ display: inline-block;
+ height: 24px;
+ line-height: 24px;
+ padding: 0;
+ float: left;
+}
+
+.openerp .oe_pager_m2o a {
+ padding: 0 8px;
+}
+
+.openerp .oe_extended_form_view .oe_form_field:empty {
+ display: inline-block ;
+}
+
+.openerp .oe_extended_form_view button {
+ margin-right: 10px
+}
+
+.openerp .oe_extended_form_view .oe_button_container .oe_form_field{
+ width: auto;
+ margin: 0px 10px 0px 10px;
+}
+.openerp .oe_extended_form_view .oe_button_container{
+ display: inline-block ;
+ width:100%;
+ margin: 10px;
+}
\ No newline at end of file
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index a08866613d9..e4ca9ada55f 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -48,7 +48,8 @@ instance.account.extend_actionmanager = instance.web.ActionManager.include({
instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
init: function(parent, action) {
this._super.apply(this,arguments);
- this.dataset_form = new instance.web.DataSetSearch(this, action.res_model, action.context, action.domain);
+ //Fix me: pass hard coded model name, find the way to fetch it from server
+ this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.partner.info', action.context, action.domain);
},
start : function(){
this._super()
@@ -66,9 +67,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
obj_from_view;
view_id = this.action.extended_form_view_id[0]
from_view = this.registry.get_object('form_clone');
- this.dataset_form.context.extended_from = true
this.dataset_loaded = this.dataset_form.read_slice()
- this.dataset_form.context.extended_from = false
obj_from_view = new from_view(self, this.dataset_form, view_id, options={});
obj_from_view.template = 'ExtendedFormView'
view_promise = obj_from_view.appendTo(this.$element.find('.oe_extended_form_view'))
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account.xml
index 506d2c862dc..dba545b219a 100644
--- a/addons/account/static/src/xml/account.xml
+++ b/addons/account/static/src/xml/account.xml
@@ -14,7 +14,8 @@
-
+
+
-
+
+
@@ -42,6 +50,7 @@
+
From e137d17ea4cb767cc3e053dbbf463ff8ee718881 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 27 Jun 2012 18:41:47 +0530
Subject: [PATCH 014/166] clean up created seprated sql view so no need to
added field in model
bzr revid: rgaopenerp-20120627131147-mg94jfo9w4nu9e09
---
addons/account/account_move_line.py | 20 --------------------
addons/account/account_view.xml | 19 -------------------
2 files changed, 39 deletions(-)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 835456ce2c0..a1986e7ece6 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -470,22 +470,6 @@ class account_move_line(osv.osv):
for line in move.line_id:
result.append(line.id)
return result
-
- def _latest_entry_date(self, cr, uid, ids, prop, unknow_none, context=None):
- res = {}
- # ToDo write query to fetch the same date
- for accout_move_line in self.browse(cr, uid, ids, context=context):
- ids = self.search(cr, uid, [('partner_id','=',accout_move_line.partner_id.id)], context=context, limit=1, order='date')
- date = self.browse(cr, uid, ids, context=context)[0].date
- res[accout_move_line.id] = date
- return res
-
- def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
- #ToDo
- res = {}
- for id in ids:
- res[id] = 0.5
- return res
_columns = {
'name': fields.char('Name', size=64, required=True),
@@ -534,10 +518,6 @@ class account_move_line(osv.osv):
'account_tax_id':fields.many2one('account.tax', 'Tax'),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),
'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
- 'last_reconciliation_date': fields.related('partner_id', 'last_reconciliation_date', type='datetime', relation='res.partner', string='Latest Reconciliation Date',readonly=True),
- 'lastest_entry': fields.function(_latest_entry_date, type='date', string="Latest Entry"),
- 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float')
-
}
def _get_date(self, cr, uid, context=None):
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 686d0a51e40..ba690ac0476 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -974,25 +974,6 @@
-
account.move.line.tree
account.move.line
From 750727be0f3d92131407e1a8a24f32c9f75438af Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 27 Jun 2012 19:15:10 +0530
Subject: [PATCH 015/166] [IMP] split code of account and account_follow_up
bzr revid: rgaopenerp-20120627134510-sbstm6r6gc55em89
---
addons/account/account_move_line_extended.py | 7 +++----
addons/account/account_move_line_extended.xml | 2 --
addons/account_followup/account_followup.py | 20 +++++++++++++++++++
3 files changed, 23 insertions(+), 6 deletions(-)
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index b04d86284b6..d08d169f408 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -39,18 +39,17 @@ class account_move_partner_info(osv.osv):
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.datetime('Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
- 'followup_date': fields.date('Latest Follow-up'),
+# 'followup_date': fields.date('Latest Follow-up'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float')
}
def init(self, cr):
- tools.drop_view_if_exists(cr, 'analytic_entries_report')
+ tools.drop_view_if_exists(cr, 'account_move_partner_info')
cr.execute("""
create or replace view account_move_partner_info as (
SELECT p.id, p.id as partner_id,
max(p.last_reconciliation_date) as last_reconciliation_date,
- max(l.date) as latest_date,
- max(l.followup_date) as followup_date
+ max(l.date) as latest_date
FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
group by p.id
)
diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_line_extended.xml
index 911c0d43f81..1733555771f 100644
--- a/addons/account/account_move_line_extended.xml
+++ b/addons/account/account_move_line_extended.xml
@@ -21,8 +21,6 @@
-
-
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index b53558ab0e7..10a29bb2534 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -75,6 +75,26 @@ class account_move_line(osv.osv):
account_move_line()
+class account_move_partner_info(osv.osv):
+ _inherit = 'account.move.partner.info'
+ _columns = {
+ 'followup_date': fields.date('Latest Follow-up'),
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'account_move_partner_info')
+ cr.execute("""
+ create or replace view account_move_partner_info as (
+ SELECT p.id, p.id as partner_id,
+ max(p.last_reconciliation_date) as last_reconciliation_date,
+ max(l.date) as latest_date,
+ max(l.followup_date) as followup_date
+ FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
+ group by p.id
+ )
+ """)
+account_move_partner_info()
+
class res_company(osv.osv):
_inherit = "res.company"
_columns = {
From daadbabfcbcdfdbdb6c33cb0e1df6ff419d34920 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 27 Jun 2012 19:30:08 +0530
Subject: [PATCH 016/166] [IMP] added follow up field in view
bzr revid: rgaopenerp-20120627140008-w6axntsn3brxnd2y
---
addons/account_followup/account_followup.py | 1 +
addons/account_followup/account_followup_view.xml | 12 ++++++++++++
2 files changed, 13 insertions(+)
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index 10a29bb2534..02ddc151231 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -20,6 +20,7 @@
##############################################################################
from osv import fields, osv
+import tools
class followup(osv.osv):
_name = 'account_followup.followup'
diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml
index 89423327d68..297b5dc24ed 100644
--- a/addons/account_followup/account_followup_view.xml
+++ b/addons/account_followup/account_followup_view.xml
@@ -125,6 +125,18 @@
+
+
+ account.move.partner.info.followup
+ account.move.partner.info
+
+
+
+
+
+
+
+
account.move.line.tree.followup
From a1da26b2403ea9ccdf6ea126ea48268bf59723a5 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 2 Jul 2012 14:47:49 +0530
Subject: [PATCH 017/166] [IMP] remove search default and auto_search of view
bzr revid: rgaopenerp-20120702091749-9mlhml6ihrrq61t1
---
addons/account/account_view.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 64081970614..83607a112a2 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1481,8 +1481,9 @@
form
tree,form
+
- {'search_default_next_partner':1,'view_mode':True}
+ {'view_mode':True}
From a19f996a2fd35c00ea73dca37a79a55350025940 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 3 Jul 2012 11:30:39 +0530
Subject: [PATCH 018/166] [IMP] improve view, add max followup field and
remove(invisible) field from list view
bzr revid: rgaopenerp-20120703060039-9hg5051ng61a3dp6
---
addons/account/account_view.xml | 12 +++++-------
addons/account/static/src/css/account.css | 2 +-
addons/account_followup/account_followup.py | 5 ++++-
addons/account_followup/account_followup_view.xml | 1 +
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 83607a112a2..5cc89bbb985 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -982,12 +982,12 @@
-
+
-
-
-
+
+
+
@@ -996,9 +996,7 @@
-
-
-
+
diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css
index 963c4391595..07d3a83893e 100644
--- a/addons/account/static/src/css/account.css
+++ b/addons/account/static/src/css/account.css
@@ -20,7 +20,7 @@
}
.openerp .oe_extended_form_view .oe_form_field:empty {
- display: inline-block ;
+ display: inline-block !important;
}
.openerp .oe_extended_form_view button {
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index e563492e939..093a07d3859 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -80,6 +80,8 @@ class account_move_partner_info(osv.osv):
_inherit = 'account.move.partner.info'
_columns = {
'followup_date': fields.date('Latest Follow-up'),
+ 'max_followup_id':fields.many2one('account_followup.followup.line',
+ 'Max Follow Up Level' )
}
def init(self, cr):
@@ -89,7 +91,8 @@ class account_move_partner_info(osv.osv):
SELECT p.id, p.id as partner_id,
max(p.last_reconciliation_date) as last_reconciliation_date,
max(l.date) as latest_date,
- max(l.followup_date) as followup_date
+ max(l.followup_date) as followup_date,
+ max(l.followup_line_id) as max_followup_id
FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
group by p.id
)
diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml
index 2edfc64d29f..487836b98f0 100644
--- a/addons/account_followup/account_followup_view.xml
+++ b/addons/account_followup/account_followup_view.xml
@@ -135,6 +135,7 @@
+
From 81415e4df622367c5fbb5a603eb3bfc4d2f78d18 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 4 Jul 2012 12:33:56 +0530
Subject: [PATCH 019/166] [IMP] progress bar precentage count and added action
on button
bzr revid: rgaopenerp-20120704070356-35czqiavzjb1n0y1
---
addons/account/account_move_line_extended.py | 17 +++++++++++++----
addons/account/account_move_line_extended.xml | 4 ++--
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index d08d169f408..2a36a7a77d8 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -29,11 +29,20 @@ class account_move_partner_info(osv.osv):
_auto = False
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
- #ToDo
- res = {}
+ res = 0
+ cr.execute("""SELECT partner_id, reconcile_id
+ FROM account_move_line WHERE state <> 'draft'
+ GROUP BY partner_id, reconcile_id""")
+ result = cr.fetchall()
+ partner_total = len(result)
+ partner_reconcile = len([ (x,y) for x, y in result if y == None ])
+ if partner_total:
+ res = float(partner_total- partner_reconcile)/partner_total * 100
+
+ res_all = {}
for id in ids:
- res[id] = 50
- return res
+ res_all[id] = res
+ return res_all
_columns = {
'partner_id':fields.many2one('res.partner', 'Partner'),
diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_line_extended.xml
index 1733555771f..27c52b2c7ac 100644
--- a/addons/account/account_move_line_extended.xml
+++ b/addons/account/account_move_line_extended.xml
@@ -18,8 +18,8 @@
-
-
+
+
From 82362ebf05330abae675102e0a08b148b4c0df33 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 4 Jul 2012 14:39:23 +0530
Subject: [PATCH 020/166] [IMP] reload form view after button action and
imporve view
bzr revid: rgaopenerp-20120704090923-oaih8y36tuc38m3u
---
addons/account/account_view.xml | 3 ++-
addons/account/static/src/css/account.css | 5 ++++-
addons/account/static/src/js/account.js | 3 +++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 5cc89bbb985..bae4d41642b 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -980,7 +980,7 @@
tree
-
+
@@ -997,6 +997,7 @@
+
diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css
index 07d3a83893e..d08412655e6 100644
--- a/addons/account/static/src/css/account.css
+++ b/addons/account/static/src/css/account.css
@@ -35,4 +35,7 @@
display: inline-block ;
width:100%;
margin: 10px;
-}
\ No newline at end of file
+}
+.openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar {
+ width: 200px !important;
+}
\ No newline at end of file
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index e4ca9ada55f..544ec4ccbd2 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -136,6 +136,7 @@ instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
instance.account.list_button = instance.web.form.WidgetButton.extend({
on_click: function() {
+ var self = this
var list_view = this.view.getParent().list_view.controller
ids = list_view.get_selected_ids()
if (ids.length == 0) {
@@ -158,8 +159,10 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
self.do_action(result.result, function () {
// reload view
list_view.reload();
+ self.getParent().reload()
});
});
+
}
})
From 092a646c66a960df8eb0d555136daf563675d45e Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 6 Jul 2012 15:00:39 +0530
Subject: [PATCH 021/166] [IMP] click on nothing to reconcile button skip
current parnter
bzr revid: rgaopenerp-20120706093039-842mld92j582sals
---
addons/account/account_move_line_extended.py | 40 ++++++++++++-------
addons/account/account_move_line_extended.xml | 2 +-
addons/account/static/src/js/account.js | 33 ++++++++++++---
3 files changed, 55 insertions(+), 20 deletions(-)
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index 2a36a7a77d8..ce2df185bfc 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -44,34 +44,46 @@ class account_move_partner_info(osv.osv):
res_all[id] = res
return res_all
+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+ ids = super(account_move_partner_info, self).search(cr, uid, args, offset, limit, order, context, count)
+ res = []
+ for l in self.browse(cr, uid, ids, context=context):
+ if (not l.partner_move_count) or (l.move_lines_count >l.partner_move_count):
+ res.append(l.id)
+ return res
+
_columns = {
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.datetime('Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
-# 'followup_date': fields.date('Latest Follow-up'),
- 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float')
-
+ 'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
+ 'move_lines_count':fields.integer('Move Count'),
+ 'partner_move_count':fields.integer('Partner move line count'),
}
+ def skip_partner(self, cr, uid, ids, context):
+ res_partner = self.pool.get('res.partner')
+ for line in self.browse(cr, uid, ids, context=context):
+ res_partner.write(cr, uid, [line.id] ,{'partner_move_count':line.move_lines_count})
+
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_partner_info')
cr.execute("""
create or replace view account_move_partner_info as (
SELECT p.id, p.id as partner_id,
max(p.last_reconciliation_date) as last_reconciliation_date,
- max(l.date) as latest_date
+ max(l.date) as latest_date,
+ count(l.id) as move_lines_count,
+ max(p.partner_move_count) as partner_move_count
FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
group by p.id
)
""")
account_move_partner_info()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
-
-
-#SELECT p.id as partner_id,
-# max(p.last_reconciliation_date) as last_reconciliation_date,
-# max(l.date) as latest_date,
-# max(l.followup_date) as followup_date
-#From account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
-#group by p.id
\ No newline at end of file
+class res_partner(osv.osv):
+ _inherit = 'res.partner'
+ _columns = {
+ 'partner_move_count': fields.integer('Partner move line count')
+ }
+res_partner()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_line_extended.xml
index 27c52b2c7ac..8fcf518fc4c 100644
--- a/addons/account/account_move_line_extended.xml
+++ b/addons/account/account_move_line_extended.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 544ec4ccbd2..a3ad0f85ccd 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -3,6 +3,7 @@ var _t = instance.web._t,
_lt = instance.web._lt;
instance.web.views.add('form_clone', 'instance.account.extend_form_view');
instance.web.form.tags.add('list_button','instance.account.list_button')
+instance.web.form.tags.add('btn_extend','instance.account.btn_extend')
instance.web.form.widgets.add('many2one_pager','instance.account.many2one_pager')
instance.account.extend_actionmanager = instance.web.ActionManager.include({
ir_actions_act_window: function (action, on_close) {
@@ -53,7 +54,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
},
start : function(){
this._super()
- this.setup_exended_list_view(this)
+ this.setup_exended_form_view(this)
},
on_mode_switch: function (view_type, no_store, options) {
self = this
@@ -61,7 +62,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
self.list_view = self.views['list']
})
},
- setup_exended_list_view: function(parent){
+ setup_exended_form_view: function(parent){
var self = this,
from_view,
obj_from_view;
@@ -106,8 +107,8 @@ instance.account.extend_form_view = instance.web.FormView.extend({
viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
viewmanager.searchview.do_search()
})
- }
-})
+ },
+ })
instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
template: "FieldMany2One_Pager",
display_string: function(str) {
@@ -132,7 +133,30 @@ instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
}
},
})
+instance.account.btn_extend = instance.web.form.WidgetButton.extend({
+ on_confirmed: function() {
+ var self = this;
+ var context = this.node.attrs.context;
+ if (context && context.__ref) {
+ context = new instance.web.CompoundContext(context);
+ context.set_eval_context(this._build_eval_context());
+ }
+
+ return this.view.do_execute_action(
+ _.extend({}, this.node.attrs, {context: context}),
+ this.view.dataset, this.view.datarecord.id, function () {
+ $.when(self.view.dataset.read_slice()).then(function() {
+ if (!_.isEmpty(self.view.dataset.ids)){
+ self.view.reload();
+ //reload list view
+ self.view.on_pager_action()
+ }
+ })
+
+ });
+ },
+})
instance.account.list_button = instance.web.form.WidgetButton.extend({
on_click: function() {
@@ -162,7 +186,6 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
self.getParent().reload()
});
});
-
}
})
From 3b4b66bf228251f2b038d157be73a597506b7ac4 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 6 Jul 2012 15:28:03 +0530
Subject: [PATCH 022/166] [FIX] crash due to class loading sequence, thanks to
rubot
bzr revid: rgaopenerp-20120706095803-i9gssjiz86p9n0i1
---
addons/account/account_move_line_extended.py | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index ce2df185bfc..441cbda7ae1 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -22,6 +22,12 @@
import tools
from osv import fields,osv
+class res_partner(osv.osv):
+ _inherit = 'res.partner'
+ _columns = {
+ 'partner_move_count': fields.integer('Partner move line count')
+ }
+res_partner()
class account_move_partner_info(osv.osv):
_name = "account.move.partner.info"
@@ -79,11 +85,4 @@ class account_move_partner_info(osv.osv):
)
""")
account_move_partner_info()
-
-class res_partner(osv.osv):
- _inherit = 'res.partner'
- _columns = {
- 'partner_move_count': fields.integer('Partner move line count')
- }
-res_partner()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
From a8ad37e65ac6fcabc0d14012f584fc56b7d58c8a Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 9 Jul 2012 18:20:49 +0530
Subject: [PATCH 023/166] [fix] crash on followup, inherit sql view
bzr revid: rgaopenerp-20120709125049-sld0p7ritubakoyc
---
addons/account_followup/account_followup.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index 093a07d3859..4497a254c50 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -87,10 +87,12 @@ class account_move_partner_info(osv.osv):
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_partner_info')
cr.execute("""
- create or replace view account_move_partner_info as (
+ create or replace view account_move_partner_info as (
SELECT p.id, p.id as partner_id,
max(p.last_reconciliation_date) as last_reconciliation_date,
- max(l.date) as latest_date,
+ max(l.date) as latest_date,
+ count(l.id) as move_lines_count,
+ max(p.partner_move_count) as partner_move_count,
max(l.followup_date) as followup_date,
max(l.followup_line_id) as max_followup_id
FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
From 2685fdad71971a81b6fe27d2ac84157c4d3e69b2 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Thu, 12 Jul 2012 17:45:25 +0530
Subject: [PATCH 024/166] [IMP] unreconsile entry should be default selected
bzr revid: rgaopenerp-20120712121525-llgvoufl9usmeq31
---
addons/account/static/src/js/account.js | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index a3ad0f85ccd..fb911dfa135 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -48,7 +48,7 @@ instance.account.extend_actionmanager = instance.web.ActionManager.include({
instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
init: function(parent, action) {
- this._super.apply(this,arguments);
+ this._super.apply(this, arguments);
//Fix me: pass hard coded model name, find the way to fetch it from server
this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.partner.info', action.context, action.domain);
},
@@ -104,6 +104,7 @@ instance.account.extend_form_view = instance.web.FormView.extend({
viewmanager.action.domain = this.original_domain
$.when(this._super(action)).then(function() {
var id = self.get_fields_values().partner_id;
+ // apply domain on list
viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
viewmanager.searchview.do_search()
})
@@ -153,7 +154,6 @@ instance.account.btn_extend = instance.web.form.WidgetButton.extend({
self.view.on_pager_action()
}
})
-
});
},
})
@@ -188,5 +188,18 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
});
}
})
-
+instance.account.set_selection = instance.web.ListView.List.include({
+ render: function(){
+ this._super()
+ self = this
+ if (this.options.action && this.options.action.extended_form_view_id){
+ this.$current.find('th.oe_list_record_selector input')
+ .closest('tr').each(function () {
+ var record = self.records.get($(this).data('id'));
+ if (!record.get('reconcile_id'))
+ $(this).find('th.oe_list_record_selector input').prop('checked', true)
+ })
+ }
+ }
+})
}
From d3436e56a0101967321d14b6dc6a5713b4f2cdeb Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 17 Jul 2012 10:49:28 +0530
Subject: [PATCH 025/166] [IMP] Add commment
bzr revid: rgaopenerp-20120717051928-iqmcwigxne71zyj8
---
addons/account/static/src/js/account.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index fb911dfa135..1eb66035bb3 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -192,6 +192,7 @@ instance.account.set_selection = instance.web.ListView.List.include({
render: function(){
this._super()
self = this
+ // To Do: Create method on addons which give ids which have to default selected OR create tag like "colors" on tree
if (this.options.action && this.options.action.extended_form_view_id){
this.$current.find('th.oe_list_record_selector input')
.closest('tr').each(function () {
From b6f1b50b34e1474ff3838f65b85472f39fd7e2ee Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 17 Jul 2012 15:56:34 +0530
Subject: [PATCH 026/166] [IMP] view and resolve conflict
bzr revid: rgaopenerp-20120717102634-qklib4p9j6lwahyx
---
addons/account/static/src/css/account.css | 13 +++++++++++-
addons/account/static/src/js/account.js | 25 ++++++++++++++---------
2 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account.css
index d08412655e6..a60d7c24788 100644
--- a/addons/account/static/src/css/account.css
+++ b/addons/account/static/src/css/account.css
@@ -6,7 +6,11 @@
border-radius: 10px;
border:2px solid;
}
-
+
+.openerp .oe_extended_form_view .oe_form_nosheet {
+ margin: 2px;
+}
+
.openerp .oe_pager_m2o li {
display: inline-block;
height: 24px;
@@ -23,6 +27,13 @@
display: inline-block !important;
}
+.openerp .oe_extended_form_view .oe_datepicker_root {
+ display: inline-block;
+ min-width: 100px;
+}
+.openerp .oe_extended_form_view .oe_form_field {
+ width: auto;
+}
.openerp .oe_extended_form_view button {
margin-right: 10px
}
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 1eb66035bb3..63671de2b10 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -16,20 +16,23 @@ instance.account.extend_actionmanager = instance.web.ActionManager.include({
};
}
if (action.target === 'new') {
- if (this.dialog == null) {
- this.dialog = new instance.web.Dialog(this, { width: '80%' });
+ if (this.dialog === null) {
+ // These buttons will be overwrited by if any
+ this.dialog = new instance.web.Dialog(this, {
+ buttons: { "Close": function() { $(this).dialog("close"); }},
+ dialogClass: 'oe_act_window'
+ });
if(on_close)
this.dialog.on_close.add(on_close);
} else {
- this.dialog_viewmanager.destroy();
+ this.dialog_widget.destroy();
}
this.dialog.dialog_title = action.name;
- this.dialog_viewmanager = new instance.web.ViewManagerAction(this, action);
- this.dialog_viewmanager.appendTo(this.dialog.$element);
+ this.dialog_widget = new instance.web.ViewManagerAction(this, action);
+ this.dialog_widget.appendTo(this.dialog.$element);
this.dialog.open();
} else {
this.dialog_stop();
- this.content_stop();
if(action.menu_id) {
return this.getParent().do_action(action, function () {
instance.webclient.menu.open_menu(action.menu_id);
@@ -37,15 +40,17 @@ instance.account.extend_actionmanager = instance.web.ActionManager.include({
}
this.inner_action = action;
if (action.extended_form_view_id){
- this.inner_viewmanager = new instance.account.extend_viewmanager(this, action);
+ var inner_widget = this.inner_widget = new instance.account.extend_viewmanager(this, action);
}else{
- this.inner_viewmanager = new instance.web.ViewManagerAction(this, action);
+ var inner_widget = this.inner_widget = new instance.web.ViewManagerAction(this, action);
}
- this.inner_viewmanager.appendTo(this.$element);
+ inner_widget.add_breadcrumb();
+ this.inner_widget.appendTo(this.$element);
}
- },
+ }
})
+
instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
init: function(parent, action) {
this._super.apply(this, arguments);
From 5a4e4db5187832c40759d7fb86be37437db2448b Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Fri, 20 Jul 2012 11:52:13 +0530
Subject: [PATCH 027/166] [IMP] set default selected record when list view load
bzr revid: rgaopenerp-20120720062213-h78ahslrl7u2zoqr
---
addons/account/account_move_line.py | 10 +++-
addons/account/account_view.xml | 2 +-
addons/account/static/src/js/account.js | 51 ++++++++++++++-----
.../account/wizard/account_reconcile_view.xml | 12 ++---
4 files changed, 51 insertions(+), 24 deletions(-)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index fe29a45ee0f..49698d8ae5b 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -107,7 +107,15 @@ class account_move_line(osv.osv):
query += company_clause
return query
-
+
+ def get_selection_ids(self, cr, uid, ids, context=None):
+ records = self.read(cr, uid, ids, ['reconcile_id'])
+ res = []
+ for record in records:
+ if not record.get('reconcile_id'):
+ res.append(record['id'])
+ return res
+
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
"""
This function returns the residual amount on a receivable or payable account.move.line.
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 8df7613b9c8..3785eec890f 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1023,7 +1023,7 @@
tree
-
+
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 63671de2b10..15ef397aa1a 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -140,6 +140,21 @@ instance.account.many2one_pager = instance.web.form.FieldMany2One.extend({
},
})
instance.account.btn_extend = instance.web.form.WidgetButton.extend({
+ on_click: function() {
+ var self = this;
+ this.force_disabled = true;
+ this.check_disable();
+ this.execute_action().always(function() {
+ self.force_disabled = false;
+ self.check_disable();
+ self.reload_view();
+ });
+
+ },
+ reload_view :function(){
+ viewmanager = this.view.getParent().getParent()
+ viewmanager.inner_widget.list_view.controller.reload_content();
+ },
on_confirmed: function() {
var self = this;
@@ -193,19 +208,29 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
});
}
})
-instance.account.set_selection = instance.web.ListView.List.include({
- render: function(){
- this._super()
- self = this
- // To Do: Create method on addons which give ids which have to default selected OR create tag like "colors" on tree
- if (this.options.action && this.options.action.extended_form_view_id){
- this.$current.find('th.oe_list_record_selector input')
- .closest('tr').each(function () {
- var record = self.records.get($(this).data('id'));
- if (!record.get('reconcile_id'))
- $(this).find('th.oe_list_record_selector input').prop('checked', true)
- })
+instance.account.set_selection = instance.web.ListView.include({
+ default_selection: function(){
+ var self = this
+ selection_method = this.fields_view.arch.attrs.default_selection;
+ if(selection_method){
+ this.dataset.call(selection_method, [this.dataset.ids], this.context).then(_.bind(self.set_selection, self));
}
- }
+ },
+
+ set_selection : function(ids){
+ this.$element.find('th.oe_list_record_selector input')
+ .closest('tr').each(function () {
+ if(_.include(ids, $(this).data('id'))){
+ $(this).find('th.oe_list_record_selector input').prop('checked', true)
+ }
+ }
+ );
+ },
+ reload_content: function() {
+ var reloaded =this._super()
+ var self = this
+ reloaded.done(_.bind(self.default_selection, self))
+ },
})
+
}
diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml
index 947dce930a5..426eeeb4514 100644
--- a/addons/account/wizard/account_reconcile_view.xml
+++ b/addons/account/wizard/account_reconcile_view.xml
@@ -8,21 +8,15 @@
form
-
From a4ca0428b674679e443a43a7ee37da6666c0f13e Mon Sep 17 00:00:00 2001
From: "Hiral Patel (OpenERP)"
Date: Tue, 24 Jul 2012 11:33:27 +0530
Subject: [PATCH 028/166] [MERGE] Merge with hip's branch
bzr revid: hip@tinyerp.com-20120724060327-q05ax15tmp2zdynw
---
addons/account/account_view.xml | 345 ++++++++++++++------------------
1 file changed, 152 insertions(+), 193 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 6388e655f9c..3785eec890f 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -17,6 +17,7 @@
+
@@ -37,10 +38,10 @@
-
+
@@ -98,28 +99,21 @@
form
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -469,59 +463,62 @@
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+
+
+
+
+
+
+
@@ -621,13 +618,6 @@
-
-
-
-
-
-
-
@@ -636,6 +626,7 @@
+
@@ -930,15 +921,15 @@
-
+
-
-
+
+
-
+
@@ -1061,66 +1052,69 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1323,23 +1317,16 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -1431,7 +1418,8 @@
-
+
+
@@ -1539,41 +1527,14 @@
{'view_mode':True}
-
-
- Entries To Reconcile
- account.move.line
- form
- tree,form
-
-
- [('partner_id.customer','=',True)]
- {'view_mode':True}
-
-
-
- Entries To Reconcile
- account.move.line
- form
- tree,form
-
-
- [('partner_id.supplier','=',True)]
- {'view_mode':True}
-
+
-
-
-
-
+
+
+
-
-
+
+
+
+
+
@@ -2631,22 +2597,15 @@ action = pool.get('res.config').next(cr, uid, [], context)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
From 3c434f7450c4da43164470cd0de2516935a3154f Mon Sep 17 00:00:00 2001
From: "Hiral Patel (OpenERP)"
Date: Tue, 24 Jul 2012 11:43:02 +0530
Subject: [PATCH 029/166] [IMP] Add submenu to Manual Reconciliation
bzr revid: hip@tinyerp.com-20120724061302-kxiiioj6n1w8pewp
---
addons/account/account_view.xml | 33 ++++++++++++++++++++++++++++++---
1 file changed, 30 insertions(+), 3 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 3785eec890f..b32ac8d46af 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1516,7 +1516,6 @@
-
Entries To Reconcile
account.move.line
@@ -1527,14 +1526,42 @@
{'view_mode':True}
-
+
+
+ Entries To Reconcile
+ account.move.line
+ form
+ tree,form
+
+
+ [('partner_id.customer','=',True)]
+ {'view_mode':True}
+
+
+
+ Entries To Reconcile
+ account.move.line
+ form
+ tree,form
+
+
+ [('partner_id.supplier','=',True)]
+ {'view_mode':True}
+
+
+
+
+
Date: Fri, 27 Jul 2012 02:26:59 +0530
Subject: [PATCH 030/166] [ADD]: Add dependency ii) move wizard , yaml file
iii) move stock method into sale_stock. iv) add security into sale_stock
module.
bzr revid: atp@tinyerp.com-20120726205659-xiyx39r3dibshyjs
---
addons/event_sale/__openerp__.py | 2 +-
addons/multi_company/__openerp__.py | 2 +-
addons/portal_sale/__openerp__.py | 2 +-
.../process/project_mrp_process.xml | 2 +-
addons/sale/__init__.py | 2 -
addons/sale/__openerp__.py | 23 +-
addons/sale/edi/sale_order.py | 23 +-
addons/sale/edi/sale_order_action_data.xml | 4 +-
addons/sale/process/sale_process.xml | 147 ----
addons/sale/report/sale_report.py | 6 -
addons/sale/report/sale_report_view.xml | 1 -
addons/sale/res_config.py | 45 +-
addons/sale/res_config_view.xml | 10 +-
addons/sale/sale.py | 501 +-------------
addons/sale/sale_data.xml | 1 -
addons/sale/sale_demo.xml | 35 -
addons/sale/sale_view.xml | 58 +-
addons/sale/sale_workflow.xml | 86 +--
addons/sale/security/ir.model.access.csv | 21 +-
addons/sale/security/sale_security.xml | 9 -
addons/sale/test/cancel_order.yml | 71 +-
addons/sale/test/delete_order.yml | 2 +-
addons/sale/test/edi_sale_order.yml | 4 +-
addons/sale/test/prepaid_order_policy.yml | 1 -
addons/sale/wizard/__init__.py | 3 -
addons/sale_crm/__openerp__.py | 2 +-
addons/sale_journal/__openerp__.py | 2 +-
addons/sale_margin/__openerp__.py | 2 +-
addons/sale_mrp/__openerp__.py | 2 +-
addons/sale_stock/__init__.py | 29 +
addons/sale_stock/__openerp__.py | 87 +++
addons/{sale => sale_stock}/company.py | 0
addons/{sale => sale_stock}/company_view.xml | 0
.../sale_stock/process/sale_stock_process.xml | 142 ++++
addons/sale_stock/report/__init__.py | 21 +
addons/sale_stock/report/sale_report.py | 93 +++
addons/sale_stock/report/sale_report_view.xml | 16 +
addons/sale_stock/res_config.py | 86 +++
addons/sale_stock/res_config_view.xml | 45 ++
addons/sale_stock/sale_stock.py | 639 ++++++++++++++++++
addons/sale_stock/sale_stock_data.xml | 8 +
addons/sale_stock/sale_stock_demo.xml | 109 +++
addons/sale_stock/sale_stock_view.xml | 150 ++++
addons/sale_stock/sale_stock_workflow.xml | 125 ++++
.../sale_stock/security/ir.model.access.csv | 17 +
.../security/sale_stock_security.xml | 17 +
addons/{sale => sale_stock}/stock.py | 0
addons/{sale => sale_stock}/stock_view.xml | 2 +-
.../test/cancel_order_sale_stock.yml | 42 ++
.../test/manual_order_policy.yml | 22 +-
.../test/picking_order_policy.yml | 26 +-
addons/sale_stock/wizard/__init__.py | 25 +
.../wizard/sale_make_invoice.py | 0
.../wizard/sale_make_invoice.xml | 0
.../wizard/sale_make_invoice_advance.py | 0
.../wizard/sale_make_invoice_advance.xml | 0
56 files changed, 1744 insertions(+), 1026 deletions(-)
create mode 100644 addons/sale_stock/__init__.py
create mode 100644 addons/sale_stock/__openerp__.py
rename addons/{sale => sale_stock}/company.py (100%)
rename addons/{sale => sale_stock}/company_view.xml (100%)
create mode 100644 addons/sale_stock/process/sale_stock_process.xml
create mode 100644 addons/sale_stock/report/__init__.py
create mode 100644 addons/sale_stock/report/sale_report.py
create mode 100644 addons/sale_stock/report/sale_report_view.xml
create mode 100644 addons/sale_stock/res_config.py
create mode 100644 addons/sale_stock/res_config_view.xml
create mode 100644 addons/sale_stock/sale_stock.py
create mode 100644 addons/sale_stock/sale_stock_data.xml
create mode 100644 addons/sale_stock/sale_stock_demo.xml
create mode 100644 addons/sale_stock/sale_stock_view.xml
create mode 100644 addons/sale_stock/sale_stock_workflow.xml
create mode 100644 addons/sale_stock/security/ir.model.access.csv
create mode 100644 addons/sale_stock/security/sale_stock_security.xml
rename addons/{sale => sale_stock}/stock.py (100%)
rename addons/{sale => sale_stock}/stock_view.xml (98%)
create mode 100644 addons/sale_stock/test/cancel_order_sale_stock.yml
rename addons/{sale => sale_stock}/test/manual_order_policy.yml (83%)
rename addons/{sale => sale_stock}/test/picking_order_policy.yml (91%)
create mode 100644 addons/sale_stock/wizard/__init__.py
rename addons/{sale => sale_stock}/wizard/sale_make_invoice.py (100%)
rename addons/{sale => sale_stock}/wizard/sale_make_invoice.xml (100%)
rename addons/{sale => sale_stock}/wizard/sale_make_invoice_advance.py (100%)
rename addons/{sale => sale_stock}/wizard/sale_make_invoice_advance.xml (100%)
diff --git a/addons/event_sale/__openerp__.py b/addons/event_sale/__openerp__.py
index ff65d0e9172..a0cd3521aa4 100644
--- a/addons/event_sale/__openerp__.py
+++ b/addons/event_sale/__openerp__.py
@@ -38,7 +38,7 @@ when you confirm your sale order it will automatically create a registration for
this event.
""",
'author': 'OpenERP SA',
- 'depends': ['event','sale','sale_crm'],
+ 'depends': ['event', 'sale_crm'],
'update_xml': [
'event_sale_view.xml',
],
diff --git a/addons/multi_company/__openerp__.py b/addons/multi_company/__openerp__.py
index c8e06b5cf2b..3550e304551 100644
--- a/addons/multi_company/__openerp__.py
+++ b/addons/multi_company/__openerp__.py
@@ -34,7 +34,7 @@ This module is the base module for other multi-company modules.
'website': 'http://www.openerp.com/',
'depends': [
'base',
- 'sale',
+ 'sale_stock',
'project',
],
'init_xml': [],
diff --git a/addons/portal_sale/__openerp__.py b/addons/portal_sale/__openerp__.py
index f87bebd19fd..c6a35d7c9e6 100644
--- a/addons/portal_sale/__openerp__.py
+++ b/addons/portal_sale/__openerp__.py
@@ -30,7 +30,7 @@ This module adds sale menu and features to your portal if sale and portal are
installed.
""",
'author': 'OpenERP SA',
- 'depends': ['sale','portal'],
+ 'depends': ['sale_stock','portal'],
'data': [
'security/portal_security.xml',
'portal_sale_view.xml',
diff --git a/addons/project_mrp/process/project_mrp_process.xml b/addons/project_mrp/process/project_mrp_process.xml
index 33d8698ce3d..729f107b755 100644
--- a/addons/project_mrp/process/project_mrp_process.xml
+++ b/addons/project_mrp/process/project_mrp_process.xml
@@ -51,7 +51,7 @@
-
+
diff --git a/addons/sale/__init__.py b/addons/sale/__init__.py
index fe19b7fa609..5a7b4b499df 100644
--- a/addons/sale/__init__.py
+++ b/addons/sale/__init__.py
@@ -24,11 +24,9 @@
#----------------------------------------------------------
import sale
-import stock
import res_partner
import wizard
import report
-import company
import edi
import res_config
diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py
index f5bf1adb436..438137daa64 100644
--- a/addons/sale/__openerp__.py
+++ b/addons/sale/__openerp__.py
@@ -35,8 +35,6 @@ Workflow with validation steps:
Create Invoice:
---------------
- * Invoice on Demand
- * Invoice on Delivery Order
* Invoice Before Delivery
Partners preferences:
@@ -45,16 +43,6 @@ Partners preferences:
* Shipping
* Invoicing
-Products stocks and prices:
---------------------------
-
-Delivery method:
------------------
- * The Poste
- * Free Delivery Charges
- * Normal Delivery Charges
- * Based on the Delivery Order(if not Add to sale order)
-
Dashboard for Sales Manager that includes:
------------------------------------------
* My Quotations
@@ -63,15 +51,11 @@ Dashboard for Sales Manager that includes:
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/deliveries_to_invoice.jpeg','images/sale_dashboard.jpeg','images/Sale_order_line_to_invoice.jpeg','images/sale_order.jpeg','images/sales_analysis.jpeg'],
- 'depends': ['stock', 'procurement', 'board', 'account_voucher'],
+ 'depends': ['board', 'account_voucher'],
'init_xml': [],
- 'update_xml': [
- 'wizard/sale_make_invoice_advance.xml',
- 'wizard/sale_line_invoice.xml',
- 'wizard/sale_make_invoice.xml',
+ 'update_xml': ['wizard/sale_line_invoice.xml',
'security/sale_security.xml',
'security/ir.model.access.csv',
- 'company_view.xml',
'sale_workflow.xml',
'sale_sequence.xml',
'sale_report.xml',
@@ -79,7 +63,6 @@ Dashboard for Sales Manager that includes:
'sale_view.xml',
'res_partner_view.xml',
'report/sale_report_view.xml',
- 'stock_view.xml',
'process/sale_process.xml',
'board_sale_view.xml',
'edi/sale_order_action_data.xml',
@@ -88,8 +71,6 @@ Dashboard for Sales Manager that includes:
'demo_xml': ['sale_demo.xml'],
'test': [
'test/sale_order_demo.yml',
- 'test/picking_order_policy.yml',
- 'test/manual_order_policy.yml',
'test/prepaid_order_policy.yml',
'test/cancel_order.yml',
'test/delete_order.yml',
diff --git a/addons/sale/edi/sale_order.py b/addons/sale/edi/sale_order.py
index b850922cbb2..cbde0cc742a 100644
--- a/addons/sale/edi/sale_order.py
+++ b/addons/sale/edi/sale_order.py
@@ -185,16 +185,17 @@ class sale_order(osv.osv, EDIMixin):
order_lines = edi_document['order_line']
for order_line in order_lines:
- self._edi_requires_attributes(('date_planned', 'product_id', 'product_uom', 'product_qty', 'price_unit'), order_line)
+ self._edi_requires_attributes(( 'product_id', 'product_uom', 'product_qty', 'price_unit'), order_line)
order_line['product_uom_qty'] = order_line['product_qty']
del order_line['product_qty']
- date_planned = order_line.pop('date_planned')
- delay = 0
- if date_order and date_planned:
- # no security_days buffer, this is the promised date given by supplier
- delay = (datetime.strptime(date_planned, DEFAULT_SERVER_DATE_FORMAT) - \
- datetime.strptime(date_order, DEFAULT_SERVER_DATE_FORMAT)).days
- order_line['delay'] = delay
+ #Need to move sale_stock
+# date_planned = order_line.pop('date_planned')
+# delay = 0
+# if date_order and date_planned:
+# # no security_days buffer, this is the promised date given by supplier
+# delay = (datetime.strptime(date_planned, DEFAULT_SERVER_DATE_FORMAT) - \
+# datetime.strptime(date_order, DEFAULT_SERVER_DATE_FORMAT)).days
+# order_line['delay'] = delay
# discard web preview fields, if present
order_line.pop('price_subtotal', None)
@@ -218,9 +219,9 @@ class sale_order_line(osv.osv, EDIMixin):
# company.security_days is for internal use, so customer should only
# see the expected date_planned based on line.delay
- date_planned = datetime.strptime(line.order_id.date_order, DEFAULT_SERVER_DATE_FORMAT) + \
- relativedelta(days=line.delay or 0.0)
- edi_doc['date_planned'] = date_planned.strftime(DEFAULT_SERVER_DATE_FORMAT)
+# date_planned = datetime.strptime(line.order_id.date_order, DEFAULT_SERVER_DATE_FORMAT) + \
+# relativedelta(days=line.delay or 0.0)
+# edi_doc['date_planned'] = date_planned.strftime(DEFAULT_SERVER_DATE_FORMAT)
edi_doc_list.append(edi_doc)
return edi_doc_list
diff --git a/addons/sale/edi/sale_order_action_data.xml b/addons/sale/edi/sale_order_action_data.xml
index 2fe0a8cbfd3..4f1eb1c81cf 100644
--- a/addons/sale/edi/sale_order_action_data.xml
+++ b/addons/sale/edi/sale_order_action_data.xml
@@ -28,10 +28,10 @@
-
+
diff --git a/addons/sale/process/sale_process.xml b/addons/sale/process/sale_process.xml
index b688f2aeb7f..05999ff6fb8 100644
--- a/addons/sale/process/sale_process.xml
+++ b/addons/sale/process/sale_process.xml
@@ -28,18 +28,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -62,38 +50,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -142,54 +98,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -217,61 +125,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py
index 6beac7cfd38..0062ca4313c 100644
--- a/addons/sale/report/sale_report.py
+++ b/addons/sale/report/sale_report.py
@@ -30,8 +30,6 @@ class sale_report(osv.osv):
_columns = {
'date': fields.date('Date Order', readonly=True),
'date_confirm': fields.date('Date Confirm', readonly=True),
- 'shipped': fields.boolean('Shipped', readonly=True),
- 'shipped_qty_1': fields.integer('Shipped', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'),
('05', 'May'), ('06', 'June'), ('07', 'July'), ('08', 'August'), ('09', 'September'),
@@ -54,7 +52,6 @@ class sale_report(osv.osv):
('waiting_date', 'Waiting Schedule'),
('manual', 'Manual In Progress'),
('progress', 'In Progress'),
- ('shipping_except', 'Shipping Exception'),
('invoice_except', 'Invoice Exception'),
('done', 'Done'),
('cancel', 'Cancelled')
@@ -86,8 +83,6 @@ class sale_report(osv.osv):
extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
s.state,
t.categ_id as categ_id,
- s.shipped,
- s.shipped::integer as shipped_qty_1,
s.pricelist_id as pricelist_id,
s.project_id as analytic_account_id
from
@@ -110,7 +105,6 @@ class sale_report(osv.osv):
s.shop_id,
s.company_id,
s.state,
- s.shipped,
s.pricelist_id,
s.project_id
)
diff --git a/addons/sale/report/sale_report_view.xml b/addons/sale/report/sale_report_view.xml
index 8eb4fc85ce6..d572a47b80f 100644
--- a/addons/sale/report/sale_report_view.xml
+++ b/addons/sale/report/sale_report_view.xml
@@ -21,7 +21,6 @@
-
diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py
index 45c01c582a0..1b1d167578d 100644
--- a/addons/sale/res_config.py
+++ b/addons/sale/res_config.py
@@ -30,14 +30,6 @@ class sale_configuration(osv.osv_memory):
'group_invoice_so_lines': fields.boolean('Based on Sale Orders',
implied_group='sale.group_invoice_so_lines',
help="To allow your salesman to make invoices for sale order lines using the menu 'Lines to Invoice'."),
- 'group_invoice_deli_orders': fields.boolean('Based on Delivery Orders',
- implied_group='sale.group_invoice_deli_orders',
- help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."),
- 'task_work': fields.boolean('Based on Task Activities',
- help="""Lets you transfer the entries under tasks defined for Project Management to
- the Timesheet line entries for particular date and particular user with the effect of creating, editing and deleting either ways
- and to automatically creates project tasks from procurement lines.
- This installs the modules project_timesheet and project_mrp."""),
'timesheet': fields.boolean('Based on Timesheet',
help = """For modifying account analytic view to show important data to project manager of services companies.
You can also view the report of account analytic summary user-wise as well as month wise.
@@ -49,16 +41,10 @@ class sale_configuration(osv.osv_memory):
You will be able to follow the progress of the contract and invoice automatically.
It installs the account_analytic_analysis module."""),
'default_order_policy': fields.selection(
- [('manual', 'Invoice Based on Sales Orders'), ('picking', 'Invoice Based on Deliveries')],
+ [('manual', 'Invoice Based on Sales Orders')],
'Default Method', default_model='sale.order',
- help="You can generate invoices based on sales orders or based on shippings."),
- 'module_delivery': fields.boolean('Allow Charging Shipping Costs',
- help ="""Allows you to add delivery methods in sale orders and delivery orders.
- You can define your own carrier and delivery grids for prices.
- This installs the module delivery."""),
+ help="You can generate invoices based on sales orders."),
'time_unit': fields.many2one('product.uom', 'Working Time Unit'),
- 'default_picking_policy' : fields.boolean("Configurable Shipping Policy",
- help = "You will be able to configure, per sale order, if you deliver all products at once or if you deliver each product when it is available. This may have an impact on the shipping price."),
'group_sale_pricelist':fields.boolean("Pricelist per Customer",
implied_group='product.group_sale_pricelist',
help="""Allows to manage different prices based on rules per category of customers.
@@ -69,15 +55,9 @@ class sale_configuration(osv.osv_memory):
'group_sale_delivery_address': fields.boolean("Allow Different Addresses for Delivery and Invoice",
implied_group='sale.group_delivery_invoice_address',
help="Allows you to specify different delivery and invoice addresses on a sale order."),
- 'group_mrp_properties': fields.boolean('Properties on Lines',
- implied_group='sale.group_mrp_properties',
- help="Allows you to tag sale order lines with properties."),
'group_discount_per_so_line': fields.boolean("Discount per Line",
implied_group='sale.group_discount_per_so_line',
help="Allows you to apply some discount per sale order line."),
- 'group_multiple_shops': fields.boolean("Manage Multiple Shops",
- implied_group='stock.group_locations',
- help="This allows to configure and use multiple shops."),
'module_warning': fields.boolean("Alerts by Products or Customers",
help="""Allow to configure warnings on products and trigger them when a user wants to sale a given product or a given customer.
Example: Product: this product is deprecated, do not purchase more than 5.
@@ -95,8 +75,6 @@ class sale_configuration(osv.osv_memory):
This is mostly used when a user encodes his timesheet. The values are retrieved and the fields are auto-filled.
But the possibility to change these values is still available.
This installs the module analytic_user_function."""),
- 'module_project_timesheet': fields.boolean("Project Timesheet"),
- 'module_project_mrp': fields.boolean("Project MRP"),
'module_project': fields.boolean("Project"),
'decimal_precision': fields.integer('Decimal Precision on Price',help="As an example, a decimal precision of 2 will allow prices like: 9.99 EUR, whereas a decimal precision of 4 will allow prices like: 0.0231 EUR per unit."),
}
@@ -113,8 +91,6 @@ class sale_configuration(osv.osv_memory):
def default_get(self, cr, uid, fields, context=None):
ir_model_data = self.pool.get('ir.model.data')
res = super(sale_configuration, self).default_get(cr, uid, fields, context)
- # task_work, time_unit depend on other fields
- res['task_work'] = res.get('module_project_mrp') and res.get('module_project_timesheet')
if res.get('module_project'):
user = self.pool.get('res.users').browse(cr, uid, uid, context)
res['time_unit'] = user.company_id.project_time_mode_id.id
@@ -123,13 +99,6 @@ class sale_configuration(osv.osv_memory):
res['time_unit'] = product.uom_id.id
return res
- def get_default_sale_config(self, cr, uid, ids, context=None):
- ir_values = self.pool.get('ir.values')
- default_picking_policy = ir_values.get_default(cr, uid, 'sale.order', 'picking_policy')
- return {
- 'default_picking_policy': default_picking_policy == 'one',
- }
-
def _get_default_time_unit(self, cr, uid, context=None):
ids = self.pool.get('product.uom').search(cr, uid, [('name', '=', _('Hour'))], context=context)
return ids and ids[0] or False
@@ -149,13 +118,9 @@ class sale_configuration(osv.osv_memory):
dp.write({'digits': config.decimal_precision})
def set_sale_defaults(self, cr, uid, ids, context=None):
- ir_values = self.pool.get('ir.values')
ir_model_data = self.pool.get('ir.model.data')
wizard = self.browse(cr, uid, ids)[0]
- default_picking_policy = 'one' if wizard.default_picking_policy else 'direct'
- ir_values.set_default(cr, uid, 'sale.order', 'picking_policy', default_picking_policy)
-
if wizard.time_unit:
product = ir_model_data.get_object(cr, uid, 'product', 'product_consultant')
product.write({'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
@@ -166,11 +131,9 @@ class sale_configuration(osv.osv_memory):
return {}
- def onchange_invoice_methods(self, cr, uid, ids, group_invoice_so_lines, group_invoice_deli_orders, context=None):
- if not group_invoice_deli_orders:
+ def onchange_invoice_methods(self, cr, uid, ids, group_invoice_so_lines, context=None):
+ if group_invoice_so_lines:
return {'value': {'default_order_policy': 'manual'}}
- if not group_invoice_so_lines:
- return {'value': {'default_order_policy': 'picking'}}
return {}
def onchange_task_work(self, cr, uid, ids, task_work, context=None):
diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml
index ee05a6d2d26..acd545122ce 100644
--- a/addons/sale/res_config_view.xml
+++ b/addons/sale/res_config_view.xml
@@ -9,29 +9,21 @@
-
-
-
-
-
-
-
-
-
+
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index f920b34ca42..a5316ce10fa 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -35,7 +35,6 @@ class sale_shop(osv.osv):
_columns = {
'name': fields.char('Shop Name', size=64, required=True),
'payment_default_id': fields.many2one('account.payment.term', 'Default Payment Term', required=True),
- 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
'project_id': fields.many2one('account.analytic.account', 'Analytic Account', domain=[('parent_id', '!=', False)]),
'company_id': fields.many2one('res.company', 'Company', required=False),
@@ -50,16 +49,13 @@ class sale_order(osv.osv):
_name = "sale.order"
_inherit = ['ir.needaction_mixin', 'mail.thread']
_description = "Sales Order"
-
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
default.update({
'state': 'draft',
- 'shipped': False,
'invoice_ids': [],
- 'picking_ids': [],
'date_confirm': False,
'name': self.pool.get('ir.sequence').get(cr, uid, 'sale.order'),
})
@@ -90,44 +86,6 @@ class sale_order(osv.osv):
res[order.id]['amount_total'] = res[order.id]['amount_untaxed'] + res[order.id]['amount_tax']
return res
- # This is False
- def _picked_rate(self, cr, uid, ids, name, arg, context=None):
- if not ids:
- return {}
- res = {}
- tmp = {}
- for id in ids:
- tmp[id] = {'picked': 0.0, 'total': 0.0}
- cr.execute('''SELECT
- p.sale_id as sale_order_id, sum(m.product_qty) as nbr, mp.state as procurement_state, m.state as move_state, p.type as picking_type
- FROM
- stock_move m
- LEFT JOIN
- stock_picking p on (p.id=m.picking_id)
- LEFT JOIN
- procurement_order mp on (mp.move_id=m.id)
- WHERE
- p.sale_id IN %s GROUP BY m.state, mp.state, p.sale_id, p.type''', (tuple(ids),))
-
- for item in cr.dictfetchall():
- if item['move_state'] == 'cancel':
- continue
-
- if item['picking_type'] == 'in':#this is a returned picking
- tmp[item['sale_order_id']]['total'] -= item['nbr'] or 0.0 # Deducting the return picking qty
- if item['procurement_state'] == 'done' or item['move_state'] == 'done':
- tmp[item['sale_order_id']]['picked'] -= item['nbr'] or 0.0
- else:
- tmp[item['sale_order_id']]['total'] += item['nbr'] or 0.0
- if item['procurement_state'] == 'done' or item['move_state'] == 'done':
- tmp[item['sale_order_id']]['picked'] += item['nbr'] or 0.0
-
- for order in self.browse(cr, uid, ids, context=context):
- if order.shipped:
- res[order.id] = 100.0
- else:
- res[order.id] = tmp[order.id]['total'] and (100.0 * tmp[order.id]['picked'] / tmp[order.id]['total']) or 0.0
- return res
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None):
res = {}
@@ -208,11 +166,9 @@ class sale_order(osv.osv):
('cancel', 'Cancelled'),
('waiting_date', 'Waiting Schedule'),
('progress', 'Sale Order'),
- ('manual', 'Sale to Invoice'),
- ('shipping_except', 'Shipping Exception'),
('invoice_except', 'Invoice Exception'),
('done', 'Done'),
- ], 'Status', readonly=True, help="Gives the state of the quotation or sales order. \nThe exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception) or in the picking list process (Shipping Exception). \nThe 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True),
+ ], 'Status', readonly=True, help="Gives the state of the quotation or sales order. \nThe exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception). \nThe 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True),
'date_order': fields.date('Date', required=True, readonly=True, select=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
'create_date': fields.datetime('Creation Date', readonly=True, select=True, help="Date on which sales order is created."),
'date_confirm': fields.date('Confirmation Date', readonly=True, select=True, help="Date on which sales order is confirmed."),
@@ -220,28 +176,16 @@ class sale_order(osv.osv):
'partner_id': fields.many2one('res.partner', 'Customer', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, required=True, change_default=True, select=True),
'partner_invoice_id': fields.many2one('res.partner', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Invoice address for current sales order."),
'partner_shipping_id': fields.many2one('res.partner', 'Shipping Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Shipping address for current sales order."),
-
- 'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction."),
- 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')],
- 'Shipping Policy', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
- help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""),
'order_policy': fields.selection([
- ('manual', 'On Demand'),
- ('picking', 'On Delivery Order'),
('prepaid', 'Before Delivery'),
], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
help="""This field controls how invoice and delivery operations are synchronized.
- - With 'On Demand', the invoice is created manually when needed.
- - With 'On Delivery Order', a draft invoice is generated after all pickings have been processed.
- With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Pricelist for current sales order."),
'project_id': fields.many2one('account.analytic.account', 'Contract/Analytic Account', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="The analytic account related to a sales order."),
'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoices', readonly=True, help="This is the list of invoices that have been generated for this sales order. The same sales order may have been invoiced in several times (by line for example)."),
- 'picking_ids': fields.one2many('stock.picking.out', 'sale_id', 'Related Picking', readonly=True, help="This is a list of delivery orders that has been generated for this sales order."),
- 'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sales order has been delivered. This field is updated only after the scheduler(s) have been launched."),
- 'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
'invoiced_rate': fields.function(_invoiced_rate, string='Invoiced', type='float'),
'invoiced': fields.function(_invoiced, string='Paid',
fnct_search=_invoiced_search, type='boolean', help="It indicates that an invoice has been paid."),
@@ -266,15 +210,14 @@ class sale_order(osv.osv):
},
multi='sums', help="The total amount."),
- 'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you want your invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks.", required=True, readonly=True, states={'draft': [('readonly', False)]}),
+ 'invoice_quantity': fields.selection([('order', 'Ordered Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you want your invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks.", required=True, readonly=True, states={'draft': [('readonly', False)]}),
'payment_term': fields.many2one('account.payment.term', 'Payment Term'),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
'company_id': fields.related('shop_id','company_id',type='many2one',relation='res.company',string='Company',store=True,readonly=True)
}
_defaults = {
- 'picking_policy': 'direct',
'date_order': fields.date.context_today,
- 'order_policy': 'manual',
+ 'order_policy': 'prepaid',
'state': 'draft',
'user_id': lambda obj, cr, uid, context: uid,
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'sale.order'),
@@ -295,8 +238,7 @@ class sale_order(osv.osv):
if s['state'] in ['draft', 'cancel']:
unlink_ids.append(s['id'])
else:
- raise osv.except_osv(_('Invalid action !'), _('In order to delete a confirmed sale order, you must cancel it before ! To cancel a sale order, you must first cancel related picking or delivery orders.'))
-
+ raise osv.except_osv(_('Invalid action !'), _('In order to delete a confirmed sale order, you must cancel it before !'))
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
def onchange_shop_id(self, cr, uid, ids, shop_id):
@@ -309,20 +251,6 @@ class sale_order(osv.osv):
v['pricelist_id'] = shop.pricelist_id.id
return {'value': v}
- def action_cancel_draft(self, cr, uid, ids, context=None):
- if not len(ids):
- return False
- cr.execute('select id from sale_order_line where order_id IN %s and state=%s', (tuple(ids), 'cancel'))
- line_ids = map(lambda x: x[0], cr.fetchall())
- self.write(cr, uid, ids, {'state': 'draft', 'invoice_ids': [], 'shipped': 0})
- self.pool.get('sale.order.line').write(cr, uid, line_ids, {'invoiced': False, 'state': 'draft', 'invoice_lines': [(6, 0, [])]})
- wf_service = netsvc.LocalService("workflow")
- for inv_id in ids:
- # Deleting the existing instance of workflow for SO
- wf_service.trg_delete(uid, 'sale.order', inv_id, cr)
- wf_service.trg_create(uid, 'sale.order', inv_id, cr)
- self.action_cancel_draft_send_note(cr, uid, ids, context=context)
- return True
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context={}):
if (not pricelist_id) or (not order_lines):
@@ -333,15 +261,6 @@ class sale_order(osv.osv):
}
return {'warning': warning}
- def onchange_partner_order_id(self, cr, uid, ids, order_id, invoice_id=False, shipping_id=False, context={}):
- if not order_id:
- return {}
- val = {}
- if not invoice_id:
- val['partner_invoice_id'] = order_id
- if not shipping_id:
- val['partner_shipping_id'] = order_id
- return {'value': val}
def onchange_partner_id(self, cr, uid, ids, part):
if not part:
@@ -364,30 +283,7 @@ class sale_order(osv.osv):
val['pricelist_id'] = pricelist
return {'value': val}
- def shipping_policy_change(self, cr, uid, ids, policy, context=None):
- if not policy:
- return {}
- inv_qty = 'order'
- if policy == 'prepaid':
- inv_qty = 'order'
- elif policy == 'picking':
- inv_qty = 'procurement'
- return {'value': {'invoice_quantity': inv_qty}}
-
- def write(self, cr, uid, ids, vals, context=None):
- if vals.get('order_policy', False):
- if vals['order_policy'] == 'prepaid':
- vals.update({'invoice_quantity': 'order'})
- elif vals['order_policy'] == 'picking':
- vals.update({'invoice_quantity': 'procurement'})
- return super(sale_order, self).write(cr, uid, ids, vals, context=context)
-
def create(self, cr, uid, vals, context=None):
- if vals.get('order_policy', False):
- if vals['order_policy'] == 'prepaid':
- vals.update({'invoice_quantity': 'order'})
- if vals['order_policy'] == 'picking':
- vals.update({'invoice_quantity': 'procurement'})
order = super(sale_order, self).create(cr, uid, vals, context=context)
if order:
self.create_send_note(cr, uid, [order], context=context)
@@ -547,46 +443,10 @@ class sale_order(osv.osv):
result.update(view_id = res and res[1] or False)
return result
-
- def action_view_delivery(self, cr, uid, ids, context=None):
- '''
- This function returns an action that display existing delivery orders of given sale order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
- '''
- mod_obj = self.pool.get('ir.model.data')
- result = {
- 'name': _('Delivery Order'),
- 'view_type': 'form',
- 'res_model': 'stock.picking',
- 'context': "{'type':'out'}",
- 'type': 'ir.actions.act_window',
- 'nodestroy': True,
- 'target': 'current',
- }
- #compute the number of delivery orders to display
- pick_ids = []
- for so in self.browse(cr, uid, ids, context=context):
- pick_ids += [picking.id for picking in so.picking_ids]
- #choose the view_mode accordingly
- if len(pick_ids) > 1:
- res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_tree')
- result.update({
- 'view_mode': 'tree,form',
- 'res_id': pick_ids or False
- })
- else:
- res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_form')
- result.update({
- 'view_mode': 'form',
- 'res_id': pick_ids and pick_ids[0] or False,
- })
- result.update(view_id = res and res[1] or False)
- return result
-
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
res = False
invoices = {}
invoice_ids = []
- picking_obj = self.pool.get('stock.picking')
invoice = self.pool.get('account.invoice')
obj_sale_order_line = self.pool.get('sale.order.line')
partner_currency = {}
@@ -625,8 +485,6 @@ class sale_order(osv.osv):
for o, l in val:
invoice_ref += o.name + '|'
self.write(cr, uid, [o.id], {'state': 'progress'})
- if o.order_policy == 'picking':
- picking_obj.write(cr, uid, map(lambda x: x.id, o.picking_ids), {'invoice_state': 'invoiced'})
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
else:
@@ -634,8 +492,6 @@ class sale_order(osv.osv):
res = self._make_invoice(cr, uid, order, il, context=context)
invoice_ids.append(res)
self.write(cr, uid, [order.id], {'state': 'progress'})
- if order.order_policy == 'picking':
- picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'})
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (order.id, res))
if res:
self.invoice_send_note(cr, uid, ids, res, context)
@@ -697,22 +553,7 @@ class sale_order(osv.osv):
if context is None:
context = {}
sale_order_line_obj = self.pool.get('sale.order.line')
- proc_obj = self.pool.get('procurement.order')
for sale in self.browse(cr, uid, ids, context=context):
- for pick in sale.picking_ids:
- if pick.state not in ('draft', 'cancel'):
- raise osv.except_osv(
- _('Could not cancel sales order !'),
- _('You must first cancel all picking attached to this sales order.'))
- if pick.state == 'cancel':
- for mov in pick.move_lines:
- proc_ids = proc_obj.search(cr, uid, [('move_id', '=', mov.id)])
- if proc_ids:
- for proc in proc_ids:
- wf_service.trg_validate(uid, 'procurement.order', proc, 'button_check', cr)
- for r in self.read(cr, uid, ids, ['picking_ids']):
- for pick in r['picking_ids']:
- wf_service.trg_validate(uid, 'stock.picking', pick, 'button_cancel', cr)
for inv in sale.invoice_ids:
if inv.state not in ('draft', 'cancel'):
raise osv.except_osv(
@@ -751,10 +592,7 @@ class sale_order(osv.osv):
for o in self.browse(cr, uid, ids):
if not o.order_line:
raise osv.except_osv(_('Error !'),_('You cannot confirm a sale order which has no line.'))
- if (o.order_policy == 'manual'):
- self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
- else:
- self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
+ self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
self.confirm_send_note(cr, uid, ids, context)
return True
@@ -783,241 +621,6 @@ class sale_order(osv.osv):
'nodestroy': True,
}
- def procurement_lines_get(self, cr, uid, ids, *args):
- res = []
- for order in self.browse(cr, uid, ids, context={}):
- for line in order.order_line:
- if line.procurement_id:
- res.append(line.procurement_id.id)
- return res
-
- # if mode == 'finished':
- # returns True if all lines are done, False otherwise
- # if mode == 'canceled':
- # returns True if there is at least one canceled line, False otherwise
- def test_state(self, cr, uid, ids, mode, *args):
- assert mode in ('finished', 'canceled'), _("invalid mode for test_state")
- finished = True
- canceled = False
- notcanceled = False
- write_done_ids = []
- write_cancel_ids = []
- for order in self.browse(cr, uid, ids, context={}):
- for line in order.order_line:
- if (not line.procurement_id) or (line.procurement_id.state=='done'):
- if line.state != 'done':
- write_done_ids.append(line.id)
- else:
- finished = False
- if line.procurement_id:
- if (line.procurement_id.state == 'cancel'):
- canceled = True
- if line.state != 'exception':
- write_cancel_ids.append(line.id)
- else:
- notcanceled = True
- if write_done_ids:
- self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
- if write_cancel_ids:
- self.pool.get('sale.order.line').write(cr, uid, write_cancel_ids, {'state': 'exception'})
-
- if mode == 'finished':
- return finished
- elif mode == 'canceled':
- return canceled
- if notcanceled:
- return False
- return canceled
-
- def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
- return {
- 'name': line.name.split('\n')[0],
- 'origin': order.name,
- 'date_planned': date_planned,
- 'product_id': line.product_id.id,
- 'product_qty': line.product_uom_qty,
- 'product_uom': line.product_uom.id,
- 'product_uos_qty': (line.product_uos and line.product_uos_qty)\
- or line.product_uom_qty,
- 'product_uos': (line.product_uos and line.product_uos.id)\
- or line.product_uom.id,
- 'location_id': order.shop_id.warehouse_id.lot_stock_id.id,
- 'procure_method': line.type,
- 'move_id': move_id,
- 'company_id': order.company_id.id,
- 'note': '\n'.join(line.name.split('\n')[1:]),
- 'property_ids': [(6, 0, [x.id for x in line.property_ids])]
- }
-
- def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planned, context=None):
- location_id = order.shop_id.warehouse_id.lot_stock_id.id
- output_id = order.shop_id.warehouse_id.lot_output_id.id
- return {
- 'name': line.name.split('\n')[0][:250],
- 'picking_id': picking_id,
- 'product_id': line.product_id.id,
- 'date': date_planned,
- 'date_expected': date_planned,
- 'product_qty': line.product_uom_qty,
- 'product_uom': line.product_uom.id,
- 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
- 'product_uos': (line.product_uos and line.product_uos.id)\
- or line.product_uom.id,
- 'product_packaging': line.product_packaging.id,
- 'partner_id': line.address_allotment_id.id or order.partner_shipping_id.id,
- 'location_id': location_id,
- 'location_dest_id': output_id,
- 'sale_line_id': line.id,
- 'tracking_id': False,
- 'state': 'draft',
- #'state': 'waiting',
- 'note': '\n'.join(line.name.split('\n')[1:]),
- 'company_id': order.company_id.id,
- 'price_unit': line.product_id.standard_price or 0.0
- }
-
- def _prepare_order_picking(self, cr, uid, order, context=None):
- pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
- return {
- 'name': pick_name,
- 'origin': order.name,
- 'date': order.date_order,
- 'type': 'out',
- 'state': 'auto',
- 'move_type': order.picking_policy,
- 'sale_id': order.id,
- 'partner_id': order.partner_shipping_id.id,
- 'note': order.note,
- 'invoice_state': (order.order_policy=='picking' and '2binvoiced') or 'none',
- 'company_id': order.company_id.id,
- }
-
- def ship_recreate(self, cr, uid, order, line, move_id, proc_id):
- # FIXME: deals with potentially cancelled shipments, seems broken (specially if shipment has production lot)
- """
- Define ship_recreate for process after shipping exception
- param order: sale order to which the order lines belong
- param line: sale order line records to procure
- param move_id: the ID of stock move
- param proc_id: the ID of procurement
- """
- move_obj = self.pool.get('stock.move')
- if order.state == 'shipping_except':
- for pick in order.picking_ids:
- for move in pick.move_lines:
- if move.state == 'cancel':
- mov_ids = move_obj.search(cr, uid, [('state', '=', 'cancel'),('sale_line_id', '=', line.id),('picking_id', '=', pick.id)])
- if mov_ids:
- for mov in move_obj.browse(cr, uid, mov_ids):
- # FIXME: the following seems broken: what if move_id doesn't exist? What if there are several mov_ids? Shouldn't that be a sum?
- move_obj.write(cr, uid, [move_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty})
- self.pool.get('procurement.order').write(cr, uid, [proc_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty})
- return True
-
- def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
- date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=line.delay or 0.0)
- date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
- return date_planned
-
- def _create_pickings_and_procurements(self, cr, uid, order, order_lines, picking_id=False, context=None):
- """Create the required procurements to supply sale order lines, also connecting
- the procurements to appropriate stock moves in order to bring the goods to the
- sale order's requested location.
-
- If ``picking_id`` is provided, the stock moves will be added to it, otherwise
- a standard outgoing picking will be created to wrap the stock moves, as returned
- by :meth:`~._prepare_order_picking`.
-
- Modules that wish to customize the procurements or partition the stock moves over
- multiple stock pickings may override this method and call ``super()`` with
- different subsets of ``order_lines`` and/or preset ``picking_id`` values.
-
- :param browse_record order: sale order to which the order lines belong
- :param list(browse_record) order_lines: sale order line records to procure
- :param int picking_id: optional ID of a stock picking to which the created stock moves
- will be added. A new picking will be created if ommitted.
- :return: True
- """
- move_obj = self.pool.get('stock.move')
- picking_obj = self.pool.get('stock.picking')
- procurement_obj = self.pool.get('procurement.order')
- proc_ids = []
-
- for line in order_lines:
- if line.state == 'done':
- continue
-
- date_planned = self._get_date_planned(cr, uid, order, line, order.date_order, context=context)
-
- if line.product_id:
- if line.product_id.product_tmpl_id.type in ('product', 'consu'):
- if not picking_id:
- picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context))
- move_id = move_obj.create(cr, uid, self._prepare_order_line_move(cr, uid, order, line, picking_id, date_planned, context=context))
- else:
- # a service has no stock move
- move_id = False
-
- proc_id = procurement_obj.create(cr, uid, self._prepare_order_line_procurement(cr, uid, order, line, move_id, date_planned, context=context))
- proc_ids.append(proc_id)
- line.write({'procurement_id': proc_id})
- self.ship_recreate(cr, uid, order, line, move_id, proc_id)
-
- wf_service = netsvc.LocalService("workflow")
- if picking_id:
- wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
- self.delivery_send_note(cr, uid, [order.id], picking_id, context)
-
-
- for proc_id in proc_ids:
- wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
-
- val = {}
- if order.state == 'shipping_except':
- val['state'] = 'progress'
- val['shipped'] = False
-
- if (order.order_policy == 'manual'):
- for line in order.order_line:
- if (not line.invoiced) and (line.state not in ('cancel', 'draft')):
- val['state'] = 'manual'
- break
- order.write(val)
- return True
-
- def action_ship_create(self, cr, uid, ids, context=None):
- for order in self.browse(cr, uid, ids, context=context):
- self._create_pickings_and_procurements(cr, uid, order, order.order_line, None, context=context)
- return True
-
- def action_ship_end(self, cr, uid, ids, context=None):
- for order in self.browse(cr, uid, ids, context=context):
- val = {'shipped': True}
- if order.state == 'shipping_except':
- val['state'] = 'progress'
- if (order.order_policy == 'manual'):
- for line in order.order_line:
- if (not line.invoiced) and (line.state not in ('cancel', 'draft')):
- val['state'] = 'manual'
- break
- for line in order.order_line:
- towrite = []
- if line.state == 'exception':
- towrite.append(line.id)
- if towrite:
- self.pool.get('sale.order.line').write(cr, uid, towrite, {'state': 'done'}, context=context)
- res = self.write(cr, uid, [order.id], val)
- if res:
- self.delivery_end_send_note(cr, uid, [order.id], context=context)
- return True
-
- def has_stockable_products(self, cr, uid, ids, *args):
- for order in self.browse(cr, uid, ids):
- for order_line in order.order_line:
- if order_line.product_id and order_line.product_id.product_tmpl_id.type in ('product', 'consu'):
- return True
- return False
-
# ------------------------------------------------
# OpenChatter methods and notifications
# ------------------------------------------------
@@ -1025,7 +628,7 @@ class sale_order(osv.osv):
def get_needaction_user_ids(self, cr, uid, ids, context=None):
result = super(sale_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
for obj in self.browse(cr, uid, ids, context=context):
- if (obj.state == 'manual' or obj.state == 'progress'):
+ if (obj.state == 'progress'):
result[obj.id].append(obj.user_id.id)
return result
@@ -1042,18 +645,7 @@ class sale_order(osv.osv):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sale Order for %s cancelled .") % (obj.partner_id.name), context=context)
- def delivery_send_note(self, cr, uid, ids, picking_id, context=None):
- for order in self.browse(cr, uid, ids, context=context):
- for picking in (pck for pck in order.picking_ids if pck.id == picking_id):
- # convert datetime field to a datetime, using server format, then
- # convert it to the user TZ and re-render it with %Z to add the timezone
- picking_datetime = fields.DT.datetime.strptime(picking.min_date, DEFAULT_SERVER_DATETIME_FORMAT)
- picking_date_str = fields.datetime.context_timestamp(cr, uid, picking_datetime, context=context).strftime(DATETIME_FORMATS_MAP['%+'] + " (%Z)")
- self.message_append_note(cr, uid, [order.id], body=_("Delivery Order %s scheduled for %s.") % (picking.name, picking_date_str), context=context)
-
- def delivery_end_send_note(self, cr, uid, ids, context=None):
- self.message_append_note(cr, uid, ids, body=_("Order delivered ."), context=context)
-
+
def invoice_paid_send_note(self, cr, uid, ids, context=None):
self.message_append_note(cr, uid, ids, body=_("Invoice paid ."), context=context)
@@ -1062,9 +654,6 @@ class sale_order(osv.osv):
for invoice in (inv for inv in order.invoice_ids if inv.id == invoice_id):
self.message_append_note(cr, uid, [order.id], body=_("Draft Invoice of %s %s waiting for validation .") % (invoice.amount_total, invoice.currency_id.symbol), context=context)
- def action_cancel_draft_send_note(self, cr, uid, ids, context=None):
- return self.message_append_note(cr, uid, ids, body='Sale order has been set in draft.', context=context)
-
sale_order()
@@ -1086,14 +675,7 @@ class sale_order_line(osv.osv):
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
return res
- def _number_packages(self, cr, uid, ids, field_name, arg, context=None):
- res = {}
- for line in self.browse(cr, uid, ids, context=context):
- try:
- res[line.id] = int((line.product_uom_qty+line.product_packaging.qty-0.0001) / line.product_packaging.qty)
- except:
- res[line.id] = 1
- return res
+
def _get_uom_id(self, cr, uid, *args):
try:
@@ -1109,26 +691,18 @@ class sale_order_line(osv.osv):
'order_id': fields.many2one('sale.order', 'Order Reference', required=True, ondelete='cascade', select=True, readonly=True, states={'draft':[('readonly',False)]}),
'name': fields.text('Product Description', size=256, required=True, select=True, readonly=True, states={'draft': [('readonly', False)]}),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of sales order lines."),
- 'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}),
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
'invoiced': fields.boolean('Invoiced', readonly=True),
- 'procurement_id': fields.many2one('procurement.order', 'Procurement'),
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft': [('readonly', False)]}),
'price_subtotal': fields.function(_amount_line, string='Subtotal', digits_compute= dp.get_precision('Sale Price')),
'tax_id': fields.many2many('account.tax', 'sale_order_tax', 'order_line_id', 'tax_id', 'Taxes', readonly=True, states={'draft': [('readonly', False)]}),
- 'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True, readonly=True, states={'draft': [('readonly', False)]},
- help="If 'on order', it triggers a procurement when the sale order is confirmed to create a task, purchase order or manufacturing order linked to this sale order line."),
- 'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}),
'address_allotment_id': fields.many2one('res.partner', 'Allotment Partner'),
'product_uom_qty': fields.float('Quantity', digits_compute= dp.get_precision('Product UoS'), required=True, readonly=True, states={'draft': [('readonly', False)]}),
'product_uom': fields.many2one('product.uom', 'Unit of Measure ', required=True, readonly=True, states={'draft': [('readonly', False)]}),
'product_uos_qty': fields.float('Quantity (UoS)' ,digits_compute= dp.get_precision('Product UoS'), readonly=True, states={'draft': [('readonly', False)]}),
'product_uos': fields.many2one('product.uom', 'Product UoS'),
- 'product_packaging': fields.many2one('product.packaging', 'Packaging'),
- 'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True),
'discount': fields.float('Discount', digits=(16, 2), readonly=True, states={'draft': [('readonly', False)]}),
- 'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'),
'th_weight': fields.float('Weight', readonly=True, states={'draft': [('readonly', False)]}),
'state': fields.selection([('cancel', 'Cancelled'),('draft', 'Draft'),('confirmed', 'Confirmed'),('exception', 'Exception'),('done', 'Done')], 'Status', required=True, readonly=True,
help='* The \'Draft\' state is set when the related sales order in draft state. \
@@ -1144,14 +718,11 @@ class sale_order_line(osv.osv):
_defaults = {
'product_uom' : _get_uom_id,
'discount': 0.0,
- 'delay': 0.0,
'product_uom_qty': 1,
'product_uos_qty': 1,
'sequence': 10,
'invoiced': 0,
'state': 'draft',
- 'type': 'make_to_stock',
- 'product_packaging': False,
'price_unit': 0.0,
}
@@ -1168,22 +739,16 @@ class sale_order_line(osv.osv):
"""
def _get_line_qty(line):
- if (line.order_id.invoice_quantity=='order') or not line.procurement_id:
+ if (line.order_id.invoice_quantity=='order'):
if line.product_uos:
return line.product_uos_qty or 0.0
return line.product_uom_qty
- else:
- return self.pool.get('procurement.order').quantity_get(cr, uid,
- line.procurement_id.id, context=context)
def _get_line_uom(line):
- if (line.order_id.invoice_quantity=='order') or not line.procurement_id:
+ if (line.order_id.invoice_quantity=='order'):
if line.product_uos:
return line.product_uos.id
return line.product_uom.id
- else:
- return self.pool.get('procurement.order').uom_get(cr, uid,
- line.procurement_id.id, context=context)
if not line.invoiced:
if not account_id:
@@ -1293,52 +858,6 @@ class sale_order_line(osv.osv):
default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []})
return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context)
- def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False,
- partner_id=False, packaging=False, flag=False, context=None):
- if not product:
- return {'value': {'product_packaging': False}}
- product_obj = self.pool.get('product.product')
- product_uom_obj = self.pool.get('product.uom')
- pack_obj = self.pool.get('product.packaging')
- warning = {}
- result = {}
- warning_msgs = ''
- if flag:
- res = self.product_id_change(cr, uid, ids, pricelist=pricelist,
- product=product, qty=qty, uom=uom, partner_id=partner_id,
- packaging=packaging, flag=False, context=context)
- warning_msgs = res.get('warning') and res['warning']['message']
-
- products = product_obj.browse(cr, uid, product, context=context)
- if not products.packaging:
- packaging = result['product_packaging'] = False
- elif not packaging and products.packaging and not flag:
- packaging = products.packaging[0].id
- result['product_packaging'] = packaging
-
- if packaging:
- default_uom = products.uom_id and products.uom_id.id
- pack = pack_obj.browse(cr, uid, packaging, context=context)
- q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom)
-# qty = qty - qty % q + q
- if qty and (q and not (qty % q) == 0):
- ean = pack.ean or _('(n/a)')
- qty_pack = pack.qty
- type_ul = pack.ul
- if not warning_msgs:
- warn_msg = _("You selected a quantity of %d Units.\n"
- "But it's not compatible with the selected packaging.\n"
- "Here is a proposition of quantities according to the packaging:\n"
- "EAN: %s Quantity: %s Type of ul: %s") % \
- (qty, ean, qty_pack, type_ul.name)
- warning_msgs += _("Picking Information ! : ") + warn_msg + "\n\n"
- warning = {
- 'title': _('Configuration Error !'),
- 'message': warning_msgs
- }
- result['product_uom_qty'] = qty
-
- return {'value': result, 'warning': warning}
def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
diff --git a/addons/sale/sale_data.xml b/addons/sale/sale_data.xml
index c93651219af..e87669a4d1a 100644
--- a/addons/sale/sale_data.xml
+++ b/addons/sale/sale_data.xml
@@ -10,7 +10,6 @@
-
diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml
index d9946c812c7..938dc545979 100644
--- a/addons/sale/sale_demo.xml
+++ b/addons/sale/sale_demo.xml
@@ -11,9 +11,6 @@
- picking
- procurement
- Invoice after delivery
@@ -24,7 +21,6 @@
123.20
- make_to_stock
@@ -35,7 +31,6 @@
450.50
3
3
- make_to_stock
@@ -44,8 +39,6 @@
900
5
- make_to_stock
- 1
@@ -55,7 +48,6 @@
88
5
5
- make_to_stock
@@ -80,7 +72,6 @@
540
- make_to_order
@@ -90,7 +81,6 @@
88
8
8
- make_to_order
@@ -111,8 +101,6 @@
3
450
- make_to_order
- 2
@@ -121,8 +109,6 @@
750
3
- make_to_order
- 7
@@ -142,8 +128,6 @@
2
450
- make_to_order
- 8
@@ -152,10 +136,7 @@
900
5
- make_to_order
- 1
-
@@ -174,8 +155,6 @@
4
750
- make_to_order
- 15
@@ -185,9 +164,7 @@
75
3
3
- make_to_stock
-
@@ -206,8 +183,6 @@
4
250
- make_to_order
- 15
@@ -216,11 +191,7 @@
4
500
- make_to_order
- 15
-
-
@@ -239,8 +210,6 @@
15
250
- make_to_stock
- 15
@@ -249,12 +218,8 @@
5
500
- make_to_stock
- 15
-
-
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index ac665df7a6b..a9edd29b9e1 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -22,9 +22,7 @@
-
-
-
+
@@ -37,6 +35,7 @@
+
sale.shop
sale.shop
@@ -44,7 +43,6 @@
-
@@ -61,8 +59,7 @@
If you have more than one shop reselling your company products, you can create and manage that from here. Whenever you will record a new quotation or sales order, it has to be linked to a shop. The shop also defines the warehouse from which the products will be delivered for each particular sales.
-
+
@@ -136,7 +133,6 @@
-
@@ -154,24 +150,17 @@
-
-
-
-
+ attrs="{'invisible': ['|','|',('state', '!=','progress'), ('invoiced', '=', True)]}"/>
-
-
+
@@ -188,7 +177,7 @@
-
+
@@ -207,13 +196,13 @@
+ on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
+ on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, False, False, parent.date_order, False, parent.fiscal_position, True, context)"/>
@@ -229,22 +218,11 @@
-
-
-
- days
-
-
-
@@ -252,18 +230,13 @@
-
-
-
-
-
-
-
-
+
@@ -313,7 +284,6 @@
-
@@ -330,16 +300,6 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/sale/sale_workflow.xml b/addons/sale/sale_workflow.xml
index c18e271d480..7db2b6dbcbe 100644
--- a/addons/sale/sale_workflow.xml
+++ b/addons/sale/sale_workflow.xml
@@ -30,10 +30,6 @@
wait_invoice
-
-
- wait_ship
-
@@ -83,6 +79,7 @@
function
action_invoice_end()
+
invoice_cancel
@@ -90,31 +87,6 @@
stopall
action_cancel()
-
-
- ship
- function
- action_ship_create()
-
-
-
- ship_except
- function
- write({'state':'shipping_except'})
-
-
-
- ship_end
- function
- action_ship_end()
-
-
-
- ship_cancel
- True
- stopall
- action_cancel()
-
@@ -159,6 +131,7 @@
all_lines
+
@@ -170,10 +143,6 @@
-
-
-
-
@@ -181,17 +150,6 @@
cancel
-
-
-
- cancel
-
-
-
-
-
- (order_policy!='prepaid') or invoiced
-
@@ -199,17 +157,13 @@
(order_policy=='prepaid')
-
-
-
- manual_invoice
-
subflow.paid
+
@@ -230,38 +184,6 @@
invoice_cancel
-
-
-
-
-
-
-
-
- procurement.order
- procurement_lines_get()
- test_state('finished')
-
-
-
-
- test_state('canceled')
-
-
-
-
- ship_recreate
-
-
-
-
- ship_corrected
-
-
-
-
- ship_cancel
-
-
+
diff --git a/addons/sale/security/ir.model.access.csv b/addons/sale/security/ir.model.access.csv
index 617678eccbe..4d00f8bb212 100644
--- a/addons/sale/security/ir.model.access.csv
+++ b/addons/sale/security/ir.model.access.csv
@@ -9,13 +9,6 @@ access_account_invoice_manager,account_invoice manager,account.model_account_inv
access_account_invoice_line_salesman,account_invoice.line salesman,account.model_account_invoice_line,base.group_sale_salesman,1,1,1,0
access_account_payment_term_salesman,account_payment_term salesman,account.model_account_payment_term,base.group_sale_salesman,1,0,0,0
access_account_analytic_account_salesman,account_analytic_account salesman,analytic.model_account_analytic_account,base.group_sale_salesman,1,1,1,0
-access_stock_picking_salesman,stock_picking salesman,stock.model_stock_picking,base.group_sale_salesman,1,1,1,0
-access_stock_move_salesman,stock_move salesman,stock.model_stock_move,base.group_sale_salesman,1,1,1,0
-access_stock_move_manager,stock_move manager,stock.model_stock_move,base.group_sale_manager,1,1,1,1
-access_procurement_salesman,procurement.order salesman,procurement.model_procurement_order,base.group_sale_salesman,1,1,1,0
-access_procurement_manager,procurement.order manager,procurement.model_procurement_order,base.group_sale_manager,1,1,1,1
-access_sale_order_stock_worker,sale.order stock worker,model_sale_order,stock.group_stock_user,1,1,0,0
-access_sale_order_line_stock_worker,sale.order.line stock worker,model_sale_order_line,stock.group_stock_user,1,1,0,0
access_sale_order_manager,sale.order.manager,model_sale_order,base.group_sale_manager,1,1,1,1
access_sale_order_accountant,sale.order.accountant,model_sale_order,account.group_account_user,1,1,0,0
access_sale_report_salesman,sale.report,model_sale_report,base.group_sale_salesman,1,1,1,0
@@ -24,23 +17,19 @@ access_ir_property_sales,ir.property.sales,base.model_ir_property,base.group_sal
access_sale_account_journal,account.journal sale order.user,account.model_account_journal,base.group_sale_salesman,1,0,0,0
access_res_partner_sale_user,res.partner.sale.user,base.model_res_partner,base.group_sale_salesman,1,0,0,0
access_res_partner_sale_manager,res.partner.sale.manager,base.model_res_partner,base.group_sale_manager,1,1,1,0
-access_report_stock_move_sales,report.stock.move.sale,stock.model_report_stock_move,base.group_sale_manager,1,1,1,1
-access_stock_picking_sales,stock.picking.sales,stock.model_stock_picking,base.group_sale_manager,1,1,1,1
+
access_product_template_sale_user,product.template sale use,product.model_product_template,base.group_sale_salesman,1,0,0,0
access_product_product_sale_user,product.product sale use,product.model_product_product,base.group_sale_salesman,1,0,0,0
access_sale_shop_manager,account.journal sale order.user,model_sale_shop,base.group_sale_manager,1,1,1,1
access_account_fiscalyear_user,account.fiscalyear.user,account.model_account_fiscalyear,base.group_sale_salesman,1,0,0,0
access_account_tax_user,account.tax.user,account.model_account_tax,base.group_sale_salesman,1,0,0,0
-access_product_packaging_user,product.packaging.user,product.model_product_packaging,base.group_sale_salesman,1,1,1,0
+
access_ir_attachment_sales,ir.attachment.sales,base.model_ir_attachment,base.group_sale_salesman,1,1,1,0
access_ir_attachment_manager,ir.attachment.manager,base.model_ir_attachment,base.group_sale_manager,1,1,1,1
-access_product_packaging_manager,product.packaging.manager,product.model_product_packaging,base.group_sale_manager,1,0,0,0
-access_stock_warehouse_user,stock.warehouse.user,stock.model_stock_warehouse,base.group_sale_salesman,1,0,0,0
+
access_res_partner_bank_type_user,res.partner.bank.type.user,base.model_res_partner_bank_type,base.group_sale_salesman,1,0,0,0
-access_stock_location_user,stock.location.user,stock.model_stock_location,base.group_sale_salesman,1,0,0,0
access_res_partner_bank_type_field_user,res.partner.bank.type.field.user,base.model_res_partner_bank_type_field,base.group_sale_salesman,1,0,0,0
access_product_uom_user,product.uom.user,product.model_product_uom,base.group_sale_salesman,1,0,0,0
-access_product_supplierinfo_user,product.supplierinfo.user,product.model_product_supplierinfo,base.group_sale_salesman,1,0,0,0
access_product_pricelist_sale_user,product.pricelist.sale.user,product.model_product_pricelist,base.group_sale_salesman,1,0,0,0
access_account_account_salesman,account_account salesman,account.model_account_account,base.group_sale_salesman,1,0,0,0
access_sale_shop_sale_user,sale.shop.sale.user,model_sale_shop,base.group_sale_salesman,1,0,0,0
@@ -49,7 +38,7 @@ access_product_uom_categ_sale_manager,product.uom.categ salemanager,product.mode
access_product_uom_sale_manager,product.uom salemanager,product.model_product_uom,base.group_sale_manager,1,1,1,1
access_product_ul_sale_manager,product.ul salemanager,product.model_product_ul,base.group_sale_manager,1,1,1,1
access_product_category_sale_manager,product.category salemanager,product.model_product_category,base.group_sale_manager,1,1,1,1
-access_product_packaging_sale_manager,product.packaging salemanager,product.model_product_packaging,base.group_sale_manager,1,1,1,1
+access_product_supplierinfo_user,product.supplierinfo.user,product.model_product_supplierinfo,base.group_sale_salesman,1,0,0,0
access_product_supplierinfo_sale_manager,product.supplierinfo salemanager,product.model_product_supplierinfo,base.group_sale_manager,1,1,1,1
access_pricelist_partnerinfo_sale_manager,pricelist.partnerinfo salemanager,product.model_pricelist_partnerinfo,base.group_sale_manager,1,1,1,1
access_product_price_type_sale_manager,product.price.type salemanager,product.model_product_price_type,base.group_sale_manager,1,1,1,1
@@ -58,5 +47,3 @@ access_product_pricelist_sale_manager,product.pricelist salemanager,product.mode
access_product_group_res_partner_sale_manager,res_partner group_sale_manager,base.model_res_partner,base.group_sale_manager,1,1,1,0
access_product_pricelist_version_sale_manager,product.pricelist.version sale_manager,product.model_product_pricelist_version,base.group_sale_manager,1,1,1,1
access_account_invoice_report_salesman,account.invoice.report salesman,account.model_account_invoice_report,base.group_sale_salesman,1,0,0,0
-access_stock_warehouse_orderpoint_sale_salesman,stock.warehouse.orderpoint,procurement.model_stock_warehouse_orderpoint,base.group_sale_salesman,1,0,0,0
-access_account_move_line_salesman,account.move.line invoice,account.model_account_move_line,base.group_sale_salesman,1,0,0,0
diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml
index 47a577e77c3..8b64b360435 100644
--- a/addons/sale/security/sale_security.xml
+++ b/addons/sale/security/sale_security.xml
@@ -25,21 +25,12 @@
-
- Enable Invoicing Delivery orders
-
-
Addresses in Sale Orders
-
- Properties on lines
-
-
-
Discount on lines
diff --git a/addons/sale/test/cancel_order.yml b/addons/sale/test/cancel_order.yml
index cfdd0c7f079..afc629306fe 100644
--- a/addons/sale/test/cancel_order.yml
+++ b/addons/sale/test/cancel_order.yml
@@ -1,67 +1,20 @@
-
In order to test the cancel sale order.
--
- Now I cancel Quotation.
--
- !python {model: sale.order}: |
- self.action_cancel(cr, uid, [ref("order7")])
--
- I check state of Quotation after cancelled.
--
- !assert {model: sale.order, id: order7, string: sale order should be in cancel state}:
- - state == 'cancel'
--
- I set cancelled quotation to draft.
--
- !python {model: sale.order}: |
- self.action_cancel_draft(cr, uid, [ref("order7")])
--
- I confirm order.
+
+ First I confirm order.
-
!workflow {model: sale.order, action: order_confirm, ref: order7}
-
- I send delivery in two shipments, so I am doing a partial delivery order.
--
- !python {model: stock.picking}: |
- delivery_orders = self.search(cr, uid, [('sale_id','=',ref("order7"))])
- first_picking = self.browse(cr, uid, delivery_orders[0], context=context)
- if first_picking.force_assign(cr, uid, first_picking):
- first_move = first_picking.move_lines[0]
- values = {'move%s'%(first_move.id): {'product_qty': 5, 'product_uom':ref('product.product_uom_unit')}}
- first_picking.do_partial(values, context=context)
--
- Now I cancel latest shipment.
--
- !python {model: stock.picking}: |
- import netsvc
- delivery_orders = self.search(cr, uid, [('sale_id','=',ref("order7"))])
- last_delivery_order_id = delivery_orders[0]
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'stock.picking', last_delivery_order_id, 'button_cancel', cr)
--
- I run the scheduler.
--
- !python {model: procurement.order}: |
-
- self.run_scheduler(cr, uid)
--
- I check order status in "Ship Exception".
--
- !assert {model: sale.order, id: order7, string: Sale order should be in shipping exception}:
- - state == "shipping_except"
--
- Now I regenerate shipment.
--
- !workflow {model: sale.order, action: ship_recreate, ref: order7}
--
- I check state of order in 'To Invoice'.
+ I check state of order in 'Sale Order'.
-
!assert {model: sale.order, id: order7, string: Sale order should be In Progress state}:
- - state == 'manual'
+ - state == 'progress'
+-
+ I check that Invoice should be created.
-
- I make invoice for order.
--
- !workflow {model: sale.order, action: manual_invoice, ref: order7}
+ !python {model: sale.order}: |
+ sale_order = self.browse(cr, uid, ref("order7"))
+ assert len(sale_order.invoice_ids) == True, "Invoice should be created."
-
To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
-
@@ -80,9 +33,3 @@
Then I click on the Ignore Exception button.
-
!workflow {model: sale.order, action: invoice_corrected, ref: order7}
-
--
- I check state of order in 'In Progress'.
--
- !assert {model: sale.order, id: order7, string: Sale order should be In progress state}:
- - state == 'progress'
diff --git a/addons/sale/test/delete_order.yml b/addons/sale/test/delete_order.yml
index 2bbfed9771d..a42d5c34867 100644
--- a/addons/sale/test/delete_order.yml
+++ b/addons/sale/test/delete_order.yml
@@ -10,5 +10,5 @@
I make duplicate order and delete.
-
!python {model: sale.order}: |
- id = self.copy(cr, uid, ref('order'))
+ id = self.copy(cr, uid, ref('order4'))
self.unlink(cr, uid, [id])
diff --git a/addons/sale/test/edi_sale_order.yml b/addons/sale/test/edi_sale_order.yml
index af9a9b3aad6..d9fdb7ad8da 100644
--- a/addons/sale/test/edi_sale_order.yml
+++ b/addons/sale/test/edi_sale_order.yml
@@ -108,12 +108,12 @@
assert len(order_new.order_line) == 2, "Sale order lines mismatch"
for sale_line in order_new.order_line:
if sale_line.name == 'Basic PC':
- assert sale_line.delay == 18 , "incorrect delay: got %s, expected 18"%(sale_line.delay,)
+ # assert sale_line.delay == 18 , "incorrect delay: got %s, expected 18"%(sale_line.delay,)
assert sale_line.product_uom.name == "Unit" , "uom is not same"
assert sale_line.price_unit == 150 , "unit price is not same, got %s, expected 150"%(sale_line.price_unit,)
assert sale_line.product_uom_qty == 1 , "product qty is not same"
elif sale_line.name == 'Medium PC':
- assert sale_line.delay == 3 , "incorrect delay: got %s, expected 3"%(sale_line.delay,)
+ # assert sale_line.delay == 3 , "incorrect delay: got %s, expected 3"%(sale_line.delay,)
assert sale_line.product_uom.name == "Unit" , "uom is not same"
assert sale_line.price_unit == 100 , "unit price is not same, got %s, expected 100"%(sale_line.price_unit,)
assert sale_line.product_uom_qty == 2 , "product qty is not same"
diff --git a/addons/sale/test/prepaid_order_policy.yml b/addons/sale/test/prepaid_order_policy.yml
index 4f45baa8823..07754c03dfe 100644
--- a/addons/sale/test/prepaid_order_policy.yml
+++ b/addons/sale/test/prepaid_order_policy.yml
@@ -7,5 +7,4 @@
-
!python {model: sale.order}: |
sale_order = self.browse(cr, uid, ref("order3"))
- assert len(sale_order.picking_ids) == False, "Delivery order should not created before invoice."
assert sale_order.invoice_ids, "Invoice should be created."
diff --git a/addons/sale/wizard/__init__.py b/addons/sale/wizard/__init__.py
index 6cf076164d8..f243b959526 100644
--- a/addons/sale/wizard/__init__.py
+++ b/addons/sale/wizard/__init__.py
@@ -18,9 +18,6 @@
# along with this program. If not, see .
#
##############################################################################
-
-import sale_make_invoice
import sale_line_invoice
-import sale_make_invoice_advance
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/sale_crm/__openerp__.py b/addons/sale_crm/__openerp__.py
index b56d866f98b..f4137047fff 100644
--- a/addons/sale_crm/__openerp__.py
+++ b/addons/sale_crm/__openerp__.py
@@ -37,7 +37,7 @@ modules.
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/crm_statistics_dashboard.jpeg', 'images/opportunity_to_quote.jpeg'],
- 'depends': ['sale', 'crm'],
+ 'depends': ['sale_stock', 'crm'],
'init_xml': [],
'update_xml': ['wizard/crm_make_sale_view.xml',
'sale_crm_view.xml',
diff --git a/addons/sale_journal/__openerp__.py b/addons/sale_journal/__openerp__.py
index 11408161bf4..6373cce1810 100644
--- a/addons/sale_journal/__openerp__.py
+++ b/addons/sale_journal/__openerp__.py
@@ -49,7 +49,7 @@ Some statistics by journals are provided.
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/invoice_type.jpeg'],
- 'depends': ['sale'],
+ 'depends': ['sale_stock'],
'init_xml': ['sale_journal_data.xml'],
'update_xml': [
'security/ir.model.access.csv',
diff --git a/addons/sale_margin/__openerp__.py b/addons/sale_margin/__openerp__.py
index 936f5a6b350..4e622e71b33 100644
--- a/addons/sale_margin/__openerp__.py
+++ b/addons/sale_margin/__openerp__.py
@@ -31,7 +31,7 @@ Price and Cost Price.
""",
"author":"OpenERP SA",
"images":["images/sale_margin.jpeg"],
- "depends":["sale"],
+ "depends":["sale_stock"],
"demo_xml":[],
'test': ['test/sale_margin.yml'],
"update_xml":["security/ir.model.access.csv","sale_margin_view.xml"],
diff --git a/addons/sale_mrp/__openerp__.py b/addons/sale_mrp/__openerp__.py
index d5b3d6b7849..b1aed2c67b5 100644
--- a/addons/sale_mrp/__openerp__.py
+++ b/addons/sale_mrp/__openerp__.py
@@ -34,7 +34,7 @@ from sales order. It adds sales name and sales Reference on production order.
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/SO_to_MO.jpeg'],
- 'depends': ['mrp', 'sale'],
+ 'depends': ['mrp', 'sale_stock'],
'init_xml': [],
'update_xml': [
'security/ir.model.access.csv',
diff --git a/addons/sale_stock/__init__.py b/addons/sale_stock/__init__.py
new file mode 100644
index 00000000000..1b63b8b2b8b
--- /dev/null
+++ b/addons/sale_stock/__init__.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import sale_stock
+import stock
+import wizard
+import report
+import company
+import res_config
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
new file mode 100644
index 00000000000..268e641cf41
--- /dev/null
+++ b/addons/sale_stock/__openerp__.py
@@ -0,0 +1,87 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+{
+ 'name': 'Sale To Stock',
+ 'version': '1.0',
+ 'category': 'Hidden',
+ 'description': """
+This Module manage quotations and sales orders.
+===========================================================================
+
+Workflow with validation steps:
+-------------------------------
+ * Quotation -> Sales order -> Invoice
+
+Create Invoice:
+---------------
+ * Invoice on Demand
+ * Invoice on Delivery Order
+ * Invoice Before Delivery
+
+Partners preferences:
+---------------------
+ * Incoterm
+ * Shipping
+ * Invoicing
+
+Products stocks and prices:
+--------------------------
+
+Delivery method:
+-----------------
+ * The Poste
+ * Free Delivery Charges
+ * Normal Delivery Charges
+ * Based on the Delivery Order(if not Add to sale order)
+
+Dashboard for Sales Manager that includes:
+------------------------------------------
+ * My Quotations
+ * Monthly Turnover (Graph)
+ """,
+ 'author': 'OpenERP SA',
+ 'website': 'http://www.openerp.com',
+ 'images': [],
+ 'depends': ['sale', 'procurement'],
+ 'init_xml': [],
+ 'update_xml': ['wizard/sale_make_invoice_advance.xml',
+ 'wizard/sale_make_invoice.xml',
+ 'security/sale_stock_security.xml',
+ 'security/ir.model.access.csv',
+ 'company_view.xml',
+ 'sale_stock_view.xml',
+ 'sale_stock_workflow.xml',
+ 'res_config_view.xml',
+ 'report/sale_report_view.xml',
+ 'process/sale_stock_process.xml',
+ ],
+ 'data': ['sale_stock_data.xml'],
+ 'demo_xml': ['sale_stock_demo.xml'],
+ 'test': ['test/cancel_order_sale_stock.yml',
+ 'test/picking_order_policy.yml',
+ 'test/manual_order_policy.yml'
+ ],
+ 'installable': True,
+ 'auto_install': True,
+
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/sale/company.py b/addons/sale_stock/company.py
similarity index 100%
rename from addons/sale/company.py
rename to addons/sale_stock/company.py
diff --git a/addons/sale/company_view.xml b/addons/sale_stock/company_view.xml
similarity index 100%
rename from addons/sale/company_view.xml
rename to addons/sale_stock/company_view.xml
diff --git a/addons/sale_stock/process/sale_stock_process.xml b/addons/sale_stock/process/sale_stock_process.xml
new file mode 100644
index 00000000000..cee587dca9b
--- /dev/null
+++ b/addons/sale_stock/process/sale_stock_process.xml
@@ -0,0 +1,142 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/sale_stock/report/__init__.py b/addons/sale_stock/report/__init__.py
new file mode 100644
index 00000000000..418927acc78
--- /dev/null
+++ b/addons/sale_stock/report/__init__.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+import sale_report
\ No newline at end of file
diff --git a/addons/sale_stock/report/sale_report.py b/addons/sale_stock/report/sale_report.py
new file mode 100644
index 00000000000..5e9b74386b3
--- /dev/null
+++ b/addons/sale_stock/report/sale_report.py
@@ -0,0 +1,93 @@
+ # -*- coding: utf-8 -*-
+ ##############################################################################
+ #
+ # OpenERP, Open Source Management Solution
+ # Copyright (C) 2004-2010 Tiny SPRL ().
+ #
+ # This program is free software: you can redistribute it and/or modify
+ # it under the terms of the GNU Affero General Public License as
+ # published by the Free Software Foundation, either version 3 of the
+ # License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU Affero General Public License for more details.
+ #
+ # You should have received a copy of the GNU Affero General Public License
+ # along with this program. If not, see .
+ #
+ ##############################################################################
+
+from osv import fields, osv
+import tools
+class sale_report(osv.osv):
+ _inherit = "sale.report"
+ _columns = {
+ 'shipped': fields.boolean('Shipped', readonly=True),
+ 'shipped_qty_1': fields.integer('Shipped', readonly=True),
+ 'state': fields.selection([
+ ('draft', 'Quotation'),
+ ('waiting_date', 'Waiting Schedule'),
+ ('manual', 'Manual In Progress'),
+ ('progress', 'In Progress'),
+ ('shipping_except', 'Shipping Exception'),
+ ('invoice_except', 'Invoice Exception'),
+ ('done', 'Done'),
+ ('cancel', 'Cancelled')
+ ], 'Order State', readonly=True),
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'sale_report')
+ cr.execute("""
+ create or replace view sale_report as (
+ select
+ min(l.id) as id,
+ l.product_id as product_id,
+ t.uom_id as product_uom,
+ sum(l.product_uom_qty / u.factor * u2.factor) as product_uom_qty,
+ sum(l.product_uom_qty * l.price_unit * (100.0-l.discount) / 100.0) as price_total,
+ 1 as nbr,
+ s.date_order as date,
+ s.date_confirm as date_confirm,
+ to_char(s.date_order, 'YYYY') as year,
+ to_char(s.date_order, 'MM') as month,
+ to_char(s.date_order, 'YYYY-MM-DD') as day,
+ s.partner_id as partner_id,
+ s.user_id as user_id,
+ s.shop_id as shop_id,
+ s.company_id as company_id,
+ extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
+ s.state,
+ t.categ_id as categ_id,
+ s.shipped,
+ s.shipped::integer as shipped_qty_1,
+ s.pricelist_id as pricelist_id,
+ s.project_id as analytic_account_id
+ from
+ sale_order s
+ left join sale_order_line l on (s.id=l.order_id)
+ left join product_product p on (l.product_id=p.id)
+ left join product_template t on (p.product_tmpl_id=t.id)
+ left join product_uom u on (u.id=l.product_uom)
+ left join product_uom u2 on (u2.id=t.uom_id)
+ group by
+ l.product_id,
+ l.product_uom_qty,
+ l.order_id,
+ t.uom_id,
+ t.categ_id,
+ s.date_order,
+ s.date_confirm,
+ s.partner_id,
+ s.user_id,
+ s.shop_id,
+ s.company_id,
+ s.state,
+ s.shipped,
+ s.pricelist_id,
+ s.project_id
+ )
+ """)
+sale_report()
diff --git a/addons/sale_stock/report/sale_report_view.xml b/addons/sale_stock/report/sale_report_view.xml
new file mode 100644
index 00000000000..99aefa7e66f
--- /dev/null
+++ b/addons/sale_stock/report/sale_report_view.xml
@@ -0,0 +1,16 @@
+
+
+
+
+ sale.report.tree.sale.stock
+ sale.report
+
+ tree
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py
new file mode 100644
index 00000000000..30ee56753fe
--- /dev/null
+++ b/addons/sale_stock/res_config.py
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (C) 2004-2012 OpenERP S.A. ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+from osv import fields, osv
+import pooler
+from tools.translate import _
+
+class sale_configuration(osv.osv_memory):
+ _inherit = 'sale.config.settings'
+ _columns = {
+ 'group_invoice_deli_orders': fields.boolean('Based on Delivery Orders',
+ implied_group='group_invoice_deli_orders',
+ help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."),
+ 'task_work': fields.boolean('Based on Task Activities',
+ help="""Lets you transfer the entries under tasks defined for Project Management to
+ the Timesheet line entries for particular date and particular user with the effect of creating, editing and deleting either ways
+ and to automatically creates project tasks from procurement lines.
+ This installs the modules project_timesheet and project_mrp."""),
+ 'default_order_policy': fields.selection(
+ [('manual', 'Invoice Based on Sales Orders'), ('picking', 'Invoice Based on Deliveries')],
+ 'Default Method', default_model='sale.order',
+ help="You can generate invoices based on sales orders or based on shippings."),
+ 'module_delivery': fields.boolean('Allow Charging Shipping Costs',
+ help ="""Allows you to add delivery methods in sale orders and delivery orders.
+ You can define your own carrier and delivery grids for prices.
+ This installs the module delivery."""),
+ 'default_picking_policy' : fields.boolean("Configurable Shipping Policy",
+ help = "You will be able to configure, per sale order, if you deliver all products at once or if you deliver each product when it is available. This may have an impact on the shipping price."),
+ 'group_mrp_properties': fields.boolean('Properties on Lines',
+ implied_group='sale.group_mrp_properties',
+ help="Allows you to tag sale order lines with properties."),
+ 'group_multiple_shops': fields.boolean("Manage Multiple Shops",
+ implied_group='stock.group_locations',
+ help="This allows to configure and use multiple shops."),
+ 'module_project_timesheet': fields.boolean("Project Timesheet"),
+ 'module_project_mrp': fields.boolean("Project MRP"),
+
+ }
+
+ def default_get(self, cr, uid, fields, context=None):
+ res = super(sale_configuration, self).default_get(cr, uid, fields, context)
+ # task_work, time_unit depend on other fields
+ res['task_work'] = res.get('module_project_mrp') and res.get('module_project_timesheet')
+ return res
+
+ def get_default_sale_config(self, cr, uid, ids, context=None):
+ ir_values = self.pool.get('ir.values')
+ default_picking_policy = ir_values.get_default(cr, uid, 'sale.order', 'picking_policy')
+ return {
+ 'default_picking_policy': default_picking_policy == 'one',
+ }
+
+ def set_sale_defaults(self, cr, uid, ids, context=None):
+ ir_values = self.pool.get('ir.values')
+ ir_model_data = self.pool.get('ir.model.data')
+ wizard = self.browse(cr, uid, ids)[0]
+
+ default_picking_policy = 'one' if wizard.default_picking_policy else 'direct'
+ ir_values.set_default(cr, uid, 'sale.order', 'picking_policy', default_picking_policy)
+ res = super(sale_configuration, self).set_sale_defaults(cr, uid, ids, context)
+ return res
+
+ def onchange_invoice_methods(self, cr, uid, ids, group_invoice_so_lines, group_invoice_deli_orders, context=None):
+ if not group_invoice_deli_orders:
+ return {'value': {'default_order_policy': 'manual'}}
+ if not group_invoice_so_lines:
+ return {'value': {'default_order_policy': 'picking'}}
+ return {}
diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml
new file mode 100644
index 00000000000..e68aa3b5662
--- /dev/null
+++ b/addons/sale_stock/res_config_view.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ sale settings
+ sale.config.settings
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
new file mode 100644
index 00000000000..3c43587a199
--- /dev/null
+++ b/addons/sale_stock/sale_stock.py
@@ -0,0 +1,639 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+from datetime import datetime, timedelta
+from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP, float_compare
+from dateutil.relativedelta import relativedelta
+from osv import fields, osv
+import netsvc
+from tools.translate import _
+
+class sale_shop(osv.osv):
+ _inherit = "sale.shop"
+ _columns = {
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
+ }
+
+class sale_order(osv.osv):
+ _inherit = "sale.order"
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ if not default:
+ default = {}
+ default.update({
+ 'shipped': False,
+ 'picking_ids': [],
+ })
+ return super(sale_order, self).copy(cr, uid, id, default, context=context)
+
+ def shipping_policy_change(self, cr, uid, ids, policy, context=None):
+ if not policy:
+ return {}
+ inv_qty = 'order'
+ if policy == 'prepaid':
+ inv_qty = 'order'
+ elif policy == 'picking':
+ inv_qty = 'procurement'
+ return {'value': {'invoice_quantity': inv_qty}}
+
+ def write(self, cr, uid, ids, vals, context=None):
+ if vals.get('order_policy', False):
+ if vals['order_policy'] == 'prepaid':
+ vals.update({'invoice_quantity': 'order'})
+ elif vals['order_policy'] == 'picking':
+ vals.update({'invoice_quantity': 'procurement'})
+ return super(sale_order, self).write(cr, uid, ids, vals, context=context)
+
+ def create(self, cr, uid, vals, context=None):
+ if vals.get('order_policy', False):
+ if vals['order_policy'] == 'prepaid':
+ vals.update({'invoice_quantity': 'order'})
+ if vals['order_policy'] == 'picking':
+ vals.update({'invoice_quantity': 'procurement'})
+ order = super(sale_order, self).create(cr, uid, vals, context=context)
+ return order
+
+ # This is False
+ def _picked_rate(self, cr, uid, ids, name, arg, context=None):
+ if not ids:
+ return {}
+ res = {}
+ tmp = {}
+ for id in ids:
+ tmp[id] = {'picked': 0.0, 'total': 0.0}
+ cr.execute('''SELECT
+ p.sale_id as sale_order_id, sum(m.product_qty) as nbr, mp.state as procurement_state, m.state as move_state, p.type as picking_type
+ FROM
+ stock_move m
+ LEFT JOIN
+ stock_picking p on (p.id=m.picking_id)
+ LEFT JOIN
+ procurement_order mp on (mp.move_id=m.id)
+ WHERE
+ p.sale_id IN %s GROUP BY m.state, mp.state, p.sale_id, p.type''', (tuple(ids),))
+
+ for item in cr.dictfetchall():
+ if item['move_state'] == 'cancel':
+ continue
+
+ if item['picking_type'] == 'in':#this is a returned picking
+ tmp[item['sale_order_id']]['total'] -= item['nbr'] or 0.0 # Deducting the return picking qty
+ if item['procurement_state'] == 'done' or item['move_state'] == 'done':
+ tmp[item['sale_order_id']]['picked'] -= item['nbr'] or 0.0
+ else:
+ tmp[item['sale_order_id']]['total'] += item['nbr'] or 0.0
+ if item['procurement_state'] == 'done' or item['move_state'] == 'done':
+ tmp[item['sale_order_id']]['picked'] += item['nbr'] or 0.0
+
+ for order in self.browse(cr, uid, ids, context=context):
+ if order.shipped:
+ res[order.id] = 100.0
+ else:
+ res[order.id] = tmp[order.id]['total'] and (100.0 * tmp[order.id]['picked'] / tmp[order.id]['total']) or 0.0
+ return res
+
+ _columns = {
+ 'state': fields.selection([
+ ('draft', 'Draft Quotation'),
+ ('sent', 'Quotation Sent'),
+ ('cancel', 'Cancelled'),
+ ('waiting_date', 'Waiting Schedule'),
+ ('progress', 'Sale Order'),
+ ('manual', 'Sale to Invoice'),
+ ('shipping_except', 'Shipping Exception'),
+ ('invoice_except', 'Invoice Exception'),
+ ('done', 'Done'),
+ ], 'Status', readonly=True,help="Gives the state of the quotation or sales order.\
+ \nThe exception state is automatically set when a cancel operation occurs \
+ in the invoice validation (Invoice Exception) or in the picking list process (Shipping Exception).\nThe 'Waiting Schedule' state is set when the invoice is confirmed\
+ but waiting for the scheduler to run on the order date.", select=True),
+ 'incoterm': fields.many2one('stock.incoterms', 'Incoterm', help="Incoterm which stands for 'International Commercial terms' implies its a series of sales terms which are used in the commercial transaction."),
+ 'picking_policy': fields.selection([('direct', 'Deliver each product when available'), ('one', 'Deliver all products at once')],
+ 'Shipping Policy', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
+ help="""If you don't have enough stock available to deliver all at once, do you accept partial shipments or not?"""),
+ 'order_policy': fields.selection([
+ ('manual', 'On Demand'),
+ ('picking', 'On Delivery Order'),
+ ('prepaid', 'Before Delivery'),
+ ], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
+ help="""This field controls how invoice and delivery operations are synchronized.
+ - With 'On Demand', the invoice is created manually when needed.
+ - With 'On Delivery Order', a draft invoice is generated after all pickings have been processed.
+ - With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""),
+ 'picking_ids': fields.one2many('stock.picking.out', 'sale_id', 'Related Picking', readonly=True, help="This is a list of delivery orders that has been generated for this sales order."),
+ 'shipped': fields.boolean('Delivered', readonly=True, help="It indicates that the sales order has been delivered. This field is updated only after the scheduler(s) have been launched."),
+ 'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
+ 'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on',
+ help="The sale order will automatically create the invoice proposition (draft invoice).\
+ You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),
+ }
+ _defaults = {
+ 'picking_policy': 'direct',
+ 'order_policy': 'manual',
+ 'invoice_quantity': 'order',
+ }
+
+ # Form filling
+ def unlink(self, cr, uid, ids, context=None):
+ sale_orders = self.read(cr, uid, ids, ['state'], context=context)
+ unlink_ids = []
+ for s in sale_orders:
+ if s['state'] in ['draft', 'cancel']:
+ unlink_ids.append(s['id'])
+ else:
+ raise osv.except_osv(_('Invalid action !'), _('In order to delete a confirmed sale order, you must cancel it before ! To cancel a sale order, you must first cancel related picking or delivery orders.'))
+
+ return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
+
+
+
+ def action_view_delivery(self, cr, uid, ids, context=None):
+ '''
+ This function returns an action that display existing delivery orders of given sale order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
+ '''
+ mod_obj = self.pool.get('ir.model.data')
+ result = {
+ 'name': _('Delivery Order'),
+ 'view_type': 'form',
+ 'res_model': 'stock.picking',
+ 'context': "{'type':'out'}",
+ 'type': 'ir.actions.act_window',
+ 'nodestroy': True,
+ 'target': 'current',
+ }
+ #compute the number of delivery orders to display
+ pick_ids = []
+ for so in self.browse(cr, uid, ids, context=context):
+ pick_ids += [picking.id for picking in so.picking_ids]
+ #choose the view_mode accordingly
+ if len(pick_ids) > 1:
+ res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_tree')
+ result.update({
+ 'view_mode': 'tree,form',
+ 'res_id': pick_ids or False
+ })
+ else:
+ res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_form')
+ result.update({
+ 'view_mode': 'form',
+ 'res_id': pick_ids and pick_ids[0] or False,
+ })
+ result.update(view_id = res and res[1] or False)
+ return result
+
+ def action_wait(self, cr, uid, ids, context=None):
+ for o in self.browse(cr, uid, ids):
+ if not o.order_line:
+ raise osv.except_osv(_('Error !'),_('You cannot confirm a sale order which has no line.'))
+ if (o.order_policy == 'manual'):
+ self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
+ else:
+ self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
+ self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
+ self.confirm_send_note(cr, uid, ids, context)
+ return True
+
+ def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
+ res = False
+ invoices = {}
+ invoice_ids = []
+ picking_obj = self.pool.get('stock.picking')
+ invoice = self.pool.get('account.invoice')
+ obj_sale_order_line = self.pool.get('sale.order.line')
+ partner_currency = {}
+ if context is None:
+ context = {}
+ # If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
+ # last day of the last month as invoice date
+ if date_inv:
+ context['date_inv'] = date_inv
+ for o in self.browse(cr, uid, ids, context=context):
+ currency_id = o.pricelist_id.currency_id.id
+ if (o.partner_id.id in partner_currency) and (partner_currency[o.partner_id.id] <> currency_id):
+ raise osv.except_osv(
+ _('Error !'),
+ _('You cannot group sales having different currencies for the same partner.'))
+
+ partner_currency[o.partner_id.id] = currency_id
+ lines = []
+ for line in o.order_line:
+ if line.invoiced:
+ continue
+ elif (line.state in states):
+ lines.append(line.id)
+ created_lines = obj_sale_order_line.invoice_line_create(cr, uid, lines)
+ if created_lines:
+ invoices.setdefault(o.partner_id.id, []).append((o, created_lines))
+ if not invoices:
+ for o in self.browse(cr, uid, ids, context=context):
+ for i in o.invoice_ids:
+ if i.state == 'draft':
+ return i.id
+ for val in invoices.values():
+ if grouped:
+ res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context)
+ invoice_ref = ''
+ for o, l in val:
+ invoice_ref += o.name + '|'
+ self.write(cr, uid, [o.id], {'state': 'progress'})
+ if o.order_policy == 'picking':
+ picking_obj.write(cr, uid, map(lambda x: x.id, o.picking_ids), {'invoice_state': 'invoiced'})
+ cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
+ invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
+ else:
+ for order, il in val:
+ res = self._make_invoice(cr, uid, order, il, context=context)
+ invoice_ids.append(res)
+ self.write(cr, uid, [order.id], {'state': 'progress'})
+ if order.order_policy == 'picking':
+ picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'})
+ cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (order.id, res))
+ if res:
+ self.invoice_send_note(cr, uid, ids, res, context)
+ return res
+
+ def action_cancel(self, cr, uid, ids, context=None):
+ wf_service = netsvc.LocalService("workflow")
+ if context is None:
+ context = {}
+ sale_order_line_obj = self.pool.get('sale.order.line')
+ proc_obj = self.pool.get('procurement.order')
+ for sale in self.browse(cr, uid, ids, context=context):
+ for pick in sale.picking_ids:
+ if pick.state not in ('draft', 'cancel'):
+ raise osv.except_osv(
+ _('Could not cancel sales order !'),
+ _('You must first cancel all picking attached to this sales order.'))
+ if pick.state == 'cancel':
+ for mov in pick.move_lines:
+ proc_ids = proc_obj.search(cr, uid, [('move_id', '=', mov.id)])
+ if proc_ids:
+ for proc in proc_ids:
+ wf_service.trg_validate(uid, 'procurement.order', proc, 'button_check', cr)
+ for r in self.read(cr, uid, ids, ['picking_ids']):
+ for pick in r['picking_ids']:
+ wf_service.trg_validate(uid, 'stock.picking', pick, 'button_cancel', cr)
+ return super(sale_order, self).action_cancel(cr, uid, ids, context=context)
+
+ def procurement_lines_get(self, cr, uid, ids, *args):
+ res = []
+ for order in self.browse(cr, uid, ids, context={}):
+ for line in order.order_line:
+ if line.procurement_id:
+ res.append(line.procurement_id.id)
+ return res
+
+ # if mode == 'finished':
+ # returns True if all lines are done, False otherwise
+ # if mode == 'canceled':
+ # returns True if there is at least one canceled line, False otherwise
+ def test_state(self, cr, uid, ids, mode, *args):
+ assert mode in ('finished', 'canceled'), _("invalid mode for test_state")
+ finished = True
+ canceled = False
+ notcanceled = False
+ write_done_ids = []
+ write_cancel_ids = []
+ for order in self.browse(cr, uid, ids, context={}):
+ for line in order.order_line:
+ if (not line.procurement_id) or (line.procurement_id.state=='done'):
+ if line.state != 'done':
+ write_done_ids.append(line.id)
+ else:
+ finished = False
+ if line.procurement_id:
+ if (line.procurement_id.state == 'cancel'):
+ canceled = True
+ if line.state != 'exception':
+ write_cancel_ids.append(line.id)
+ else:
+ notcanceled = True
+ if write_done_ids:
+ self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
+ if write_cancel_ids:
+ self.pool.get('sale.order.line').write(cr, uid, write_cancel_ids, {'state': 'exception'})
+
+ if mode == 'finished':
+ return finished
+ elif mode == 'canceled':
+ return canceled
+ if notcanceled:
+ return False
+ return canceled
+
+ def _prepare_order_line_procurement(self, cr, uid, order, line, move_id, date_planned, context=None):
+ return {
+ 'name': line.name.split('\n')[0],
+ 'origin': order.name,
+ 'date_planned': date_planned,
+ 'product_id': line.product_id.id,
+ 'product_qty': line.product_uom_qty,
+ 'product_uom': line.product_uom.id,
+ 'product_uos_qty': (line.product_uos and line.product_uos_qty)\
+ or line.product_uom_qty,
+ 'product_uos': (line.product_uos and line.product_uos.id)\
+ or line.product_uom.id,
+ 'location_id': order.shop_id.warehouse_id.lot_stock_id.id,
+ 'procure_method': line.type,
+ 'move_id': move_id,
+ 'company_id': order.company_id.id,
+ 'note': '\n'.join(line.name.split('\n')[1:]),
+ 'property_ids': [(6, 0, [x.id for x in line.property_ids])]
+ }
+
+ def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planned, context=None):
+ location_id = order.shop_id.warehouse_id.lot_stock_id.id
+ output_id = order.shop_id.warehouse_id.lot_output_id.id
+ return {
+ 'name': line.name.split('\n')[0][:250],
+ 'picking_id': picking_id,
+ 'product_id': line.product_id.id,
+ 'date': date_planned,
+ 'date_expected': date_planned,
+ 'product_qty': line.product_uom_qty,
+ 'product_uom': line.product_uom.id,
+ 'product_uos_qty': (line.product_uos and line.product_uos_qty) or line.product_uom_qty,
+ 'product_uos': (line.product_uos and line.product_uos.id)\
+ or line.product_uom.id,
+ 'product_packaging': line.product_packaging.id,
+ 'partner_id': line.address_allotment_id.id or order.partner_shipping_id.id,
+ 'location_id': location_id,
+ 'location_dest_id': output_id,
+ 'sale_line_id': line.id,
+ 'tracking_id': False,
+ 'state': 'draft',
+ #'state': 'waiting',
+ 'note': '\n'.join(line.name.split('\n')[1:]),
+ 'company_id': order.company_id.id,
+ 'price_unit': line.product_id.standard_price or 0.0
+ }
+
+ def _prepare_order_picking(self, cr, uid, order, context=None):
+ pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.out')
+ return {
+ 'name': pick_name,
+ 'origin': order.name,
+ 'date': order.date_order,
+ 'type': 'out',
+ 'state': 'auto',
+ 'move_type': order.picking_policy,
+ 'sale_id': order.id,
+ 'partner_id': order.partner_shipping_id.id,
+ 'note': order.note,
+ 'invoice_state': (order.order_policy=='picking' and '2binvoiced') or 'none',
+ 'company_id': order.company_id.id,
+ }
+
+ def ship_recreate(self, cr, uid, order, line, move_id, proc_id):
+ # FIXME: deals with potentially cancelled shipments, seems broken (specially if shipment has production lot)
+ """
+ Define ship_recreate for process after shipping exception
+ param order: sale order to which the order lines belong
+ param line: sale order line records to procure
+ param move_id: the ID of stock move
+ param proc_id: the ID of procurement
+ """
+ move_obj = self.pool.get('stock.move')
+ if order.state == 'shipping_except':
+ for pick in order.picking_ids:
+ for move in pick.move_lines:
+ if move.state == 'cancel':
+ mov_ids = move_obj.search(cr, uid, [('state', '=', 'cancel'),('sale_line_id', '=', line.id),('picking_id', '=', pick.id)])
+ if mov_ids:
+ for mov in move_obj.browse(cr, uid, mov_ids):
+ # FIXME: the following seems broken: what if move_id doesn't exist? What if there are several mov_ids? Shouldn't that be a sum?
+ move_obj.write(cr, uid, [move_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty})
+ self.pool.get('procurement.order').write(cr, uid, [proc_id], {'product_qty': mov.product_qty, 'product_uos_qty': mov.product_uos_qty})
+ return True
+
+ def _get_date_planned(self, cr, uid, order, line, start_date, context=None):
+ date_planned = datetime.strptime(start_date, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=line.delay or 0.0)
+ date_planned = (date_planned - timedelta(days=order.company_id.security_lead)).strftime(DEFAULT_SERVER_DATETIME_FORMAT)
+ return date_planned
+
+ def _create_pickings_and_procurements(self, cr, uid, order, order_lines, picking_id=False, context=None):
+ """Create the required procurements to supply sale order lines, also connecting
+ the procurements to appropriate stock moves in order to bring the goods to the
+ sale order's requested location.
+
+ If ``picking_id`` is provided, the stock moves will be added to it, otherwise
+ a standard outgoing picking will be created to wrap the stock moves, as returned
+ by :meth:`~._prepare_order_picking`.
+
+ Modules that wish to customize the procurements or partition the stock moves over
+ multiple stock pickings may override this method and call ``super()`` with
+ different subsets of ``order_lines`` and/or preset ``picking_id`` values.
+
+ :param browse_record order: sale order to which the order lines belong
+ :param list(browse_record) order_lines: sale order line records to procure
+ :param int picking_id: optional ID of a stock picking to which the created stock moves
+ will be added. A new picking will be created if ommitted.
+ :return: True
+ """
+ move_obj = self.pool.get('stock.move')
+ picking_obj = self.pool.get('stock.picking')
+ procurement_obj = self.pool.get('procurement.order')
+ proc_ids = []
+
+ for line in order_lines:
+ if line.state == 'done':
+ continue
+
+ date_planned = self._get_date_planned(cr, uid, order, line, order.date_order, context=context)
+
+ if line.product_id:
+ if line.product_id.product_tmpl_id.type in ('product', 'consu'):
+ if not picking_id:
+ picking_id = picking_obj.create(cr, uid, self._prepare_order_picking(cr, uid, order, context=context))
+ move_id = move_obj.create(cr, uid, self._prepare_order_line_move(cr, uid, order, line, picking_id, date_planned, context=context))
+ else:
+ # a service has no stock move
+ move_id = False
+
+ proc_id = procurement_obj.create(cr, uid, self._prepare_order_line_procurement(cr, uid, order, line, move_id, date_planned, context=context))
+ proc_ids.append(proc_id)
+ line.write({'procurement_id': proc_id})
+ self.ship_recreate(cr, uid, order, line, move_id, proc_id)
+
+ wf_service = netsvc.LocalService("workflow")
+ if picking_id:
+ wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
+ self.delivery_send_note(cr, uid, [order.id], picking_id, context)
+
+
+ for proc_id in proc_ids:
+ wf_service.trg_validate(uid, 'procurement.order', proc_id, 'button_confirm', cr)
+
+ val = {}
+ if order.state == 'shipping_except':
+ val['state'] = 'progress'
+ val['shipped'] = False
+
+ if (order.order_policy == 'manual'):
+ for line in order.order_line:
+ if (not line.invoiced) and (line.state not in ('cancel', 'draft')):
+ val['state'] = 'manual'
+ break
+ order.write(val)
+ return True
+
+ def action_ship_create(self, cr, uid, ids, context=None):
+ for order in self.browse(cr, uid, ids, context=context):
+ self._create_pickings_and_procurements(cr, uid, order, order.order_line, None, context=context)
+ return True
+
+ def action_ship_end(self, cr, uid, ids, context=None):
+ for order in self.browse(cr, uid, ids, context=context):
+ val = {'shipped': True}
+ if order.state == 'shipping_except':
+ val['state'] = 'progress'
+ if (order.order_policy == 'manual'):
+ for line in order.order_line:
+ if (not line.invoiced) and (line.state not in ('cancel', 'draft')):
+ val['state'] = 'manual'
+ break
+ for line in order.order_line:
+ towrite = []
+ if line.state == 'exception':
+ towrite.append(line.id)
+ if towrite:
+ self.pool.get('sale.order.line').write(cr, uid, towrite, {'state': 'done'}, context=context)
+ res = self.write(cr, uid, [order.id], val)
+ if res:
+ self.delivery_end_send_note(cr, uid, [order.id], context=context)
+ return True
+
+ def has_stockable_products(self, cr, uid, ids, *args):
+ for order in self.browse(cr, uid, ids):
+ for order_line in order.order_line:
+ if order_line.product_id and order_line.product_id.product_tmpl_id.type in ('product', 'consu'):
+ return True
+ return False
+ # ------------------------------------------------
+ # OpenChatter methods and notifications
+ # ------------------------------------------------
+
+ def get_needaction_user_ids(self, cr, uid, ids, context=None):
+ result = super(sale_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
+ for obj in self.browse(cr, uid, ids, context=context):
+ if (obj.state == 'manual' or obj.state == 'progress'):
+ result[obj.id].append(obj.user_id.id)
+ return result
+
+ def delivery_send_note(self, cr, uid, ids, picking_id, context=None):
+ for order in self.browse(cr, uid, ids, context=context):
+ for picking in (pck for pck in order.picking_ids if pck.id == picking_id):
+ # convert datetime field to a datetime, using server format, then
+ # convert it to the user TZ and re-render it with %Z to add the timezone
+ picking_datetime = fields.DT.datetime.strptime(picking.min_date, DEFAULT_SERVER_DATETIME_FORMAT)
+ picking_date_str = fields.datetime.context_timestamp(cr, uid, picking_datetime, context=context).strftime(DATETIME_FORMATS_MAP['%+'] + " (%Z)")
+ self.message_append_note(cr, uid, [order.id], body=_("Delivery Order %s scheduled for %s.") % (picking.name, picking_date_str), context=context)
+
+ def delivery_end_send_note(self, cr, uid, ids, context=None):
+ self.message_append_note(cr, uid, ids, body=_("Order delivered ."), context=context)
+
+
+class sale_order_line(osv.osv):
+
+ def _number_packages(self, cr, uid, ids, field_name, arg, context=None):
+ res = {}
+ for line in self.browse(cr, uid, ids, context=context):
+ try:
+ res[line.id] = int((line.product_uom_qty+line.product_packaging.qty-0.0001) / line.product_packaging.qty)
+ except:
+ res[line.id] = 1
+ return res
+
+ _inherit = 'sale.order.line'
+ _columns = {
+ 'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}),
+ 'procurement_id': fields.many2one('procurement.order', 'Procurement'),
+ 'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True, readonly=True, states={'draft': [('readonly', False)]},
+ help="If 'on order', it triggers a procurement when the sale order is confirmed to create a task, purchase order or manufacturing order linked to this sale order line."),
+ 'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}),
+ 'product_packaging': fields.many2one('product.packaging', 'Packaging'),
+ 'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True),
+ 'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'),
+
+ }
+ _defaults = {
+ 'delay': 0.0,
+ 'type': 'make_to_stock',
+ 'product_packaging': False,
+ }
+
+ def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
+ def _get_line_qty(line):
+ if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
+ return self.pool.get('procurement.order').quantity_get(cr, uid, line.procurement_id.id, context=context)
+
+ def _get_line_uom(line):
+ if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
+ return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
+
+ return super(sale_order_line, self)._prepare_order_line_invoice_line(cr, uid, line, account_id=account_id, context=context)
+
+ def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False,
+ partner_id=False, packaging=False, flag=False, context=None):
+ if not product:
+ return {'value': {'product_packaging': False}}
+ product_obj = self.pool.get('product.product')
+ product_uom_obj = self.pool.get('product.uom')
+ pack_obj = self.pool.get('product.packaging')
+ warning = {}
+ result = {}
+ warning_msgs = ''
+ if flag:
+ res = self.product_id_change(cr, uid, ids, pricelist=pricelist,
+ product=product, qty=qty, uom=uom, partner_id=partner_id,
+ packaging=packaging, flag=False, context=context)
+ warning_msgs = res.get('warning') and res['warning']['message']
+
+ products = product_obj.browse(cr, uid, product, context=context)
+ if not products.packaging:
+ packaging = result['product_packaging'] = False
+ elif not packaging and products.packaging and not flag:
+ packaging = products.packaging[0].id
+ result['product_packaging'] = packaging
+
+ if packaging:
+ default_uom = products.uom_id and products.uom_id.id
+ pack = pack_obj.browse(cr, uid, packaging, context=context)
+ q = product_uom_obj._compute_qty(cr, uid, uom, pack.qty, default_uom)
+# qty = qty - qty % q + q
+ if qty and (q and not (qty % q) == 0):
+ ean = pack.ean or _('(n/a)')
+ qty_pack = pack.qty
+ type_ul = pack.ul
+ if not warning_msgs:
+ warn_msg = _("You selected a quantity of %d Units.\n"
+ "But it's not compatible with the selected packaging.\n"
+ "Here is a proposition of quantities according to the packaging:\n"
+ "EAN: %s Quantity: %s Type of ul: %s") % \
+ (qty, ean, qty_pack, type_ul.name)
+ warning_msgs += _("Picking Information ! : ") + warn_msg + "\n\n"
+ warning = {
+ 'title': _('Configuration Error !'),
+ 'message': warning_msgs
+ }
+ result['product_uom_qty'] = qty
+
+ return {'value': result, 'warning': warning}
+
\ No newline at end of file
diff --git a/addons/sale_stock/sale_stock_data.xml b/addons/sale_stock/sale_stock_data.xml
new file mode 100644
index 00000000000..2957f4556fa
--- /dev/null
+++ b/addons/sale_stock/sale_stock_data.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/sale_stock/sale_stock_demo.xml b/addons/sale_stock/sale_stock_demo.xml
new file mode 100644
index 00000000000..d336cd0c37e
--- /dev/null
+++ b/addons/sale_stock/sale_stock_demo.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+ manual
+
+
+
+
+
+ manual
+
+
+
+ manual
+
+
+
+ manual
+
+
+
+
+
+ picking
+ procurement
+ Invoice after delivery
+
+
+
+ make_to_stock
+
+
+
+ make_to_stock
+
+
+
+ make_to_order
+
+
+
+ make_to_order
+
+
+
+ 2
+
+
+
+ 7
+ make_to_order
+
+
+
+ 8
+ make_to_order
+
+
+
+ make_to_order
+ 1
+
+
+
+ make_to_order
+ 15
+
+
+
+ make_to_stock
+
+
+
+ 1
+ make_to_stock
+
+
+
+
+ make_to_stock
+
+
+
+ make_to_order
+ 15
+
+
+
+ make_to_order
+ 15
+
+
+
+ make_to_stock
+ 15
+
+
+
+ make_to_stock
+ 15
+
+
+
+
+
+
+
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
new file mode 100644
index 00000000000..47a33ea0179
--- /dev/null
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+
+ sale.shop.sale.stock
+ sale.shop
+
+ tree
+
+
+
+
+
+
+
+
+
+ sale.order.tree.sale.stock
+ sale.order
+
+ tree
+
+
+
+
+
+
+
+
+ sale.order.form.sale.stock
+ sale.order
+
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ days
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/sale_stock/sale_stock_workflow.xml b/addons/sale_stock/sale_stock_workflow.xml
new file mode 100644
index 00000000000..0bea307292c
--- /dev/null
+++ b/addons/sale_stock/sale_stock_workflow.xml
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+
+
+ wait_ship
+
+
+
+
+ cancel3
+ True
+ stopall
+ action_cancel()
+
+
+
+
+ ship
+ function
+ action_ship_create()
+
+
+
+
+ ship_except
+ function
+ write({'state':'shipping_except'})
+
+
+
+
+ ship_end
+ function
+ action_ship_end()
+
+
+
+
+ ship_cancel
+ True
+ stopall
+ action_cancel()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ (order_policy=='picking')
+
+
+
+
+
+ cancel
+
+
+
+
+
+ (order_policy!='prepaid') or invoiced
+
+
+
+
+
+ manual_invoice
+
+
+
+
+
+
+
+
+
+
+ procurement.order
+ procurement_lines_get()
+ test_state('finished')
+
+
+
+
+
+ test_state('canceled')
+
+
+
+
+
+
+ ship_recreate
+
+
+
+
+
+ ship_corrected
+
+
+
+
+
+ ship_cancel
+
+
+
+
diff --git a/addons/sale_stock/security/ir.model.access.csv b/addons/sale_stock/security/ir.model.access.csv
new file mode 100644
index 00000000000..c8e6f2b7342
--- /dev/null
+++ b/addons/sale_stock/security/ir.model.access.csv
@@ -0,0 +1,17 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_stock_picking_salesman,stock_picking salesman,stock.model_stock_picking,base.group_sale_salesman,1,1,1,0
+access_stock_move_salesman,stock_move salesman,stock.model_stock_move,base.group_sale_salesman,1,1,1,0
+access_stock_move_manager,stock_move manager,stock.model_stock_move,base.group_sale_manager,1,1,1,1
+access_procurement_salesman,procurement.order salesman,procurement.model_procurement_order,base.group_sale_salesman,1,1,1,0
+access_procurement_manager,procurement.order manager,procurement.model_procurement_order,base.group_sale_manager,1,1,1,1
+access_sale_order_stock_worker,sale.order stock worker,model_sale_order,stock.group_stock_user,1,1,0,0
+access_sale_order_line_stock_worker,sale.order.line stock worker,model_sale_order_line,stock.group_stock_user,1,1,0,0
+access_report_stock_move_sales,report.stock.move.sale,stock.model_report_stock_move,base.group_sale_manager,1,1,1,1
+access_stock_picking_sales,stock.picking.sales,stock.model_stock_picking,base.group_sale_manager,1,1,1,1
+access_product_packaging_user,product.packaging.user,product.model_product_packaging,base.group_sale_salesman,1,1,1,0
+access_product_packaging_manager,product.packaging.manager,product.model_product_packaging,base.group_sale_manager,1,0,0,0
+access_stock_warehouse_user,stock.warehouse.user,stock.model_stock_warehouse,base.group_sale_salesman,1,0,0,0
+access_stock_location_user,stock.location.user,stock.model_stock_location,base.group_sale_salesman,1,0,0,0
+access_product_packaging_sale_manager,product.packaging salemanager,product.model_product_packaging,base.group_sale_manager,1,1,1,1
+access_stock_warehouse_orderpoint_sale_salesman,stock.warehouse.orderpoint,procurement.model_stock_warehouse_orderpoint,base.group_sale_salesman,1,0,0,0
+access_account_move_line_salesman,account.move.line invoice,account.model_account_move_line,base.group_sale_salesman,1,0,0,0
\ No newline at end of file
diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml
new file mode 100644
index 00000000000..83db390a2c4
--- /dev/null
+++ b/addons/sale_stock/security/sale_stock_security.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ Enable Invoicing Delivery orders
+
+
+
+
+ Properties on lines
+
+
+
+
+
+
diff --git a/addons/sale/stock.py b/addons/sale_stock/stock.py
similarity index 100%
rename from addons/sale/stock.py
rename to addons/sale_stock/stock.py
diff --git a/addons/sale/stock_view.xml b/addons/sale_stock/stock_view.xml
similarity index 98%
rename from addons/sale/stock_view.xml
rename to addons/sale_stock/stock_view.xml
index 40de6872be0..6399658c392 100644
--- a/addons/sale/stock_view.xml
+++ b/addons/sale_stock/stock_view.xml
@@ -77,7 +77,7 @@
{'default_type': 'out', 'contact_display': 'partner_address', 'search_default_to_invoice': 1, 'search_default_done': 1, 'default_invoice_state': '2binvoiced'}
-
+
diff --git a/addons/sale_stock/test/cancel_order_sale_stock.yml b/addons/sale_stock/test/cancel_order_sale_stock.yml
new file mode 100644
index 00000000000..edac19ccb02
--- /dev/null
+++ b/addons/sale_stock/test/cancel_order_sale_stock.yml
@@ -0,0 +1,42 @@
+-
+ In order to test the cancel sale order.
+ First I confirm order.
+-
+ !workflow {model: sale.order, action: order_confirm, ref: sale.order5}
+-
+ Now I regenerate shipment.
+-
+ !workflow {model: sale.order, action: ship_recreate, ref: sale.order5}
+-
+ I check state of order in 'To Invoice'.
+-
+ !assert {model: sale.order, id: sale.order5, string: Sale order should be In Progress state}:
+ - state == 'manual'
+-
+ I make invoice for order.
+-
+ !workflow {model: sale.order, action: manual_invoice, ref: sale.order5}
+-
+ To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
+-
+ !python {model: sale.order}: |
+ import netsvc
+ invoice_ids = self.browse(cr, uid, ref("sale.order5")).invoice_ids
+ wf_service = netsvc.LocalService("workflow")
+ first_invoice_id = invoice_ids[0]
+ wf_service.trg_validate(uid, 'account.invoice', first_invoice_id.id, 'invoice_cancel', cr)
+-
+ I check order status in "Invoice Exception" and related invoice is in cancel state.
+-
+ !assert {model: sale.order, id: sale.order5, string: Sale order should be in Invoice Exception state}:
+ - state == "invoice_except", "Order should be in Invoice Exception state after cancel Invoice"
+-
+ Then I click on the Ignore Exception button.
+-
+ !workflow {model: sale.order, action: invoice_corrected, ref: sale.order5}
+
+-
+ I check state of order in 'In Progress'.
+-
+ !assert {model: sale.order, id: sale.order5, string: Sale order should be In progress state}:
+ - state == 'progress'
\ No newline at end of file
diff --git a/addons/sale/test/manual_order_policy.yml b/addons/sale_stock/test/manual_order_policy.yml
similarity index 83%
rename from addons/sale/test/manual_order_policy.yml
rename to addons/sale_stock/test/manual_order_policy.yml
index 505ab0933d0..e640a08e8bb 100644
--- a/addons/sale/test/manual_order_policy.yml
+++ b/addons/sale_stock/test/manual_order_policy.yml
@@ -1,12 +1,12 @@
-
I confirm the Quotation with "Deliver & invoice on demand".
-
- !workflow {model: sale.order, action: order_confirm, ref: order4}
+ !workflow {model: sale.order, action: order_confirm, ref: sale.order4}
-
I check that Invoice should not created.
-
!python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("order4"))
+ sale_order = self.browse(cr, uid, ref("sale.order4"))
assert len(sale_order.invoice_ids) == False, "Invoice should not created."
assert sale_order.picking_ids, "Delivery order should be created."
-
@@ -14,28 +14,28 @@
-
!python {model: sale.advance.payment.inv}: |
ctx = context.copy()
- ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
- order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("line7"), context=context)
+ ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.order4")], "active_id":ref("sale.order4")})
+ order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale.line7"), context=context)
pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
self.create_invoices(cr, uid, [pay_id], context=ctx)
-
I check Invoice which made advance
-
!python {model: sale.order}: |
- order = self.browse(cr, uid, ref('order4'))
+ order = self.browse(cr, uid, ref('sale.order4'))
assert order.invoice_ids, "Invoice should be created after make advance invoice."
-
I create Invoice from sale order line.
-
!python {model: sale.order.line.make.invoice}: |
ctx = context.copy()
- ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("line8")], "active_id":ref("line8")})
+ ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("sale.line8")], "active_id":ref("sale.line8")})
self.make_invoices(cr, uid, [], context=ctx)
-
I check Invoice which made from sale order line.
-
!python {model: sale.order.line}: |
- line = self.browse(cr, uid, ref('line8'))
+ line = self.browse(cr, uid, ref('sale.line8'))
assert line.invoiced, "Line is not invoiced."
assert line.invoice_lines, "Invoice line should be created."
-
@@ -46,7 +46,7 @@
-
!python {model: sale.make.invoice}: |
ctx = context.copy()
- ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("order4")], "active_id":ref("order4")})
+ ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.order4")], "active_id":ref("sale.order4")})
self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context)
-
I open the Invoice.
@@ -54,7 +54,7 @@
!python {model: sale.order}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
- so = self.browse(cr, uid, ref("order4"))
+ so = self.browse(cr, uid, ref("sale.order4"))
for invoice in so.invoice_ids:
wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
-
@@ -62,7 +62,7 @@
-
!python {model: account.invoice}: |
sale_order = self.pool.get('sale.order')
- order = sale_order.browse(cr, uid, ref("order4"))
+ order = sale_order.browse(cr, uid, ref("sale.order4"))
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
for invoice in order.invoice_ids:
invoice.pay_and_reconcile(
@@ -74,7 +74,7 @@
I check Invoice after do manual.
-
!python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("order4"))
+ sale_order = self.browse(cr, uid, ref("sale.order4"))
assert sale_order.invoice_ids, "Invoice should be created."
assert sale_order.invoiced, "Order is not invoiced."
assert sale_order.state == 'manual', 'Order should be in Manual.'
diff --git a/addons/sale/test/picking_order_policy.yml b/addons/sale_stock/test/picking_order_policy.yml
similarity index 91%
rename from addons/sale/test/picking_order_policy.yml
rename to addons/sale_stock/test/picking_order_policy.yml
index 16caefddf1b..73d392c1b23 100644
--- a/addons/sale/test/picking_order_policy.yml
+++ b/addons/sale_stock/test/picking_order_policy.yml
@@ -3,17 +3,17 @@
-
First I check the total amount of the Quotation before Approved.
-
- !assert {model: sale.order, id: order, string: The amount of the Quotation is not correctly computed}:
+ !assert {model: sale.order, id: sale.order, string: The amount of the Quotation is not correctly computed}:
- sum([l.price_subtotal for l in order_line]) == amount_untaxed
-
I confirm the quotation with "Invoice based on deliveries" policy.
-
- !workflow {model: sale.order, action: order_confirm, ref: order}
+ !workflow {model: sale.order, action: order_confirm, ref: sale.order}
-
I check that invoice should not created before dispatch delivery.
-
!python {model: sale.order}: |
- order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale.order"))
assert order.state == 'progress', 'Order should be in inprogress.'
assert len(order.invoice_ids) == False, "Invoice should not created."
-
@@ -23,7 +23,7 @@
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
- order = self.browse(cr, uid, ref("order"))
+ order = self.browse(cr, uid, ref("sale.order"))
for order_line in order.order_line:
procurement = order_line.procurement_id
date_planned = datetime.strptime(order.date_order, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(days=order_line.delay or 0.0)
@@ -45,7 +45,7 @@
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT
- sale_order = self.browse(cr, uid, ref("order"))
+ sale_order = self.browse(cr, uid, ref("sale.order"))
assert sale_order.picking_ids, "Delivery order is not created."
for picking in sale_order.picking_ids:
assert picking.state == "auto" or "confirmed", "Delivery order should be in 'Waitting Availability' state."
@@ -77,7 +77,7 @@
Now, I dispatch delivery order.
-
!python {model: stock.partial.picking}: |
- order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale.order"))
for pick in order.picking_ids:
data = pick.force_assign()
if data == True:
@@ -87,7 +87,7 @@
I check sale order to verify shipment.
-
!python {model: sale.order}: |
- order = self.pool.get('sale.order').browse(cr, uid, ref("order"))
+ order = self.pool.get('sale.order').browse(cr, uid, ref("sale.order"))
assert order.shipped == True, "Sale order is not Delivered."
assert order.picked_rate == 100, "Shipment progress is not 100%."
#assert order.state == 'progress', 'Order should be in inprogress.'
@@ -97,7 +97,7 @@
-
!python {model: stock.invoice.onshipping}: |
sale = self.pool.get('sale.order')
- sale_order = sale.browse(cr, uid, ref("order"))
+ sale_order = sale.browse(cr, uid, ref("sale.order"))
ship_ids = [x.id for x in sale_order.picking_ids]
wiz_id = self.create(cr, uid, {'journal_id': ref('account.sales_journal')},
{'active_ids': ship_ids, 'active_model': 'stock.picking'})
@@ -106,7 +106,7 @@
I check the invoice details after dispatched delivery.
-
!python {model: sale.order}: |
- order = self.browse(cr, uid, ref("order"))
+ order = self.browse(cr, uid, ref("sale.order"))
assert order.invoice_ids, "Invoice is not created."
ac = order.partner_id.property_account_receivable.id
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'sale'), ('company_id', '=', order.company_id.id)])
@@ -134,7 +134,7 @@
!python {model: sale.order}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
- so = self.browse(cr, uid, ref("order"))
+ so = self.browse(cr, uid, ref("sale.order"))
for invoice in so.invoice_ids:
wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
-
@@ -142,7 +142,7 @@
-
!python {model: account.invoice}: |
sale_order = self.pool.get('sale.order')
- order = sale_order.browse(cr, uid, ref("order"))
+ order = sale_order.browse(cr, uid, ref("sale.order"))
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
for invoice in order.invoice_ids:
invoice.pay_and_reconcile(
@@ -154,7 +154,7 @@
I check the order after paid invoice.
-
!python {model: sale.order}: |
- order = self.browse(cr, uid, ref("order"))
+ order = self.browse(cr, uid, ref("sale.order"))
assert order.invoiced == True, "Sale order is not invoiced."
assert order.invoiced_rate == 100, "Invoiced progress is not 100%."
assert order.state == 'done', 'Order should be in closed.'
@@ -163,7 +163,7 @@
-
!python {model: sale.order}: |
import netsvc, tools, os
- (data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('order')], {}, {})
+ (data, format) = netsvc.LocalService('report.sale.order').create(cr, uid, [ref('sale.order')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'sale-sale_order.'+format), 'wb+').write(data)
diff --git a/addons/sale_stock/wizard/__init__.py b/addons/sale_stock/wizard/__init__.py
new file mode 100644
index 00000000000..504e6eddbc0
--- /dev/null
+++ b/addons/sale_stock/wizard/__init__.py
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL ().
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import sale_make_invoice
+import sale_make_invoice_advance
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/sale/wizard/sale_make_invoice.py b/addons/sale_stock/wizard/sale_make_invoice.py
similarity index 100%
rename from addons/sale/wizard/sale_make_invoice.py
rename to addons/sale_stock/wizard/sale_make_invoice.py
diff --git a/addons/sale/wizard/sale_make_invoice.xml b/addons/sale_stock/wizard/sale_make_invoice.xml
similarity index 100%
rename from addons/sale/wizard/sale_make_invoice.xml
rename to addons/sale_stock/wizard/sale_make_invoice.xml
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale_stock/wizard/sale_make_invoice_advance.py
similarity index 100%
rename from addons/sale/wizard/sale_make_invoice_advance.py
rename to addons/sale_stock/wizard/sale_make_invoice_advance.py
diff --git a/addons/sale/wizard/sale_make_invoice_advance.xml b/addons/sale_stock/wizard/sale_make_invoice_advance.xml
similarity index 100%
rename from addons/sale/wizard/sale_make_invoice_advance.xml
rename to addons/sale_stock/wizard/sale_make_invoice_advance.xml
From bab2f1959f948b83fc42919aaee6a4da6bdf95da Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Fri, 27 Jul 2012 11:58:41 +0530
Subject: [PATCH 031/166] [FIX]: Fix menu and workflow problem
bzr revid: atp@tinyerp.com-20120727062841-cg5qtd34nnll8n5r
---
addons/sale/sale_demo.xml | 4 +---
addons/sale/security/sale_security.xml | 6 ------
addons/sale_stock/res_config.py | 4 ++--
addons/sale_stock/sale_stock_demo.xml | 5 ++++-
addons/sale_stock/sale_stock_view.xml | 5 +----
addons/sale_stock/security/sale_stock_security.xml | 4 ++++
addons/sale_stock/stock_view.xml | 2 +-
7 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml
index 4d0e8914c3e..a04eca80871 100644
--- a/addons/sale/sale_demo.xml
+++ b/addons/sale/sale_demo.xml
@@ -111,8 +111,6 @@
3
-
-
@@ -195,7 +193,7 @@
4
500
-
+
diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml
index 4e23a45436e..8b64b360435 100644
--- a/addons/sale/security/sale_security.xml
+++ b/addons/sale/security/sale_security.xml
@@ -42,12 +42,6 @@
-
- Enable Invoicing Delivery orders
-
-
-
-
diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py
index c7d3d970b67..b337fe5e794 100644
--- a/addons/sale_stock/res_config.py
+++ b/addons/sale_stock/res_config.py
@@ -27,7 +27,7 @@ class sale_configuration(osv.osv_memory):
_inherit = 'sale.config.settings'
_columns = {
'group_invoice_deli_orders': fields.boolean('Based on Delivery Orders',
- implied_group='sale.group_invoice_deli_orders',
+ implied_group='group_invoice_deli_orders',
help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."),
'task_work': fields.boolean('Based on Task Activities',
help="""Lets you transfer the entries under tasks defined for Project Management to
@@ -45,7 +45,7 @@ class sale_configuration(osv.osv_memory):
'default_picking_policy' : fields.boolean("Configurable Shipping Policy",
help = "You will be able to configure, per sale order, if you deliver all products at once or if you deliver each product when it is available. This may have an impact on the shipping price."),
'group_mrp_properties': fields.boolean('Properties on Lines',
- implied_group='sale.group_mrp_properties',
+ implied_group='group_mrp_properties',
help="Allows you to tag sale order lines with properties."),
'group_multiple_shops': fields.boolean("Manage Multiple Shops",
implied_group='stock.group_locations',
diff --git a/addons/sale_stock/sale_stock_demo.xml b/addons/sale_stock/sale_stock_demo.xml
index d336cd0c37e..9e4a1f60632 100644
--- a/addons/sale_stock/sale_stock_demo.xml
+++ b/addons/sale_stock/sale_stock_demo.xml
@@ -12,15 +12,18 @@
manual
+
+
manual
+
+
manual
-
picking
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index 96128e40000..e15bc023462 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -133,13 +133,10 @@
-
+
-
-
-
diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml
index 54d04f08e11..73badf9ad0e 100644
--- a/addons/sale_stock/security/sale_stock_security.xml
+++ b/addons/sale_stock/security/sale_stock_security.xml
@@ -7,6 +7,10 @@
+
+ Enable Invoicing Delivery orders
+
+
diff --git a/addons/sale_stock/stock_view.xml b/addons/sale_stock/stock_view.xml
index 40de6872be0..6399658c392 100644
--- a/addons/sale_stock/stock_view.xml
+++ b/addons/sale_stock/stock_view.xml
@@ -77,7 +77,7 @@
{'default_type': 'out', 'contact_display': 'partner_address', 'search_default_to_invoice': 1, 'search_default_done': 1, 'default_invoice_state': '2binvoiced'}
-
+
From 692357c872b9798330cb81b718388389e942abf0 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Fri, 27 Jul 2012 12:47:08 +0530
Subject: [PATCH 032/166] [FIX]: Fix product_id onchange problem
bzr revid: atp@tinyerp.com-20120727071708-gx51ajrt2zfdtgzy
---
addons/sale/res_config_view.xml | 2 +-
addons/sale/sale.py | 22 ++-----
addons/sale/sale_workflow.xml | 77 ++++++++++-------------
addons/sale_stock/res_config_view.xml | 6 +-
addons/sale_stock/sale_stock_view.xml | 24 +++----
addons/sale_stock/sale_stock_workflow.xml | 13 ++--
6 files changed, 56 insertions(+), 88 deletions(-)
diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml
index 023da1b37eb..d482a681563 100644
--- a/addons/sale/res_config_view.xml
+++ b/addons/sale/res_config_view.xml
@@ -25,7 +25,7 @@
+ attrs="{'invisible': [('module_account_analytic_analysis','=',False)],'required': [('module_account_analytic_analysis','=',True)]}"/>
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index a5316ce10fa..fca3fa992de 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -815,11 +815,6 @@ class sale_order_line(osv.osv):
for line in self.browse(cr, uid, ids, context=context):
if line.invoiced:
raise osv.except_osv(_('Invalid action !'), _('You cannot cancel a sale order line that has already been invoiced!'))
- for move_line in line.move_ids:
- if move_line.state != 'cancel':
- raise osv.except_osv(
- _('Could not cancel sales order line!'),
- _('You must first cancel stock moves attached to this sales order line.'))
return self.write(cr, uid, ids, {'state': 'cancel'})
def button_confirm(self, cr, uid, ids, context=None):
@@ -855,7 +850,7 @@ class sale_order_line(osv.osv):
def copy_data(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
- default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []})
+ default.update({'state': 'draft', 'invoiced': False, 'invoice_lines': []})
return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context)
@@ -876,14 +871,14 @@ class sale_order_line(osv.osv):
context_partner = {'lang': lang, 'partner_id': partner_id}
if not product:
- return {'value': {'th_weight': 0, 'product_packaging': False,
+ return {'value': {'th_weight': 0,
'product_uos_qty': qty}, 'domain': {'product_uom': [],
'product_uos': []}}
if not date_order:
date_order = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
- res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
- result = res.get('value', {})
+ res = {}
+ result = res
warning_msgs = res.get('warning') and res['warning']['message'] or ''
product_obj = product_obj.browse(cr, uid, product, context=context)
@@ -901,7 +896,6 @@ class sale_order_line(osv.osv):
uos = False
fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False
if update_tax: #The quantity only have changed
- result['delay'] = (product_obj.sale_delay or 0.0)
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
result.update({'type': product_obj.procure_method})
@@ -943,14 +937,6 @@ class sale_order_line(osv.osv):
if not uom2:
uom2 = product_obj.uom_id
- compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
- if (product_obj.type=='product') and int(compare_qty) == -1 \
- and (product_obj.procure_method=='make_to_stock'):
- warn_msg = _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % \
- (qty, uom2 and uom2.name or product_obj.uom_id.name,
- max(0,product_obj.virtual_available), product_obj.uom_id.name,
- max(0,product_obj.qty_available), product_obj.uom_id.name)
- warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
# get unit price
if not pricelist:
diff --git a/addons/sale/sale_workflow.xml b/addons/sale/sale_workflow.xml
index 7db2b6dbcbe..5e032eab8c6 100644
--- a/addons/sale/sale_workflow.xml
+++ b/addons/sale/sale_workflow.xml
@@ -13,12 +13,14 @@
True
draft
+
sent
function
write({'state':'sent'})
-
+
+
router
@@ -26,6 +28,7 @@
action_wait()
OR
+
wait_invoice
@@ -39,6 +42,7 @@
write({'state':'done'})
AND
+
cancel
@@ -46,6 +50,7 @@
stopall
action_cancel()
+
cancel2
@@ -53,13 +58,7 @@
stopall
action_cancel()
-
-
- cancel3
- True
- stopall
- action_cancel()
-
+
invoice
@@ -79,7 +78,6 @@
function
action_invoice_end()
-
invoice_cancel
@@ -89,26 +87,21 @@
-
-
-
-
-
-
-
-
-
- order_confirm
-
-
+
quotation_sent
-
-
-
+
+
+
+
+ order_confirm
+
+
+
+
cancel
@@ -118,52 +111,41 @@
order_confirm
-
-
-
+
+
+
cancel
-
+
+
+
+
+
+
all_lines
-
-
-
-
- (order_policy=='picking')
-
-
-
-
-
-
-
-
cancel
-
(order_policy=='prepaid')
-
subflow.paid
-
@@ -184,6 +166,11 @@
invoice_cancel
-
+
+
+
+
+
+
diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml
index e68aa3b5662..481b4da6d3c 100644
--- a/addons/sale_stock/res_config_view.xml
+++ b/addons/sale_stock/res_config_view.xml
@@ -15,7 +15,7 @@
-
+
@@ -37,6 +37,10 @@
+
+
+
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index e15bc023462..488e948a7ef 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -83,13 +83,6 @@
-
-
-
-
-
-
-
@@ -105,27 +98,26 @@
-
+
days
-
-
+
+
-
-
+
+
-
-
+
+
-
+
-
diff --git a/addons/sale_stock/sale_stock_workflow.xml b/addons/sale_stock/sale_stock_workflow.xml
index 0bea307292c..db2e64e4b6f 100644
--- a/addons/sale_stock/sale_stock_workflow.xml
+++ b/addons/sale_stock/sale_stock_workflow.xml
@@ -53,7 +53,6 @@
-
@@ -64,6 +63,12 @@
(order_policy=='picking')
+
+
+
+
+ manual_invoice
+
@@ -77,12 +82,6 @@
(order_policy!='prepaid') or invoiced
-
-
-
- manual_invoice
-
-
From 9d5336923fb73bd9f50f14c8381eea9e8010a1cf Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Fri, 27 Jul 2012 13:03:21 +0530
Subject: [PATCH 033/166] [FIX]: Fix dependency problem
bzr revid: atp@tinyerp.com-20120727073321-9i655wdu63tdvf8n
---
addons/sale_order_dates/__openerp__.py | 2 +-
addons/sale_stock/sale_stock_workflow.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/sale_order_dates/__openerp__.py b/addons/sale_order_dates/__openerp__.py
index f5ccef7ffe5..f67c7034821 100644
--- a/addons/sale_order_dates/__openerp__.py
+++ b/addons/sale_order_dates/__openerp__.py
@@ -36,7 +36,7 @@ You can add the following additional dates to a sale order:
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ["images/sale_order_dates.jpeg"],
- 'depends': ["sale"],
+ 'depends': ["sale_stock"],
'init_xml': [
],
diff --git a/addons/sale_stock/sale_stock_workflow.xml b/addons/sale_stock/sale_stock_workflow.xml
index db2e64e4b6f..5177ab37720 100644
--- a/addons/sale_stock/sale_stock_workflow.xml
+++ b/addons/sale_stock/sale_stock_workflow.xml
@@ -68,7 +68,7 @@
manual_invoice
-
+
From bbbbe7c46b7a119fcb1daf1be844b306bea93d1c Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Fri, 27 Jul 2012 14:36:07 +0530
Subject: [PATCH 034/166] [FIX]: Chance manual_invoice method into sale_stock
module.
bzr revid: atp@tinyerp.com-20120727090607-w3y8jiy459z0iuok
---
addons/sale/sale.py | 30 -------------------
addons/sale_stock/sale_stock.py | 35 ++++++++++++++++++++++-
addons/sale_stock/sale_stock_workflow.xml | 4 ---
3 files changed, 34 insertions(+), 35 deletions(-)
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index fca3fa992de..f458eb9e651 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -378,36 +378,6 @@ class sale_order(osv.osv):
}
return {'type': 'ir.actions.report.xml', 'report_name': 'sale.order', 'datas': datas, 'nodestroy': True}
- def manual_invoice(self, cr, uid, ids, context=None):
- """ create invoices for the given sale orders (ids), and open the form
- view of one of the newly created invoices
- """
- mod_obj = self.pool.get('ir.model.data')
- wf_service = netsvc.LocalService("workflow")
-
- # create invoices through the sale orders' workflow
- inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
- for id in ids:
- wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
- inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
- # determine newly created invoices
- new_inv_ids = list(inv_ids1 - inv_ids0)
-
- res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
- res_id = res and res[1] or False,
-
- return {
- 'name': _('Customer Invoices'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'view_id': [res_id],
- 'res_model': 'account.invoice',
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window',
- 'nodestroy': True,
- 'target': 'current',
- 'res_id': new_inv_ids and new_inv_ids[0] or False,
- }
def action_view_invoice(self, cr, uid, ids, context=None):
'''
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 3c43587a199..9f1ce3e590c 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -208,7 +208,40 @@ class sale_order(osv.osv):
self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
self.confirm_send_note(cr, uid, ids, context)
- return True
+ return True
+
+ def manual_invoice(self, cr, uid, ids, context=None):
+ """ create invoices for the given sale orders (ids), and open the form
+ view of one of the newly created invoices
+ """
+ mod_obj = self.pool.get('ir.model.data')
+ wf_service = netsvc.LocalService("workflow")
+
+ # create invoices through the sale orders' workflow
+ inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
+ for id in ids:
+ wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
+ inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
+ # determine newly created invoices
+ new_inv_ids = list(inv_ids1 - inv_ids0)
+
+ res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
+ res_id = res and res[1] or False,
+
+ return {
+ 'name': _('Customer Invoices'),
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'view_id': [res_id],
+ 'res_model': 'account.invoice',
+ 'context': "{'type':'out_invoice'}",
+ 'type': 'ir.actions.act_window',
+ 'nodestroy': True,
+ 'target': 'current',
+ 'res_id': new_inv_ids and new_inv_ids[0] or False,
+ }
+
+
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
res = False
diff --git a/addons/sale_stock/sale_stock_workflow.xml b/addons/sale_stock/sale_stock_workflow.xml
index 5177ab37720..7b757501e48 100644
--- a/addons/sale_stock/sale_stock_workflow.xml
+++ b/addons/sale_stock/sale_stock_workflow.xml
@@ -53,10 +53,6 @@
-
-
-
-
From cc4a66732b044189dc1c8be1f4bd144c5e3bebde Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Fri, 27 Jul 2012 14:58:39 +0530
Subject: [PATCH 035/166] [ADD]: Add dependency
bzr revid: atp@tinyerp.com-20120727092839-xgnolhsz2aetnxre
---
addons/delivery/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py
index 092258f5e91..24f0b8f4bd9 100644
--- a/addons/delivery/__openerp__.py
+++ b/addons/delivery/__openerp__.py
@@ -32,7 +32,7 @@ You can define your own carrier and delivery grids for prices. When creating
invoices from picking, OpenERP is able to add and compute the shipping line.
""",
'author': 'OpenERP SA',
- 'depends': ['sale', 'purchase', 'stock'],
+ 'depends': ['sale_stock', 'purchase', 'stock'],
'init_xml': ['delivery_data.xml'],
'update_xml': [
'security/ir.model.access.csv',
From f2df648741614fa94cc83cbbcabf87b72740d270 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Fri, 27 Jul 2012 15:06:15 +0530
Subject: [PATCH 036/166] [FIX]: Fix group unpack problem
bzr revid: atp@tinyerp.com-20120727093615-9f53wu6z6f7j931b
---
addons/sale_stock/res_config.py | 4 ++--
addons/sale_stock/sale_stock_view.xml | 2 +-
addons/sale_stock/stock_view.xml | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py
index b337fe5e794..dfb93190d0a 100644
--- a/addons/sale_stock/res_config.py
+++ b/addons/sale_stock/res_config.py
@@ -27,7 +27,7 @@ class sale_configuration(osv.osv_memory):
_inherit = 'sale.config.settings'
_columns = {
'group_invoice_deli_orders': fields.boolean('Based on Delivery Orders',
- implied_group='group_invoice_deli_orders',
+ implied_group='sale_stock.group_invoice_deli_orders',
help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."),
'task_work': fields.boolean('Based on Task Activities',
help="""Lets you transfer the entries under tasks defined for Project Management to
@@ -45,7 +45,7 @@ class sale_configuration(osv.osv_memory):
'default_picking_policy' : fields.boolean("Configurable Shipping Policy",
help = "You will be able to configure, per sale order, if you deliver all products at once or if you deliver each product when it is available. This may have an impact on the shipping price."),
'group_mrp_properties': fields.boolean('Properties on Lines',
- implied_group='group_mrp_properties',
+ implied_group='sale_stock.group_mrp_properties',
help="Allows you to tag sale order lines with properties."),
'group_multiple_shops': fields.boolean("Manage Multiple Shops",
implied_group='stock.group_locations',
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index 488e948a7ef..d850ce16ada 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -107,7 +107,7 @@
+ groups="sale_stock.group_mrp_properties"/>
diff --git a/addons/sale_stock/stock_view.xml b/addons/sale_stock/stock_view.xml
index 6399658c392..0990cbc9914 100644
--- a/addons/sale_stock/stock_view.xml
+++ b/addons/sale_stock/stock_view.xml
@@ -77,7 +77,7 @@
{'default_type': 'out', 'contact_display': 'partner_address', 'search_default_to_invoice': 1, 'search_default_done': 1, 'default_invoice_state': '2binvoiced'}
-
+
From fee255cfcb12a61b8f3317b2351adcbd92a9848c Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sat, 28 Jul 2012 00:06:33 +0530
Subject: [PATCH 037/166] [ADD]: Add dependency sale_stock into point_of_sale
bzr revid: atp@tinyerp.com-20120727183633-jq3se5avp2k0hpeb
---
addons/point_of_sale/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/point_of_sale/__openerp__.py b/addons/point_of_sale/__openerp__.py
index 9a39871f0c0..903b2d47c3a 100644
--- a/addons/point_of_sale/__openerp__.py
+++ b/addons/point_of_sale/__openerp__.py
@@ -41,7 +41,7 @@ Main features:
""",
'author': 'OpenERP SA',
'images': ['images/cash_registers.jpeg', 'images/pos_analysis.jpeg','images/register_analysis.jpeg','images/sale_order_pos.jpeg','images/product_pos.jpeg'],
- 'depends': ['sale'],
+ 'depends': ['sale_stock'],
'init_xml': [],
'update_xml': [
From cb6ade257746bacf40f9e50427dd2d429105a7c8 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sat, 28 Jul 2012 22:54:52 +0530
Subject: [PATCH 038/166] [FIX]: remove depency from delivery. remove duplicate
process from sale form.
bzr revid: atp@tinyerp.com-20120728172452-falievqp8ve97dti
---
addons/delivery/__openerp__.py | 2 +-
addons/sale/process/sale_process.xml | 22 ----------------
.../sale_stock/process/sale_stock_process.xml | 26 +++++++++++++++++++
3 files changed, 27 insertions(+), 23 deletions(-)
diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py
index 24f0b8f4bd9..092258f5e91 100644
--- a/addons/delivery/__openerp__.py
+++ b/addons/delivery/__openerp__.py
@@ -32,7 +32,7 @@ You can define your own carrier and delivery grids for prices. When creating
invoices from picking, OpenERP is able to add and compute the shipping line.
""",
'author': 'OpenERP SA',
- 'depends': ['sale_stock', 'purchase', 'stock'],
+ 'depends': ['sale', 'purchase', 'stock'],
'init_xml': ['delivery_data.xml'],
'update_xml': [
'security/ir.model.access.csv',
diff --git a/addons/sale/process/sale_process.xml b/addons/sale/process/sale_process.xml
index 05999ff6fb8..836c6fddc04 100644
--- a/addons/sale/process/sale_process.xml
+++ b/addons/sale/process/sale_process.xml
@@ -62,28 +62,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
From eb902136ba58bc23722f32c3c123c706862e9465 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sat, 28 Jul 2012 23:35:05 +0530
Subject: [PATCH 039/166] [IMP]: ADD onchange of order policy
bzr revid: atp@tinyerp.com-20120728180505-lu2warmnrzto55xw
---
addons/sale_stock/sale_stock_view.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index d850ce16ada..ce24e3f3903 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -125,6 +125,9 @@
+
+
+
From 49f6e45b02443e17cd87f574f7b097dcb2a45c48 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sat, 28 Jul 2012 23:40:05 +0530
Subject: [PATCH 040/166] [ADD]: Add oe_highlight in create invoice button.
bzr revid: atp@tinyerp.com-20120728181005-2ucqag0pihgrhcct
---
addons/sale_stock/sale_stock_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index ce24e3f3903..40c44d0e2d1 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -64,7 +64,7 @@
-
+
From 3a9da0c95dd13a3033ac6bea44d401b18024f502 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sun, 29 Jul 2012 21:37:56 +0530
Subject: [PATCH 041/166] [FIX]: Fix action_invoice_create() method
bzr revid: atp@tinyerp.com-20120729160756-quwy0nhmlc4fmrsh
---
addons/sale_stock/sale_stock.py | 74 ++++++++-------------------------
1 file changed, 18 insertions(+), 56 deletions(-)
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 9f1ce3e590c..754657ae70a 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -244,62 +244,15 @@ class sale_order(osv.osv):
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
- res = False
- invoices = {}
- invoice_ids = []
+ res = super(sale_order,self).action_invoice_create( cr, uid, ids, grouped=grouped, states=states, date_inv = date_inv, context=context)
picking_obj = self.pool.get('stock.picking')
- invoice = self.pool.get('account.invoice')
- obj_sale_order_line = self.pool.get('sale.order.line')
- partner_currency = {}
if context is None:
context = {}
# If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
# last day of the last month as invoice date
- if date_inv:
- context['date_inv'] = date_inv
- for o in self.browse(cr, uid, ids, context=context):
- currency_id = o.pricelist_id.currency_id.id
- if (o.partner_id.id in partner_currency) and (partner_currency[o.partner_id.id] <> currency_id):
- raise osv.except_osv(
- _('Error !'),
- _('You cannot group sales having different currencies for the same partner.'))
-
- partner_currency[o.partner_id.id] = currency_id
- lines = []
- for line in o.order_line:
- if line.invoiced:
- continue
- elif (line.state in states):
- lines.append(line.id)
- created_lines = obj_sale_order_line.invoice_line_create(cr, uid, lines)
- if created_lines:
- invoices.setdefault(o.partner_id.id, []).append((o, created_lines))
- if not invoices:
- for o in self.browse(cr, uid, ids, context=context):
- for i in o.invoice_ids:
- if i.state == 'draft':
- return i.id
- for val in invoices.values():
- if grouped:
- res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x, y: x + y, [l for o, l in val], []), context=context)
- invoice_ref = ''
- for o, l in val:
- invoice_ref += o.name + '|'
- self.write(cr, uid, [o.id], {'state': 'progress'})
- if o.order_policy == 'picking':
- picking_obj.write(cr, uid, map(lambda x: x.id, o.picking_ids), {'invoice_state': 'invoiced'})
- cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (o.id, res))
- invoice.write(cr, uid, [res], {'origin': invoice_ref, 'name': invoice_ref})
- else:
- for order, il in val:
- res = self._make_invoice(cr, uid, order, il, context=context)
- invoice_ids.append(res)
- self.write(cr, uid, [order.id], {'state': 'progress'})
- if order.order_policy == 'picking':
- picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'})
- cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%s,%s)', (order.id, res))
- if res:
- self.invoice_send_note(cr, uid, ids, res, context)
+ for order in self.browse(cr, uid, ids, context=context):
+ if order.order_policy == 'picking':
+ picking_obj.write(cr, uid, map(lambda x: x.id, order.picking_ids), {'invoice_state': 'invoiced'})
return res
def action_cancel(self, cr, uid, ids, context=None):
@@ -613,15 +566,24 @@ class sale_order_line(osv.osv):
}
def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
+ res = super(sale_order_line, self)._prepare_order_line_invoice_line(cr, uid, line, account_id=account_id, context=context)
+
def _get_line_qty(line):
if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
- return self.pool.get('procurement.order').quantity_get(cr, uid, line.procurement_id.id, context=context)
+ return self.pool.get('procurement.order').quantity_get(cr, uid,
+ line.procurement_id.id, context=context)
def _get_line_uom(line):
- if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
- return self.pool.get('procurement.order').uom_get(cr, uid, line.procurement_id.id, context=context)
-
- return super(sale_order_line, self)._prepare_order_line_invoice_line(cr, uid, line, account_id=account_id, context=context)
+ if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
+ return self.pool.get('procurement.order').uom_get(cr, uid,
+ line.procurement_id.id, context=context)
+ uosqty = _get_line_qty(line)
+ uos_id = _get_line_uom(line)
+ if uosqty:
+ pu = round(line.price_unit * line.product_uom_qty / uosqty,
+ self.pool.get('decimal.precision').precision_get(cr, uid, 'Sale Price'))
+ res.update({'price_unit': pu, 'quantity': uosqty,'uos_id': uos_id})
+ return res
def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False,
partner_id=False, packaging=False, flag=False, context=None):
From 9b0e798446407a517c4647f027362d09d9a51bc9 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 1 Aug 2012 17:46:40 +0530
Subject: [PATCH 042/166] [ADD] payment wizard on bank statement line
bzr revid: rgaopenerp-20120801121640-r81nvodxv9kwjizz
---
addons/account_voucher/__openerp__.py | 2 +-
addons/account_voucher/account_voucher.py | 26 +++++++++++++++++++
.../account_voucher/account_voucher_view.xml | 1 +
.../voucher_payment_receipt_view.xml | 2 ++
4 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/addons/account_voucher/__openerp__.py b/addons/account_voucher/__openerp__.py
index 0b37bdbd4a2..c8f18281cf4 100644
--- a/addons/account_voucher/__openerp__.py
+++ b/addons/account_voucher/__openerp__.py
@@ -51,8 +51,8 @@ eInvoicing & Payments module manage all Voucher Entries such as "Reconciliation
"account_voucher_report.xml",
"wizard/account_voucher_unreconcile_view.xml",
"wizard/account_statement_from_invoice_view.xml",
- "account_voucher_view.xml",
"voucher_payment_receipt_view.xml",
+ "account_voucher_view.xml",
"voucher_sales_purchase_view.xml",
"account_voucher_wizard.xml",
"account_voucher_pay_invoice.xml",
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 2cefaf15f0e..14e25c1a453 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1495,7 +1495,33 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
+
+ def bank_st_payment(self, cr, uid, ids, context):
+ record = record_id = False
+ for rec in self.browse(cr, uid, ids, context=context):
+ record_id = rec.voucher_id and rec.voucher_id .id or False
+ record = rec
+ mod_obj = self.pool.get('ir.model.data')
+ if record and record.type == 'customer':
+ res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
+ else:
+ res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
+ view_id = res and res[1] or False
+ context.update({'partner_id':record.partner_id.id, 'amount':record.amount})
+
+ return {
+ 'name': _('Payment Entry'),
+ 'res_model': 'account.voucher',
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'target':'new',
+ 'view_id':view_id,
+ 'context': context,
+ 'res_id':record_id,
+ 'type': 'ir.actions.act_window'
+ }
+
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
return {}
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index d1912a58d1c..1cfa8488d7e 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -226,6 +226,7 @@
+
diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml
index 372d8aa1937..7eca832089a 100644
--- a/addons/account_voucher/voucher_payment_receipt_view.xml
+++ b/addons/account_voucher/voucher_payment_receipt_view.xml
@@ -72,6 +72,8 @@
+
+
Date: Mon, 6 Aug 2012 10:52:07 +0530
Subject: [PATCH 043/166] [IMP] record should be selected(checked) by default
bzr revid: rgaopenerp-20120806052207-4cpwu4zpi6p30wgd
---
addons/account/account_view.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index d7026217dc4..91ff57c2e71 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1928,7 +1928,7 @@
tree
-
+
From 65ae69521b267b529e486329406d7e0cb9828243 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 15:00:59 +0530
Subject: [PATCH 044/166] [IMP] code clean up
bzr revid: rgaopenerp-20120806093059-3xk320oduvb5ceo0
---
addons/account/account_move_line.py | 32 ++------------------
addons/account/account_move_line_extended.py | 14 +++++++++
2 files changed, 17 insertions(+), 29 deletions(-)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index d697444c446..5eb56bfa645 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -107,15 +107,7 @@ class account_move_line(osv.osv):
query += company_clause
return query
-
- def get_selection_ids(self, cr, uid, ids, context=None):
- records = self.read(cr, uid, ids, ['reconcile_id'])
- res = []
- for record in records:
- if not record.get('reconcile_id'):
- res.append(record['id'])
- return res
-
+
def _amount_residual(self, cr, uid, ids, field_names, args, context=None):
"""
This function returns the residual amount on a receivable or payable account.move.line.
@@ -526,7 +518,7 @@ class account_move_line(osv.osv):
type='many2one', relation='account.invoice', fnct_search=_invoice_search),
'account_tax_id':fields.many2one('account.tax', 'Tax'),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'),
- 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
+ 'company_id': fields.related('account_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
}
def _get_date(self, cr, uid, context=None):
@@ -717,26 +709,8 @@ class account_move_line(osv.osv):
if not partner:
return []
args.append(('partner_id', '=', partner[0]))
- ids = super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
- if context.get('extended_from'):
- return self.get_move_by_unique_partner(cr, uid, offset, context)
- return ids
+ return super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
- def get_move_by_unique_partner(self, cr, uid, offset=0, context=None):
- cr.execute(
- """
- SELECT l.id ,l.partner_id AS partner_id
- FROM account_move_line l
- LEFT JOIN account_account a ON (a.id = l.account_id)
-
- WHERE a.reconcile IS TRUE
- AND l.reconcile_id IS NULL
-
- AND l.state <> 'draft'
- GROUP BY l.id, l.partner_id OFFSET %s""", (offset, )
- )
- return dict(cr.fetchall()).keys()
-
def get_next_partner_only(self, cr, uid, offset=0, context=None):
cr.execute(
"""
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index 441cbda7ae1..8b2ede0b697 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -29,6 +29,20 @@ class res_partner(osv.osv):
}
res_partner()
+class account_move_line(osv.osv):
+ _inherit = "account.move.line"
+
+ def get_selection_ids(self, cr, uid, ids, context=None):
+ records = self.read(cr, uid, ids, ['reconcile_id'])
+ res = []
+ for record in records:
+ if not record.get('reconcile_id'):
+ res.append(record['id'])
+ return res
+
+account_move_line();
+
+
class account_move_partner_info(osv.osv):
_name = "account.move.partner.info"
_description = "All partner info related account move line"
From abe9798b4abcfb69f2b89c4e66598867c77717f5 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 16:14:20 +0530
Subject: [PATCH 045/166] [IMP] Change method name
bzr revid: rgaopenerp-20120806104420-vs7yh16adq2lafpq
---
addons/account/account_move_line_extended.py | 2 +-
addons/account/account_view.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index 8b2ede0b697..5c474d5ca52 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -32,7 +32,7 @@ res_partner()
class account_move_line(osv.osv):
_inherit = "account.move.line"
- def get_selection_ids(self, cr, uid, ids, context=None):
+ def get_unreconcile_entry(self, cr, uid, ids, context=None):
records = self.read(cr, uid, ids, ['reconcile_id'])
res = []
for record in records:
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index cad59f82783..c1a966db8cb 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -2049,7 +2049,7 @@
tree
-
+
From d3ff658fe2b3cca0572c5de9be25bcd08be50325 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 16:16:31 +0530
Subject: [PATCH 046/166] [REM] remove default selection from addons it should
be added in web
bzr revid: rgaopenerp-20120806104631-woy75igiysygblad
---
addons/account/static/src/js/account.js | 26 +------------------------
1 file changed, 1 insertion(+), 25 deletions(-)
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account.js
index 15ef397aa1a..5a6245e395d 100644
--- a/addons/account/static/src/js/account.js
+++ b/addons/account/static/src/js/account.js
@@ -208,29 +208,5 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
});
}
})
-instance.account.set_selection = instance.web.ListView.include({
- default_selection: function(){
- var self = this
- selection_method = this.fields_view.arch.attrs.default_selection;
- if(selection_method){
- this.dataset.call(selection_method, [this.dataset.ids], this.context).then(_.bind(self.set_selection, self));
- }
- },
-
- set_selection : function(ids){
- this.$element.find('th.oe_list_record_selector input')
- .closest('tr').each(function () {
- if(_.include(ids, $(this).data('id'))){
- $(this).find('th.oe_list_record_selector input').prop('checked', true)
- }
- }
- );
- },
- reload_content: function() {
- var reloaded =this._super()
- var self = this
- reloaded.done(_.bind(self.default_selection, self))
- },
-})
-
+
}
From 80dd5bdfbc76fbdc514dac584178c72ec8c103c5 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 16:51:23 +0530
Subject: [PATCH 047/166] [IMP] Added field to act windows
bzr revid: rgaopenerp-20120806112123-7eusxdvd6gweyqaf
---
addons/account/account_move_line_extended.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_line_extended.py
index 5c474d5ca52..9820f33ef15 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_line_extended.py
@@ -22,6 +22,13 @@
import tools
from osv import fields,osv
+class act_window(osv.osv):
+ _inherit = 'ir.actions.act_window'
+ _columns = {
+ 'extended_form_view_id': fields.many2one('ir.ui.view', 'Account form view ref.'),
+ }
+act_window()
+
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
From 08fd6917b5ae77de801f3d78e6c872423103cac5 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 17:02:48 +0530
Subject: [PATCH 048/166] [IMP] change file name
bzr revid: rgaopenerp-20120806113248-urvz0z1bqje57t0h
---
addons/account/__openerp__.py | 6 +++---
.../css/{account.css => account_move_reconciliation.css} | 0
.../src/js/{account.js => account_move_reconciliation.js} | 0
.../xml/{account.xml => account_move_reconciliation.xml} | 0
4 files changed, 3 insertions(+), 3 deletions(-)
rename addons/account/static/src/css/{account.css => account_move_reconciliation.css} (100%)
rename addons/account/static/src/js/{account.js => account_move_reconciliation.js} (100%)
rename addons/account/static/src/xml/{account.xml => account_move_reconciliation.xml} (100%)
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index c10823ef6fb..e136c75f9c4 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -129,12 +129,12 @@ financial year and for preparation of vouchers there is a module named account_v
"account_pre_install.yml"
],
'js': [
- 'static/src/js/account.js',
+ 'static/src/js/account_move_reconciliation.js',
],
'qweb' : [
- "static/src/xml/account.xml",
+ "static/src/xml/account_move_reconciliation.xml",
],
- 'css':['static/src/css/account.css'
+ 'css':['static/src/css/account_move_reconciliation.css'
],
'demo_xml': [
'demo/account_demo.xml',
diff --git a/addons/account/static/src/css/account.css b/addons/account/static/src/css/account_move_reconciliation.css
similarity index 100%
rename from addons/account/static/src/css/account.css
rename to addons/account/static/src/css/account_move_reconciliation.css
diff --git a/addons/account/static/src/js/account.js b/addons/account/static/src/js/account_move_reconciliation.js
similarity index 100%
rename from addons/account/static/src/js/account.js
rename to addons/account/static/src/js/account_move_reconciliation.js
diff --git a/addons/account/static/src/xml/account.xml b/addons/account/static/src/xml/account_move_reconciliation.xml
similarity index 100%
rename from addons/account/static/src/xml/account.xml
rename to addons/account/static/src/xml/account_move_reconciliation.xml
From 89328b74ab831cfac8bdeecd6e19660e3426fdf2 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 18:23:32 +0530
Subject: [PATCH 049/166] [IMP] change model name + clean up
bzr revid: rgaopenerp-20120806125332-y0bp5ojab6d72ksq
---
addons/account/__init__.py | 2 +-
addons/account/__openerp__.py | 2 +-
...nded.py => account_move_reconciliation.py} | 22 ++++++++--------
...ed.xml => account_move_reconciliation.xml} | 6 ++---
addons/account/account_view.xml | 8 +++---
.../src/js/account_move_reconciliation.js | 2 +-
addons/account_followup/__init__.py | 1 +
addons/account_followup/__openerp__.py | 1 +
addons/account_followup/account_followup.py | 25 -------------------
.../account_followup_view.xml | 13 ----------
10 files changed, 23 insertions(+), 59 deletions(-)
rename addons/account/{account_move_line_extended.py => account_move_reconciliation.py} (86%)
rename addons/account/{account_move_line_extended.xml => account_move_reconciliation.xml} (84%)
diff --git a/addons/account/__init__.py b/addons/account/__init__.py
index 3a2273379da..c5a3a154740 100644
--- a/addons/account/__init__.py
+++ b/addons/account/__init__.py
@@ -38,6 +38,6 @@ import company
import res_currency
import edi
import res_config
-import account_move_line_extended
+import account_move_reconciliation
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index e136c75f9c4..0542c9fa79e 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -66,7 +66,7 @@ financial year and for preparation of vouchers there is a module named account_v
'wizard/account_period_close_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_unreconcile_view.xml',
- 'account_move_line_extended.xml',
+ 'account_move_reconciliation.xml',
'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
diff --git a/addons/account/account_move_line_extended.py b/addons/account/account_move_reconciliation.py
similarity index 86%
rename from addons/account/account_move_line_extended.py
rename to addons/account/account_move_reconciliation.py
index 9820f33ef15..f30fe9cb040 100644
--- a/addons/account/account_move_line_extended.py
+++ b/addons/account/account_move_reconciliation.py
@@ -50,8 +50,8 @@ class account_move_line(osv.osv):
account_move_line();
-class account_move_partner_info(osv.osv):
- _name = "account.move.partner.info"
+class account_move_reconciliation(osv.osv):
+ _name = "account.move.reconciliation"
_description = "All partner info related account move line"
_auto = False
@@ -72,7 +72,7 @@ class account_move_partner_info(osv.osv):
return res_all
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- ids = super(account_move_partner_info, self).search(cr, uid, args, offset, limit, order, context, count)
+ ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count)
res = []
for l in self.browse(cr, uid, ids, context=context):
if (not l.partner_move_count) or (l.move_lines_count >l.partner_move_count):
@@ -93,17 +93,17 @@ class account_move_partner_info(osv.osv):
res_partner.write(cr, uid, [line.id] ,{'partner_move_count':line.move_lines_count})
def init(self, cr):
- tools.drop_view_if_exists(cr, 'account_move_partner_info')
+ tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
- create or replace view account_move_partner_info as (
+ CREATE or REPLACE VIEW account_move_reconciliation as (
SELECT p.id, p.id as partner_id,
- max(p.last_reconciliation_date) as last_reconciliation_date,
- max(l.date) as latest_date,
- count(l.id) as move_lines_count,
- max(p.partner_move_count) as partner_move_count
+ MAX(p.last_reconciliation_date) as last_reconciliation_date,
+ MAX(l.date) as latest_date,
+ COUNT(l.id) as move_lines_count,
+ MAX(p.partner_move_count) as partner_move_count
FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
- group by p.id
+ GROUP by p.id
)
""")
-account_move_partner_info()
+account_move_reconciliation()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/account_move_line_extended.xml b/addons/account/account_move_reconciliation.xml
similarity index 84%
rename from addons/account/account_move_line_extended.xml
rename to addons/account/account_move_reconciliation.xml
index 8fcf518fc4c..162ddb6ce32 100644
--- a/addons/account/account_move_line_extended.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -1,9 +1,9 @@
-
- account.move.partner.info.form
- account.move.partner.info
+
+ account.move.reconciliation.form
+ account.move.reconciliation
form
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index c1a966db8cb..2356dbf2ac5 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1087,7 +1087,7 @@
tree
-
+
@@ -1589,7 +1589,7 @@
tree,form
-
+
{'view_mode':True}
@@ -1599,7 +1599,7 @@
form
tree,form
-
+
[('partner_id.customer','=',True)]
{'view_mode':True}
@@ -1610,7 +1610,7 @@
form
tree,form
-
+
[('partner_id.supplier','=',True)]
{'view_mode':True}
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 5a6245e395d..646f187914b 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -55,7 +55,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
init: function(parent, action) {
this._super.apply(this, arguments);
//Fix me: pass hard coded model name, find the way to fetch it from server
- this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.partner.info', action.context, action.domain);
+ this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.reconciliation', action.context, action.domain);
},
start : function(){
this._super()
diff --git a/addons/account_followup/__init__.py b/addons/account_followup/__init__.py
index 4bfe3186298..395ce5475c8 100644
--- a/addons/account_followup/__init__.py
+++ b/addons/account_followup/__init__.py
@@ -22,5 +22,6 @@
import account_followup
import wizard
import report
+import account_move_reconciliation
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account_followup/__openerp__.py b/addons/account_followup/__openerp__.py
index e8724b01b4e..cfc8c39908f 100644
--- a/addons/account_followup/__openerp__.py
+++ b/addons/account_followup/__openerp__.py
@@ -58,6 +58,7 @@ entry, you can do from in the menu:
'report/account_followup_report.xml',
'account_followup_demo.xml', # Defined by default
'account_followup_view.xml',
+ 'account_move_reconciliation.xml',
'account_followup_data.xml',
],
'demo_xml': [],
diff --git a/addons/account_followup/account_followup.py b/addons/account_followup/account_followup.py
index 4497a254c50..ad419736c57 100644
--- a/addons/account_followup/account_followup.py
+++ b/addons/account_followup/account_followup.py
@@ -76,31 +76,6 @@ class account_move_line(osv.osv):
account_move_line()
-class account_move_partner_info(osv.osv):
- _inherit = 'account.move.partner.info'
- _columns = {
- 'followup_date': fields.date('Latest Follow-up'),
- 'max_followup_id':fields.many2one('account_followup.followup.line',
- 'Max Follow Up Level' )
- }
-
- def init(self, cr):
- tools.drop_view_if_exists(cr, 'account_move_partner_info')
- cr.execute("""
- create or replace view account_move_partner_info as (
- SELECT p.id, p.id as partner_id,
- max(p.last_reconciliation_date) as last_reconciliation_date,
- max(l.date) as latest_date,
- count(l.id) as move_lines_count,
- max(p.partner_move_count) as partner_move_count,
- max(l.followup_date) as followup_date,
- max(l.followup_line_id) as max_followup_id
- FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
- group by p.id
- )
- """)
-account_move_partner_info()
-
class res_company(osv.osv):
_inherit = "res.company"
_columns = {
diff --git a/addons/account_followup/account_followup_view.xml b/addons/account_followup/account_followup_view.xml
index 315f1ea5c0a..3d1d4333bbb 100644
--- a/addons/account_followup/account_followup_view.xml
+++ b/addons/account_followup/account_followup_view.xml
@@ -132,19 +132,6 @@
-
-
- account.move.partner.info.followup
- account.move.partner.info
-
-
-
-
-
-
-
-
-
account.move.line.tree.followup
From 7da51cd8bb3787f9a14da7a577d4c62992010a36 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 18:27:45 +0530
Subject: [PATCH 050/166] [ADD] inherit view of account reconciliation
bzr revid: rgaopenerp-20120806125745-w0s1k2lw6x7587sq
---
.../account_move_reconciliation.py | 27 +++++++++++++++++++
.../account_move_reconciliation.xml | 17 ++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 addons/account_followup/account_move_reconciliation.py
create mode 100644 addons/account_followup/account_move_reconciliation.xml
diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py
new file mode 100644
index 00000000000..b185b9a7347
--- /dev/null
+++ b/addons/account_followup/account_move_reconciliation.py
@@ -0,0 +1,27 @@
+from osv import fields, osv
+import tools
+
+class account_move_reconciliation(osv.osv):
+ _inherit = 'account.move.reconciliation'
+ _columns = {
+ 'followup_date': fields.date('Latest Follow-up'),
+ 'max_followup_id':fields.many2one('account_followup.followup.line',
+ 'Max Follow Up Level' )
+ }
+
+ def init(self, cr):
+ tools.drop_view_if_exists(cr, 'account_move_reconciliation')
+ cr.execute("""
+ CREATE or REPLACE VIEW account_move_reconciliation as (
+ SELECT p.id, p.id as partner_id,
+ MAX(p.last_reconciliation_date) as last_reconciliation_date,
+ MAX(l.date) as latest_date,
+ COUNT(l.id) as move_lines_count,
+ MAX(p.partner_move_count) as partner_move_count,
+ MAX(l.followup_date) as followup_date,
+ MAX(l.followup_line_id) as max_followup_id
+ FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
+ GROUP by p.id
+ )
+ """)
+account_move_reconciliation()
\ No newline at end of file
diff --git a/addons/account_followup/account_move_reconciliation.xml b/addons/account_followup/account_move_reconciliation.xml
new file mode 100644
index 00000000000..9759acc0c47
--- /dev/null
+++ b/addons/account_followup/account_move_reconciliation.xml
@@ -0,0 +1,17 @@
+
+
+
+
+ account.move.reconciliation.followup
+ account.move.reconciliation
+
+
+
+
+
+
+
+
+
+
+
From ce3973795d4054bd9ca6860ec4fab36bd0ee13cf Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 6 Aug 2012 18:50:34 +0530
Subject: [PATCH 051/166] Clean up remove unused code
bzr revid: rgaopenerp-20120806132034-sgt4vd0omm8ito1o
---
.../src/js/account_move_reconciliation.js | 39 +++++--------------
1 file changed, 9 insertions(+), 30 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 646f187914b..6f0e105366b 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -155,27 +155,6 @@ instance.account.btn_extend = instance.web.form.WidgetButton.extend({
viewmanager = this.view.getParent().getParent()
viewmanager.inner_widget.list_view.controller.reload_content();
},
- on_confirmed: function() {
- var self = this;
-
- var context = this.node.attrs.context;
- if (context && context.__ref) {
- context = new instance.web.CompoundContext(context);
- context.set_eval_context(this._build_eval_context());
- }
-
- return this.view.do_execute_action(
- _.extend({}, this.node.attrs, {context: context}),
- this.view.dataset, this.view.datarecord.id, function () {
- $.when(self.view.dataset.read_slice()).then(function() {
- if (!_.isEmpty(self.view.dataset.ids)){
- self.view.reload();
- //reload list view
- self.view.on_pager_action()
- }
- })
- });
- },
})
instance.account.list_button = instance.web.form.WidgetButton.extend({
@@ -195,15 +174,15 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
self.rpc("/web/action/load", {
action_id: py.eval(this.node.attrs.name),
context: additional_context
- }, function(result) {
- result.result.context = _.extend(result.result.context || {},
- additional_context);
- result.result.flags = result.result.flags || {};
- result.result.flags.new_window = true;
- self.do_action(result.result, function () {
- // reload view
- list_view.reload();
- self.getParent().reload()
+ }, function(result) {
+ result.result.context = _.extend(result.result.context || {},
+ additional_context);
+ result.result.flags = result.result.flags || {};
+ result.result.flags.new_window = true;
+ self.do_action(result.result, function () {
+ // reload view
+ list_view.reload();
+ self.getParent().reload()
});
});
}
From 0caaa1687b57e4419da9ae59d47160a4a2d11f37 Mon Sep 17 00:00:00 2001
From: Ferdinand <>
Date: Tue, 7 Aug 2012 11:40:11 +0530
Subject: [PATCH 052/166] [FIX] stock : Fix the usebility improvement on check
location constraint
lp bug: https://launchpad.net/bugs/1033687 fixed
bzr revid: amp@tinyerp.com-20120807061011-txpon5iw3y73rsa3
---
addons/stock/stock.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index fd45274352b..6cb865ce14b 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -1656,7 +1656,10 @@ class stock_move(osv.osv):
}
def _check_location(self, cr, uid, ids, context=None):
for record in self.browse(cr, uid, ids, context=context):
- if (record.state=='done') and (record.location_dest_id.usage == 'view' or record.location_id.usage == 'view'):
+ if (record.state=='done') and (record.location_id.usage == 'view'):
+ raise osv.except_osv(_('Error'), _('You can not move product %s from location of type view %s ')% (record.product_id.name, record.location_id.name))
+ if (record.state=='done') and (record.location_dest_id.usage == 'view' ):
+ raise osv.except_osv(_('Error'), _('You can not move product %s to location of type view %s ')% (record.product_id.name, record.location_dest_id.name))
return False
return True
From 7cf4fb877960ce5c3316daa14aeb220f7abc3fc0 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 7 Aug 2012 14:14:10 +0530
Subject: [PATCH 053/166] [IMP] remove addition field from act_window, pass it
through context of action
bzr revid: rgaopenerp-20120807084410-1w2jycfedlgg80f0
---
addons/account/__openerp__.py | 2 +-
addons/account/account_move_reconciliation.py | 7 ---
addons/account/account_view.xml | 5 +-
.../src/js/account_move_reconciliation.js | 63 +++----------------
4 files changed, 11 insertions(+), 66 deletions(-)
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 0542c9fa79e..950ee2da895 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -66,8 +66,8 @@ financial year and for preparation of vouchers there is a module named account_v
'wizard/account_period_close_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_unreconcile_view.xml',
- 'account_move_reconciliation.xml',
'account_view.xml',
+ 'account_move_reconciliation.xml',
'account_report.xml',
'account_financial_report_data.xml',
'wizard/account_report_common_view.xml',
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index f30fe9cb040..8dee6e98b22 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -22,13 +22,6 @@
import tools
from osv import fields,osv
-class act_window(osv.osv):
- _inherit = 'ir.actions.act_window'
- _columns = {
- 'extended_form_view_id': fields.many2one('ir.ui.view', 'Account form view ref.'),
- }
-act_window()
-
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 2356dbf2ac5..3e1f2ac01cd 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1601,7 +1601,7 @@
[('partner_id.customer','=',True)]
- {'view_mode':True}
+
@@ -1610,9 +1610,8 @@
form
tree,form
-
[('partner_id.supplier','=',True)]
- {'view_mode':True}
+
if any
- this.dialog = new instance.web.Dialog(this, {
- buttons: { "Close": function() { $(this).dialog("close"); }},
- dialogClass: 'oe_act_window'
- });
- if(on_close)
- this.dialog.on_close.add(on_close);
- } else {
- this.dialog_widget.destroy();
- }
- this.dialog.dialog_title = action.name;
- this.dialog_widget = new instance.web.ViewManagerAction(this, action);
- this.dialog_widget.appendTo(this.dialog.$element);
- this.dialog.open();
- } else {
- this.dialog_stop();
- if(action.menu_id) {
- return this.getParent().do_action(action, function () {
- instance.webclient.menu.open_menu(action.menu_id);
- });
- }
- this.inner_action = action;
- if (action.extended_form_view_id){
- var inner_widget = this.inner_widget = new instance.account.extend_viewmanager(this, action);
- }else{
- var inner_widget = this.inner_widget = new instance.web.ViewManagerAction(this, action);
- }
- inner_widget.add_breadcrumb();
- this.inner_widget.appendTo(this.$element);
- }
- }
- })
-
-
-instance.account.extend_viewmanager = instance.web.ViewManagerAction.extend({
- init: function(parent, action) {
- this._super.apply(this, arguments);
- //Fix me: pass hard coded model name, find the way to fetch it from server
- this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.reconciliation', action.context, action.domain);
- },
+
+instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
start : function(){
this._super()
- this.setup_exended_form_view(this)
+ if(this.action.context && this.action.context.extended_form_view_id)
+ this.setup_exended_form_view(this)
},
on_mode_switch: function (view_type, no_store, options) {
self = this
self.list_loaded = $.when(this._super.apply(this, arguments)).then(function () {
- self.list_view = self.views['list']
+ if(self.action.context && self.action.context.extended_form_view_id)
+ self.list_view = self.views['list']
})
},
setup_exended_form_view: function(parent){
var self = this,
from_view,
obj_from_view;
- view_id = this.action.extended_form_view_id[0]
+ view_id = this.action.context.extended_form_view_id
from_view = this.registry.get_object('form_clone');
+ this.dataset_form = new instance.web.DataSetSearch(this, 'account.move.reconciliation', this.action.context, this.action.domain);
this.dataset_loaded = this.dataset_form.read_slice()
obj_from_view = new from_view(self, this.dataset_form, view_id, options={});
obj_from_view.template = 'ExtendedFormView'
From 1d0beb57791b339e6e8302e27036b7c574eb60c7 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 7 Aug 2012 15:51:23 +0530
Subject: [PATCH 054/166] [IMP] improve view reduce css depencency
bzr revid: rgaopenerp-20120807102123-c9fq33cz7r2pjked
---
.../account/account_move_reconciliation.xml | 37 ++++++++++------
.../src/js/account_move_reconciliation.js | 25 +----------
.../src/xml/account_move_reconciliation.xml | 43 +------------------
.../account_move_reconciliation.xml | 4 +-
4 files changed, 30 insertions(+), 79 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 162ddb6ce32..bc0f1145594 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -8,20 +8,33 @@
+
-
-
-
-
-
-
-
-
-
+
diff --git a/addons/account_followup/account_move_reconciliation.xml b/addons/account_followup/account_move_reconciliation.xml
index 9759acc0c47..f27bf9207eb 100644
--- a/addons/account_followup/account_move_reconciliation.xml
+++ b/addons/account_followup/account_move_reconciliation.xml
@@ -6,11 +6,11 @@
account.move.reconciliation
-
+
-
+
From a567a1fc5cd67823928dbb5273ac1c74cc9dcbed Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 7 Aug 2012 17:04:19 +0530
Subject: [PATCH 055/166] [FIX/IMP] fix indetantion and add css for pager
button
bzr revid: rgaopenerp-20120807113419-v11tltq2k1kcw66o
---
.../account/account_move_reconciliation.xml | 46 ++++++++-----------
addons/account/account_view.xml | 2 -
.../src/css/account_move_reconciliation.css | 17 +++++++
.../src/js/account_move_reconciliation.js | 1 -
4 files changed, 37 insertions(+), 29 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index bc0f1145594..96054d0548d 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -9,32 +9,26 @@
-
-
-
-
- ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ ()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 3e1f2ac01cd..b6880dab90d 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1589,7 +1589,6 @@
tree,form
-
{'view_mode':True}
@@ -1599,7 +1598,6 @@
form
tree,form
-
[('partner_id.customer','=',True)]
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css
index a60d7c24788..2757227ac2d 100644
--- a/addons/account/static/src/css/account_move_reconciliation.css
+++ b/addons/account/static/src/css/account_move_reconciliation.css
@@ -11,6 +11,23 @@
margin: 2px;
}
+.openerp .oe_pager_button{
+ float: left;
+ height: 22px;
+ line-height: 24px;
+ display: inline-block;
+ border: 1px solid #ababab;
+ color: #4c4c4c;
+ cursor: pointer;
+ -moz-border-radius: 5px;
+ -webkit-border-radius: 5px;
+ border-radius: 5px;
+ padding: 0 5px 0 5px;
+ margin: 0 2px 0 2px;
+ float: left;
+ border-right: 1px solid #ababab;
+}
+
.openerp .oe_pager_m2o li {
display: inline-block;
height: 24px;
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index f6204c2e0d2..53d1b27f820 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -4,7 +4,6 @@ var _t = instance.web._t,
instance.web.views.add('form_clone', 'instance.account.extend_form_view');
instance.web.form.tags.add('list_button','instance.account.list_button')
instance.web.form.tags.add('btn_extend','instance.account.btn_extend')
-instance.web.form.widgets.add('many2one_pager','instance.account.many2one_pager')
instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
start : function(){
From 512f5a1bc5aa945877772352675f33a56b8e6ce4 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 7 Aug 2012 19:04:27 +0530
Subject: [PATCH 056/166] [REM] remove button widget
bzr revid: rgaopenerp-20120807133427-kskuv8gtf72fdlwe
---
.../account/account_move_reconciliation.xml | 4 +-
.../src/js/account_move_reconciliation.js | 78 ++++++-------------
.../account/wizard/account_reconcile_view.xml | 6 +-
3 files changed, 30 insertions(+), 58 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 96054d0548d..d98f929d05b 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -22,8 +22,8 @@
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 53d1b27f820..8e21bb6e84d 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -2,8 +2,6 @@ openerp.account = function(instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
instance.web.views.add('form_clone', 'instance.account.extend_form_view');
-instance.web.form.tags.add('list_button','instance.account.list_button')
-instance.web.form.tags.add('btn_extend','instance.account.btn_extend')
instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
start : function(){
@@ -11,13 +9,6 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
if(this.action.context && this.action.context.extended_form_view_id)
this.setup_exended_form_view(this)
},
- on_mode_switch: function (view_type, no_store, options) {
- self = this
- self.list_loaded = $.when(this._super.apply(this, arguments)).then(function () {
- if(self.action.context && self.action.context.extended_form_view_id)
- self.list_view = self.views['list']
- })
- },
setup_exended_form_view: function(parent){
var self = this,
from_view,
@@ -45,51 +36,15 @@ instance.account.extend_form_view = instance.web.FormView.extend({
on_loaded: function(data) {
this._super.apply(this,arguments);
var self = this
+ this.$element.find(".oe_reconcile").on('click', this.do_reconcilation)
this.$element.on('click','a[data-pager-action]',function() {
var action = $(this).data('pager-action');
self.on_pager_action(action);
});
},
- do_update_pager: function(hide_index) {
- var index = hide_index ? '-' : this.dataset.index + 1;
- this.$element.find('span.oe_pager_index_extend').html(index).end()
- .find('span.oe_pager_count_extend').html(this.dataset.ids.length);
- },
- on_pager_action: function(action) {
+ do_reconcilation:function(event){
var self = this
- var viewmanager = self.getParent();
- viewmanager.action.domain = this.original_domain
- $.when(this._super(action)).then(function() {
- var id = self.get_fields_values().partner_id;
- // apply domain on list
- viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
- viewmanager.searchview.do_search()
- })
- },
- })
-
-instance.account.btn_extend = instance.web.form.WidgetButton.extend({
- on_click: function() {
- var self = this;
- this.force_disabled = true;
- this.check_disable();
- this.execute_action().always(function() {
- self.force_disabled = false;
- self.check_disable();
- self.reload_view();
- });
-
- },
- reload_view :function(){
- viewmanager = this.view.getParent().getParent()
- viewmanager.inner_widget.list_view.controller.reload_content();
- },
-})
-
-instance.account.list_button = instance.web.form.WidgetButton.extend({
- on_click: function() {
- var self = this
- var list_view = this.view.getParent().list_view.controller
+ var list_view = this.getParent().views['list'].controller
ids = list_view.get_selected_ids()
if (ids.length == 0) {
instance.web.dialog($("
").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
@@ -101,7 +56,7 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
active_model: list_view.dataset.model
});
self.rpc("/web/action/load", {
- action_id: py.eval(this.node.attrs.name),
+ action_id: py.eval(event.target.name),
context: additional_context
}, function(result) {
result.result.context = _.extend(result.result.context || {},
@@ -111,10 +66,27 @@ instance.account.list_button = instance.web.form.WidgetButton.extend({
self.do_action(result.result, function () {
// reload view
list_view.reload();
- self.getParent().reload()
});
});
- }
-})
-
+
+ },
+ do_update_pager: function(hide_index) {
+ var index = hide_index ? '-' : this.dataset.index + 1;
+ this.$element.find('span.oe_pager_index_extend').html(index).end()
+ .find('span.oe_pager_count_extend').html(this.dataset.ids.length);
+ },
+
+ on_pager_action: function(action) {
+ var self = this
+ var viewmanager = self.getParent();
+ viewmanager.action.domain = this.original_domain
+ $.when(this._super(action)).then(function() {
+ var id = self.get_fields_values().partner_id;
+ // apply domain on list
+ viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
+ viewmanager.searchview.do_search();
+ })
+ },
+ })
+
}
diff --git a/addons/account/wizard/account_reconcile_view.xml b/addons/account/wizard/account_reconcile_view.xml
index 426eeeb4514..1b36394a7e0 100644
--- a/addons/account/wizard/account_reconcile_view.xml
+++ b/addons/account/wizard/account_reconcile_view.xml
@@ -14,9 +14,9 @@
From 085e20a23d85f749a765767ff53531c72a4c2842 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 8 Aug 2012 11:04:42 +0530
Subject: [PATCH 057/166] [REM/IMP] remove button from form view and improve
css
bzr revid: rgaopenerp-20120808053442-ljzf2wy1lmxsdslt
---
.../account/account_move_reconciliation.xml | 4 +-
.../src/css/account_move_reconciliation.css | 51 ++++++++++---------
.../src/js/account_move_reconciliation.js | 12 ++++-
3 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index d98f929d05b..62ae504ab89 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -22,8 +22,8 @@
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css
index 2757227ac2d..c087cde296e 100644
--- a/addons/account/static/src/css/account_move_reconciliation.css
+++ b/addons/account/static/src/css/account_move_reconciliation.css
@@ -25,45 +25,46 @@
padding: 0 5px 0 5px;
margin: 0 2px 0 2px;
float: left;
- border-right: 1px solid #ababab;
+}
+
+.openerp .oe_reconcile_button {
+ float: left;
+ display: inline-block;
+ background-color: #EFEFEF;
+ background-image: -moz-linear-gradient(center top , #EFEFEF, #D8D8D8);
+ border: 1px solid #ABABAB;
+ border-radius: 3px 3px 3px 3px;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
+ color: #404040;
+ display: inline-block;
+ font-size: 13px;
+ margin: 0 3px 0 3px;
+ padding: 3px 12px;
+ text-align: center;
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}
-.openerp .oe_pager_m2o li {
- display: inline-block;
- height: 24px;
- line-height: 24px;
- padding: 0;
- float: left;
+.openerp .oe_reconcile_button:hover {
+ background-color: #E3E3E3;
+ background-image: -moz-linear-gradient(center top , #E3E3E3, #F6F6F6);
+ box-shadow: none;
}
-.openerp .oe_pager_m2o a {
- padding: 0 8px;
+.openerp .oe_reconcile_button a:hover {
+ text-decoration: none
}
-
.openerp .oe_extended_form_view .oe_form_field:empty {
display: inline-block !important;
}
.openerp .oe_extended_form_view .oe_datepicker_root {
- display: inline-block;
- min-width: 100px;
+ display: inline-block;
+ min-width: 100px;
}
.openerp .oe_extended_form_view .oe_form_field {
- width: auto;
-}
-.openerp .oe_extended_form_view button {
- margin-right: 10px
-}
-
-.openerp .oe_extended_form_view .oe_button_container .oe_form_field{
width: auto;
- margin: 0px 10px 0px 10px;
}
-.openerp .oe_extended_form_view .oe_button_container{
- display: inline-block ;
- width:100%;
- margin: 10px;
-}
+
.openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar {
width: 200px !important;
}
\ No newline at end of file
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 8e21bb6e84d..b8435da7c9b 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -37,6 +37,7 @@ instance.account.extend_form_view = instance.web.FormView.extend({
this._super.apply(this,arguments);
var self = this
this.$element.find(".oe_reconcile").on('click', this.do_reconcilation)
+ this.$element.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile)
this.$element.on('click','a[data-pager-action]',function() {
var action = $(this).data('pager-action');
self.on_pager_action(action);
@@ -68,8 +69,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({
list_view.reload();
});
});
-
},
+
+ do_nothing_to_reconcile:function(event){
+ self = this
+ this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
+ self.dataset.read_slice().done(function(){
+ self.on_pager_action();
+ });
+ })
+ },
+
do_update_pager: function(hide_index) {
var index = hide_index ? '-' : this.dataset.index + 1;
this.$element.find('span.oe_pager_index_extend').html(index).end()
From 7b26f82778944a5955129fefe80bd675c57cff5a Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 8 Aug 2012 11:36:47 +0530
Subject: [PATCH 058/166] [IMP] imporve view (CSS)
bzr revid: rgaopenerp-20120808060647-9pgjic3obic4wwrg
---
.../static/src/css/account_move_reconciliation.css | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css
index c087cde296e..59861a66b68 100644
--- a/addons/account/static/src/css/account_move_reconciliation.css
+++ b/addons/account/static/src/css/account_move_reconciliation.css
@@ -11,7 +11,7 @@
margin: 2px;
}
-.openerp .oe_pager_button{
+.openerp .oe_pager_button {
float: left;
height: 22px;
line-height: 24px;
@@ -26,6 +26,9 @@
margin: 0 2px 0 2px;
float: left;
}
+.openerp .oe_pager_button:hover{
+ text-decoration:none !important;
+}
.openerp .oe_reconcile_button {
float: left;
@@ -35,16 +38,18 @@
border: 1px solid #ABABAB;
border-radius: 3px 3px 3px 3px;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 1px 1px rgba(255, 255, 255, 0.8) inset;
- color: #404040;
+ color: #4C4C4C !important;
display: inline-block;
font-size: 13px;
margin: 0 3px 0 3px;
padding: 3px 12px;
+ cursor: pointer;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5);
}
.openerp .oe_reconcile_button:hover {
+ text-decoration:none !important;
background-color: #E3E3E3;
background-image: -moz-linear-gradient(center top , #E3E3E3, #F6F6F6);
box-shadow: none;
From fbddeaa021aa4d43f9b0248d73cc8722bda22e9c Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 8 Aug 2012 19:27:47 +0530
Subject: [PATCH 059/166] [IMP] impromve sql view for model, remove method for
nothing to reconcile button
bzr revid: rgaopenerp-20120808135747-vdi2wztvi9qprsus
---
addons/account/__openerp__.py | 2 +-
addons/account/account_move_reconciliation.py | 57 +++++++------------
addons/account/account_view.xml | 14 +----
.../src/js/account_move_reconciliation.js | 11 ++--
4 files changed, 27 insertions(+), 57 deletions(-)
diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index 950ee2da895..0542c9fa79e 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -66,8 +66,8 @@ financial year and for preparation of vouchers there is a module named account_v
'wizard/account_period_close_view.xml',
'wizard/account_reconcile_view.xml',
'wizard/account_unreconcile_view.xml',
- 'account_view.xml',
'account_move_reconciliation.xml',
+ 'account_view.xml',
'account_report.xml',
'account_financial_report_data.xml',
'wizard/account_report_common_view.xml',
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 8dee6e98b22..f885214ec65 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -22,12 +22,9 @@
import tools
from osv import fields,osv
-class res_partner(osv.osv):
- _inherit = 'res.partner'
- _columns = {
- 'partner_move_count': fields.integer('Partner move line count')
- }
-res_partner()
+#1. Remove field from res.partner
+
+#4 remove get_unreconcile_entry method mange it with domain
class account_move_line(osv.osv):
_inherit = "account.move.line"
@@ -49,53 +46,37 @@ class account_move_reconciliation(osv.osv):
_auto = False
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
+ active_ids = context.get('active_ids', [])
res = 0
- cr.execute("""SELECT partner_id, reconcile_id
- FROM account_move_line WHERE state <> 'draft'
- GROUP BY partner_id, reconcile_id""")
- result = cr.fetchall()
- partner_total = len(result)
- partner_reconcile = len([ (x,y) for x, y in result if y == None ])
- if partner_total:
- res = float(partner_total- partner_reconcile)/partner_total * 100
-
+ if active_ids:
+ total_records = self.search(cr, uid, [('id','in',active_ids)])
+ total_reconcile = 0
+ for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context):
+ if record['reconcile_count'] > 0:
+ total_reconcile += 1
+ res = float(total_reconcile)/len(total_records) * 100
res_all = {}
for id in ids:
res_all[id] = res
return res_all
- def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count)
- res = []
- for l in self.browse(cr, uid, ids, context=context):
- if (not l.partner_move_count) or (l.move_lines_count >l.partner_move_count):
- res.append(l.id)
- return res
-
+
_columns = {
'partner_id':fields.many2one('res.partner', 'Partner'),
- 'last_reconciliation_date':fields.datetime('Last Reconciliation'),
+ 'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
- 'move_lines_count':fields.integer('Move Count'),
- 'partner_move_count':fields.integer('Partner move line count'),
+ 'reconcile_count':fields.integer('Reconcile Count'),
}
- def skip_partner(self, cr, uid, ids, context):
- res_partner = self.pool.get('res.partner')
- for line in self.browse(cr, uid, ids, context=context):
- res_partner.write(cr, uid, [line.id] ,{'partner_move_count':line.move_lines_count})
-
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT p.id, p.id as partner_id,
- MAX(p.last_reconciliation_date) as last_reconciliation_date,
- MAX(l.date) as latest_date,
- COUNT(l.id) as move_lines_count,
- MAX(p.partner_move_count) as partner_move_count
- FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
- GROUP by p.id
+ SELECT move_line.partner_id as id, move_line.partner_id,
+ MAX(move_line.date) as latest_date,
+ (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count
+ FROM account_move_line as move_line where move_line.state <> 'draft'
+ GROUP by move_line.partner_id
)
""")
account_move_reconciliation()
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index b6880dab90d..8f4089e5e2c 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1582,16 +1582,6 @@
-
- Entries To Reconcile
- account.move.line
- form
- tree,form
-
-
- {'view_mode':True}
-
-
Entries To Reconcile
account.move.line
@@ -1599,7 +1589,7 @@
tree,form
[('partner_id.customer','=',True)]
-
+
@@ -1609,7 +1599,7 @@
tree,form
[('partner_id.supplier','=',True)]
-
+
Date: Thu, 9 Aug 2012 12:20:42 +0530
Subject: [PATCH 060/166] [IMP] progress bar and reload formon destroy of
reconcile wizard
bzr revid: rgaopenerp-20120809065042-bl8tyauxovr07r2v
---
addons/account/account_move_reconciliation.py | 16 +++++++---------
.../static/src/js/account_move_reconciliation.js | 10 ++++++----
2 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index f885214ec65..eaf9d31f976 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -22,8 +22,6 @@
import tools
from osv import fields,osv
-#1. Remove field from res.partner
-
#4 remove get_unreconcile_entry method mange it with domain
class account_move_line(osv.osv):
@@ -50,11 +48,11 @@ class account_move_reconciliation(osv.osv):
res = 0
if active_ids:
total_records = self.search(cr, uid, [('id','in',active_ids)])
- total_reconcile = 0
- for record in self.read(cr, uid, total_records, ['reconcile_count'], context=context):
- if record['reconcile_count'] > 0:
- total_reconcile += 1
- res = float(total_reconcile)/len(total_records) * 100
+ total_unreconcile = 0
+ for record in self.read(cr, uid, total_records, ['unreconcile_count'], context=context):
+ if record['unreconcile_count'] > 0:
+ total_unreconcile += 1
+ res = float(len(total_records) - total_unreconcile)/len(total_records) * 100
res_all = {}
for id in ids:
res_all[id] = res
@@ -66,7 +64,7 @@ class account_move_reconciliation(osv.osv):
'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
- 'reconcile_count':fields.integer('Reconcile Count'),
+ 'unreconcile_count':fields.integer('Unreconcile Count'),
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
@@ -74,7 +72,7 @@ class account_move_reconciliation(osv.osv):
CREATE or REPLACE VIEW account_move_reconciliation as (
SELECT move_line.partner_id as id, move_line.partner_id,
MAX(move_line.date) as latest_date,
- (select count(reconcile.id) from account_move_line as reconcile where reconcile.reconcile_id is not null and reconcile.partner_id = move_line.partner_id) as reconcile_count
+ (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count
FROM account_move_line as move_line where move_line.state <> 'draft'
GROUP by move_line.partner_id
)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 03a41fef8a3..765a48af13b 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -68,15 +68,17 @@ instance.account.extend_form_view = instance.web.FormView.extend({
self.do_action(result.result, function () {
// reload view
list_view.reload();
+ self.reload();
});
});
},
- do_nothing_to_reconcile:function(event){
- viewmanager = this.getParent();
+ do_nothing_to_reconcile:function(){
this.dataset.ids = _.without(this.dataset.ids, this.datarecord.id)
- viewmanager.action.context.active_ids = viewmanager.dataset_form.ids;
- this.on_pager_action();
+ // viewmanager = this.getParent();
+ // viewmanager.action.context.active_ids = viewmanager.dataset_form.ids;
+ if (!_.isEmpty(this.dataset.ids))
+ this.on_pager_action('first');
},
do_update_pager: function(hide_index) {
From bd79baf8b39073b73ac5b4f50a8ddb382313bb5d Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Thu, 9 Aug 2012 14:47:47 +0530
Subject: [PATCH 061/166] [fix] inheretied view of account followup
bzr revid: rgaopenerp-20120809091747-46o45ssfkmoh9shf
---
.../account_move_reconciliation.py | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py
index b185b9a7347..6370a4bbdca 100644
--- a/addons/account_followup/account_move_reconciliation.py
+++ b/addons/account_followup/account_move_reconciliation.py
@@ -12,16 +12,14 @@ class account_move_reconciliation(osv.osv):
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
- CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT p.id, p.id as partner_id,
- MAX(p.last_reconciliation_date) as last_reconciliation_date,
- MAX(l.date) as latest_date,
- COUNT(l.id) as move_lines_count,
- MAX(p.partner_move_count) as partner_move_count,
- MAX(l.followup_date) as followup_date,
- MAX(l.followup_line_id) as max_followup_id
- FROM account_move_line as l INNER JOIN res_partner AS p ON (l.partner_id = p.id)
- GROUP by p.id
+ CREATE or REPLACE VIEW account_move_reconciliation as (
+ SELECT move_line.partner_id as id, move_line.partner_id,
+ MAX(move_line.date) as latest_date,
+ MAX(move_line.followup_date) as followup_date,
+ MAX(move_line.followup_line_id) as max_followup_id,
+ (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count
+ FROM account_move_line as move_line where move_line.state <> 'draft'
+ GROUP by move_line.partner_id
)
""")
account_move_reconciliation()
\ No newline at end of file
From 9825ad01c68c49ea1c6b4b28b557365aee7fcbbf Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Thu, 9 Aug 2012 23:52:14 +0530
Subject: [PATCH 062/166] [FIX]: Remove unnecessary space
bzr revid: atp@tinyerp.com-20120809182214-sc0pui70bxi35qy0
---
addons/sale_stock/res_config_view.xml | 115 +++++++++++++-------------
1 file changed, 57 insertions(+), 58 deletions(-)
diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml
index 8cb1419cbeb..24ece1673b3 100644
--- a/addons/sale_stock/res_config_view.xml
+++ b/addons/sale_stock/res_config_view.xml
@@ -8,67 +8,66 @@
form
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 72bdcb2a35116b16c04cbc53476dbeb759c94a59 Mon Sep 17 00:00:00 2001
From: "Amit (OpenERP)"
Date: Mon, 13 Aug 2012 14:07:29 +0530
Subject: [PATCH 063/166] [Fix] analytic : Imporved the analytic copy method
lp bug: https://launchpad.net/bugs/707359 fixed
bzr revid: amp@tinyerp.com-20120813083729-ncbcl2w0d846yah4
---
addons/analytic/analytic.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py
index 165af37888d..9ae3e6de2ad 100644
--- a/addons/analytic/analytic.py
+++ b/addons/analytic/analytic.py
@@ -238,8 +238,10 @@ class account_analytic_account(osv.osv):
def copy(self, cr, uid, id, default=None, context=None):
if not default:
default = {}
+ analytic = self.browse(cr, uid, id, context=context)
default['code'] = False
default['line_ids'] = []
+ default['name'] = (analytic['name'] or '') + '(copy)'
return super(account_analytic_account, self).copy(cr, uid, id, default, context=context)
def on_change_company(self, cr, uid, id, company_id):
From 7f38e9b7486071829535622fea8cf00e36a4036c Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Mon, 13 Aug 2012 14:16:28 +0530
Subject: [PATCH 064/166] [REVIEW] account_voucher: reconcile/unreconcile
button in bank statment line
bzr revid: hmo@tinyerp.com-20120813084628-ohvzyadke3knlbq0
---
addons/account_voucher/account_voucher.py | 20 +++++++++----------
.../account_voucher/account_voucher_view.xml | 8 ++++++--
2 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 3979796b4ed..0c5ba8cf7ce 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1494,19 +1494,18 @@ account_bank_statement()
class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
- def bank_st_payment(self, cr, uid, ids, context):
- record = record_id = False
- for rec in self.browse(cr, uid, ids, context=context):
- record_id = rec.voucher_id and rec.voucher_id .id or False
- record = rec
+ def action_payment_reconcile(self, cr, uid, ids, context=None):
+ statement_id = ids[0]
+ statement = self.browse(cr, uid, statement_id, context=context)
+ voucher = statement.voucher_id or False
+ if voucher and voucher.state == 'posted':
+ return voucher.cancel_voucher(context=context)
mod_obj = self.pool.get('ir.model.data')
- if record and record.type == 'customer':
+ if voucher and voucher.type == 'customer':
res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
else:
res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
view_id = res and res[1] or False
- context.update({'partner_id':record.partner_id.id, 'amount':record.amount})
-
return {
'name': _('Payment Entry'),
'res_model': 'account.voucher',
@@ -1515,10 +1514,9 @@ class account_bank_statement_line(osv.osv):
'target':'new',
'view_id':view_id,
'context': context,
- 'res_id':record_id,
+ 'res_id':voucher and voucher.id or False,
'type': 'ir.actions.act_window'
- }
-
+ }
def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
if not ids:
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index be91624755e..6d0658218eb 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -219,8 +219,12 @@
-
-
+
+
+
From 9c9ba99596d2b49599357a10ac9899f7d3ffc633 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Thu, 16 Aug 2012 17:39:47 +0530
Subject: [PATCH 065/166] [FIX]: Warning message when not enough stock for
product quantity.
bzr revid: atp@tinyerp.com-20120816120947-echtcz0lo11rtags
---
addons/sale_stock/sale_stock.py | 45 +++++++++++++++++++++++++++++++--
1 file changed, 43 insertions(+), 2 deletions(-)
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 14d841380ce..8786b45668d 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -632,8 +632,49 @@ class sale_order_line(osv.osv):
result['product_uom_qty'] = qty
return {'value': result, 'warning': warning}
-
-
+
+ def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
+ uom=False, qty_uos=0, uos=False, name='', partner_id=False,
+ lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
+ context = context or {}
+ product_uom_obj = self.pool.get('product.uom')
+ partner_obj = self.pool.get('res.partner')
+ product_obj = self.pool.get('product.product')
+ warning = {}
+ res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
+ uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
+ lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
+
+ if not product:
+ return {'value': {'th_weight': 0, 'product_packaging': False,
+ 'product_uos_qty': qty}, 'domain': {'product_uom': [],
+ 'product_uos': []}}
+ res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
+ result = res.get('value', {})
+ warning_msgs = res.get('warning') and res['warning']['message'] or ''
+ product_obj = product_obj.browse(cr, uid, product, context=context)
+ uom2 = False
+ if uom:
+ uom2 = product_uom_obj.browse(cr, uid, uom)
+ if product_obj.uom_id.category_id.id != uom2.category_id.id:
+ uom = False
+ if not uom2:
+ uom2 = product_obj.uom_id
+
+ compare_qty = float_compare(product_obj.virtual_available * uom2.factor, qty * product_obj.uom_id.factor, precision_rounding=product_obj.uom_id.rounding)
+ if (product_obj.type=='product') and int(compare_qty) == -1 \
+ and (product_obj.procure_method=='make_to_stock'):
+ warn_msg = _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % \
+ (qty, uom2 and uom2.name or product_obj.uom_id.name,
+ max(0,product_obj.virtual_available), product_obj.uom_id.name,
+ max(0,product_obj.qty_available), product_obj.uom_id.name)
+ warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
+ # get unit price
+ if warning_msgs:
+ warning.update({'message': warning_msgs})
+ res.update({'warning': warning})
+ return res
+
def button_cancel(self, cr, uid, ids, context=None):
res = super(sale_order_line, self).button_cancel(cr, uid, ids, context=context)
for line in self.browse(cr, uid, ids, context=context):
From 7bd2b9092fc71d1375f777b3f3021517f9483407 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 20 Aug 2012 15:19:32 +0530
Subject: [PATCH 066/166] [IMP] improve css for reconcile button of list view
bzr revid: rgaopenerp-20120820094932-sk4ralcauj3qe5m8
---
.../src/css/account_move_reconciliation.css | 22 +++++++++++++++++++
.../account_voucher/account_voucher_view.xml | 3 +--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css
index 59861a66b68..0cedec95f09 100644
--- a/addons/account/static/src/css/account_move_reconciliation.css
+++ b/addons/account/static/src/css/account_move_reconciliation.css
@@ -72,4 +72,26 @@
.openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar {
width: 200px !important;
+}
+
+.openerp .oe_list_content > tbody > tr > td > button.reconcile_btn {
+ color: white;
+ background-color: #8a89ba;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#8a89ba), to(#807fb4));
+ background-image: -webkit-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -moz-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -ms-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: -o-linear-gradient(top, #8a89ba, #807fb4);
+ background-image: linear-gradient(to bottom, #8a89ba, #807fb4);
+ padding: 0 5px 0 5px;
+}
+.openerp .oe_list_content > tbody > tr > td > button.reconcile_btn:hover {
+ color: white;
+ background-color: #807fb4;
+ background-image: -webkit-gradient(linear, left top, left bottom, from(#807fb4), to(#8a89ba));
+ background-image: -webkit-linear-gradient(top, #807fb4, #8a89ba);
+ background-image: -moz-linear-gradient(top, #807fb4, #8a89ba);
+ background-image: -ms-linear-gradient(top, #807fb4, #8a89ba);
+ background-image: -o-linear-gradient(top, #807fb4, #8a89ba);
+ background-image: linear-gradient(to bottom, #807fb4, #8a89ba);
}
\ No newline at end of file
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index 6d0658218eb..c7618a3c411 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -223,8 +223,7 @@
Reconcile
Unreconcile
-->
-
-
+
From 3a4a7ddd0ede5dae94ed58a65a3ea10655fb277b Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 20 Aug 2012 19:56:45 +0530
Subject: [PATCH 067/166] [IMP] nothing to reconcile button shuould remove
partner from list and this partner should added back when new related move
line created
bzr revid: rgaopenerp-20120820142645-z0x2252s18wa0yt9
---
addons/account/account_move_reconciliation.py | 24 ++++++++++++++++++-
.../src/js/account_move_reconciliation.js | 11 +++++----
2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index eaf9d31f976..992c1f2a906 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -18,6 +18,9 @@
# along with this program. If not, see .
#
##############################################################################
+import time
+from datetime import datetime
+
import tools
from osv import fields,osv
@@ -58,7 +61,26 @@ class account_move_reconciliation(osv.osv):
res_all[id] = res
return res_all
-
+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+ obj_move_line = self.pool.get('account.move.line')
+ ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count)
+ res_ids = []
+ for id in ids:
+ last_reconciliation_date = self.browse(cr, uid, id, context=context).last_reconciliation_date
+ if not last_reconciliation_date:
+ res_ids.append(id)
+ else:
+ move_ids = obj_move_line.search(cr, uid, [('partner_id','=', id),('create_date','>', last_reconciliation_date)])
+ if move_ids:
+ res_ids.append(id)
+ return res_ids
+
+ def skip_partner(self, cr, uid, ids, context):
+ res_partner = self.pool.get('res.partner')
+ for partner in self.browse(cr, uid, ids, context=context):
+ res_partner.write(cr, uid, [partner.id] ,{'last_reconciliation_date':time.strftime("%Y-%m-%d %H:%M:%S")})
+
+
_columns = {
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 765a48af13b..a061730cd90 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -74,11 +74,12 @@ instance.account.extend_form_view = instance.web.FormView.extend({
},
do_nothing_to_reconcile:function(){
- this.dataset.ids = _.without(this.dataset.ids, this.datarecord.id)
- // viewmanager = this.getParent();
- // viewmanager.action.context.active_ids = viewmanager.dataset_form.ids;
- if (!_.isEmpty(this.dataset.ids))
- this.on_pager_action('first');
+ self = this
+ this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
+ self.dataset.read_slice().done(function(){
+ self.on_pager_action('first');
+ });
+ })
},
do_update_pager: function(hide_index) {
From 161cb3e8b0d546f74712a81e3d0ebed9d08d99ca Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Tue, 21 Aug 2012 14:09:42 +0530
Subject: [PATCH 068/166] [IMP] code clean up + fix crash when dataset has no
value
bzr revid: rgaopenerp-20120821083942-d032uvt13ij3jadi
---
addons/account/account_move_reconciliation.py | 2 --
.../account/static/src/js/account_move_reconciliation.js | 7 +++++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 992c1f2a906..0590440b861 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -19,8 +19,6 @@
#
##############################################################################
import time
-from datetime import datetime
-
import tools
from osv import fields,osv
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index a061730cd90..de233043187 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -74,12 +74,15 @@ instance.account.extend_form_view = instance.web.FormView.extend({
},
do_nothing_to_reconcile:function(){
- self = this
+ var self = this
+ if (!_.isEmpty(this.dataset.ids)){
this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
self.dataset.read_slice().done(function(){
- self.on_pager_action('first');
+ if (!_.isEmpty(self.dataset.ids))
+ self.on_pager_action('first');
});
})
+ }
},
do_update_pager: function(hide_index) {
From c6502634bff19d4456afbe922004ccdb469b938b Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 22 Aug 2012 11:04:01 +0530
Subject: [PATCH 069/166] [IMP] improve view + add functional field in
statement to disable list button
bzr revid: rgaopenerp-20120822053401-vyczfhzo3l3zavty
---
addons/account/account_move_reconciliation.xml | 4 ++--
.../src/css/account_move_reconciliation.css | 4 +++-
addons/account_voucher/account_voucher.py | 15 ++++++++++++---
addons/account_voucher/account_voucher_view.xml | 3 ++-
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 62ae504ab89..5e26b9c0bec 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -21,12 +21,12 @@
-
+
-
+
diff --git a/addons/account/static/src/css/account_move_reconciliation.css b/addons/account/static/src/css/account_move_reconciliation.css
index 0cedec95f09..f4136a79ef4 100644
--- a/addons/account/static/src/css/account_move_reconciliation.css
+++ b/addons/account/static/src/css/account_move_reconciliation.css
@@ -73,7 +73,9 @@
.openerp .oe_extended_form_view .oe_form_field_progressbar.ui-progressbar {
width: 200px !important;
}
-
+.openerp .oe_extended_form_view div.oe_reconcile_row{
+ margin-top:7px;
+}
.openerp .oe_list_content > tbody > tr > td > button.reconcile_btn {
color: white;
background-color: #8a89ba;
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 9a3af14f665..d91c6158d18 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1499,8 +1499,6 @@ class account_bank_statement_line(osv.osv):
statement_id = ids[0]
statement = self.browse(cr, uid, statement_id, context=context)
voucher = statement.voucher_id or False
- if voucher and voucher.state == 'posted':
- return voucher.cancel_voucher(context=context)
mod_obj = self.pool.get('ir.model.data')
if voucher and voucher.type == 'customer':
res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
@@ -1529,7 +1527,16 @@ class account_bank_statement_line(osv.osv):
else:
res[line.id] = 0.0
return res
-
+
+ def _is_reconciled(self, cr, uid, ids, name, args, context=None):
+ res = {}
+ for line in self.browse(cr, uid, ids, context=context):
+ if line.voucher_id and line.voucher_id.state == 'posted':
+ res[line.id] = True
+ else:
+ res[line.id] = False
+ return res
+
def _check_amount(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
if obj.voucher_id:
@@ -1543,6 +1550,8 @@ class account_bank_statement_line(osv.osv):
]
_columns = {
+ 'is_reconciled': fields.function(_is_reconciled,
+ string='Statement is reconciled?', type='boolean'),
'amount_reconciled': fields.function(_amount_reconciled,
string='Amount reconciled', type='float'),
'voucher_id': fields.many2one('account.voucher', 'Payment'),
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index ddeba22d905..30dfe527d3b 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -217,7 +217,8 @@
Reconcile
Unreconcile
-->
-
+
+
From c9a718b98af8744030ab4d7d9509d0a4a6a6e5cb Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 22 Aug 2012 11:47:24 +0530
Subject: [PATCH 070/166] [IMP] if bank line has no voucher then create it on
reconcile
bzr revid: rgaopenerp-20120822061724-kcudfqtqghpdp97b
---
addons/account_voucher/account_voucher.py | 30 +++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index d91c6158d18..821ad9f379e 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -1499,11 +1499,37 @@ class account_bank_statement_line(osv.osv):
statement_id = ids[0]
statement = self.browse(cr, uid, statement_id, context=context)
voucher = statement.voucher_id or False
+ voucher_id = voucher and voucher.id or False
+ if not voucher:
+ voucher_obj = self.pool.get('account.voucher')
+ sign = 1
+ type = 'general'
+ ttype = statement.amount < 0 and 'payment' or 'receipt'
+ if statement.journal_id.type in ('sale', 'sale_refund'):
+ type = 'customer'
+ ttype = 'receipt'
+ elif statement.journal_id.type in ('purchase', 'purhcase_refund'):
+ type = 'supplier'
+ ttype = 'payment'
+ sign = -1
+
+ result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=statement.partner_id.id, journal_id=statement.journal_id.id, amount=sign*statement.amount, currency_id= False, ttype=ttype, date=statement.date, context=context)
+ voucher_res = { 'type': ttype,
+ 'name': statement.name,
+ 'partner_id': statement.partner_id.id,
+ 'journal_id': statement.journal_id.id,
+ 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id),
+ 'company_id': statement.company_id.id,
+ 'date': statement.date,
+ 'amount': sign*statement.amount,
+ }
+ voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
+ self.write(cr, uid, statement_id, {'voucher_id':voucher_id}, context=context)
mod_obj = self.pool.get('ir.model.data')
if voucher and voucher.type == 'customer':
res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
else:
- res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
+ res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
view_id = res and res[1] or False
return {
'name': _('Payment Entry'),
@@ -1513,7 +1539,7 @@ class account_bank_statement_line(osv.osv):
'target':'new',
'view_id':view_id,
'context': context,
- 'res_id':voucher and voucher.id or False,
+ 'res_id':voucher_id,
'type': 'ir.actions.act_window'
}
From b4a38f16ace679f5c84b80ea9fe0edca7e96ae78 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 22 Aug 2012 18:26:16 +0530
Subject: [PATCH 071/166] [FIX] last_reconciliation_date should write on
reconcilation and change according to get correct partner based on last
reconciliation date
bzr revid: rgaopenerp-20120822125616-bxkrh4le71yg2dod
---
addons/account/account_move_reconciliation.py | 4 ++--
addons/account/wizard/account_reconcile.py | 3 ++-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 0590440b861..a6675825ce8 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -68,7 +68,7 @@ class account_move_reconciliation(osv.osv):
if not last_reconciliation_date:
res_ids.append(id)
else:
- move_ids = obj_move_line.search(cr, uid, [('partner_id','=', id),('create_date','>', last_reconciliation_date)])
+ move_ids = obj_move_line.search(cr, uid, [('partner_id','=', id),('date','>', last_reconciliation_date)])
if move_ids:
res_ids.append(id)
return res_ids
@@ -76,7 +76,7 @@ class account_move_reconciliation(osv.osv):
def skip_partner(self, cr, uid, ids, context):
res_partner = self.pool.get('res.partner')
for partner in self.browse(cr, uid, ids, context=context):
- res_partner.write(cr, uid, [partner.id] ,{'last_reconciliation_date':time.strftime("%Y-%m-%d %H:%M:%S")})
+ res_partner.write(cr, uid, [partner.id] ,{'last_reconciliation_date':time.strftime("%Y-%m-%d")})
_columns = {
diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py
index 729792e2222..ceed4c267df 100644
--- a/addons/account/wizard/account_reconcile.py
+++ b/addons/account/wizard/account_reconcile.py
@@ -92,12 +92,13 @@ class account_move_line_reconcile(osv.osv_memory):
partner_id = tmp_ml_id.partner_id and tmp_ml_id.partner_id.id or False
debit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('debit', '>', 0)], context=context)
credit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('credit', '>', 0)], context=context)
+ print 'REREWREW',credit_ml_ids, debit_ml_ids, context
for ml_id in context['active_ids']:
if ml_id in debit_ml_ids:
debit_ml_ids.remove(ml_id)
if ml_id in credit_ml_ids:
credit_ml_ids.remove(ml_id)
- if not debit_ml_ids and credit_ml_ids:
+ if not debit_ml_ids and not credit_ml_ids:
context.update({'stop_reconcile': True})
account_move_line_obj.reconcile(cr, uid, context['active_ids'], 'manual', account_id,
period_id, journal_id, context=context)
From b246b1955a41524dc8eb8612a14b09c9120f5cd2 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Wed, 22 Aug 2012 19:29:04 +0530
Subject: [PATCH 072/166] [IMP] remove function field from account voucher and
set search default on move line entry
bzr revid: rgaopenerp-20120822135904-y03fti3q0yooxnxu
---
addons/account/account_view.xml | 4 ++--
addons/account_voucher/account_voucher.py | 18 ++++++------------
.../account_voucher/account_voucher_view.xml | 4 ++--
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index e80219e3c64..3c27d3cfec1 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1545,7 +1545,7 @@
tree,form
[('partner_id.customer','=',True)]
-
+
@@ -1555,7 +1555,7 @@
tree,form
[('partner_id.supplier','=',True)]
-
+
Reconcile
Unreconcile
-->
-
-
+
+
From c1437ba1b4306f05595a5310f51d7b61b6d4775a Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Thu, 23 Aug 2012 17:25:23 +0530
Subject: [PATCH 073/166] [IMP] Added old wizrad algo to computer prgoress of
reconcilation process, costomer and supplier should display respective
recivalbe and payable entry
bzr revid: rgaopenerp-20120823115523-44m8ydyc33az4tjc
---
addons/account/account_move_line.py | 2 +
addons/account/account_move_reconciliation.py | 111 ++++++++++++------
.../account/account_move_reconciliation.xml | 2 +-
addons/account/account_view.xml | 6 +-
.../account_move_reconciliation.py | 25 +++-
5 files changed, 100 insertions(+), 46 deletions(-)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 18ab1a779a3..ccea4e1c1a8 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -701,6 +701,8 @@ class account_move_line(osv.osv):
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
+ if context and context.get('account_type', False):
+ args.append(('account_id.type', '=', context.get('account_type', False)))
if context and context.get('next_partner_only', False):
if not context.get('partner_id', False):
partner = self.get_next_partner_only(cr, uid, offset, context)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index a6675825ce8..232a0ae9aa7 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -23,18 +23,11 @@ import time
import tools
from osv import fields,osv
-#4 remove get_unreconcile_entry method mange it with domain
-
class account_move_line(osv.osv):
_inherit = "account.move.line"
def get_unreconcile_entry(self, cr, uid, ids, context=None):
- records = self.read(cr, uid, ids, ['reconcile_id'])
- res = []
- for record in records:
- if not record.get('reconcile_id'):
- res.append(record['id'])
- return res
+ return self.search(cr, uid, [('id', 'in', ids), ('reconcile_id', '=', False)], context=context)
account_move_line();
@@ -43,59 +36,101 @@ class account_move_reconciliation(osv.osv):
_name = "account.move.reconciliation"
_description = "All partner info related account move line"
_auto = False
+
+ def _get_to_reconcile(self, cr, uid, context=None):
+ query= ''
+ if context and context.get('account_type', False) == 'payable':
+ query = 'AND p.supplier = True'
+
+ cr.execute("""
+ SELECT p_id FROM (SELECT l.partner_id as p_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
+ FROM account_move_line AS l LEFT JOIN account_account a ON (l.account_id = a.id)
+ LEFT JOIN res_partner p ON (p.id = l.partner_id)
+ WHERE a.reconcile = 't'
+ AND l.reconcile_id IS NULL
+ AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') OR p.last_reconciliation_date IS NULL )
+ AND l.state <> 'draft' """ +query + """
+ GROUP BY l.partner_id) AS tmp
+ WHERE debit >= 0
+ AND credit >= 0
+ """,(time.strftime('%Y-%m-%d'),)
+ )
+ return len(map(lambda x: x[0], cr.fetchall())) - 1
+
+ def _get_today_reconciled(self, cr, uid, context=None):
+ query= ''
+ if context and context.get('account_type', False) == 'payable':
+ query = 'AND p.supplier = True'
+
+ cr.execute(
+ """SELECT l.partner_id
+ FROM account_move_line AS l LEFT JOIN res_partner p ON (p.id = l.partner_id)
+ WHERE l.reconcile_id IS NULL
+ AND %s = to_char(p.last_reconciliation_date, 'YYYY-MM-DD')
+ AND l.state <> 'draft' """ +query + """
+ GROUP BY l.partner_id """,(time.strftime('%Y-%m-%d'),)
+ )
+ return len(map(lambda x: x[0], cr.fetchall())) + 1
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
- active_ids = context.get('active_ids', [])
- res = 0
- if active_ids:
- total_records = self.search(cr, uid, [('id','in',active_ids)])
- total_unreconcile = 0
- for record in self.read(cr, uid, total_records, ['unreconcile_count'], context=context):
- if record['unreconcile_count'] > 0:
- total_unreconcile += 1
- res = float(len(total_records) - total_unreconcile)/len(total_records) * 100
- res_all = {}
+ res = {}
+ to_reconcile = self._get_to_reconcile(cr, uid, context)
+ today_reconcile = self._get_today_reconciled(cr, uid, context)
+ if to_reconcile < 0:
+ reconciliation_progress = 100
+ else:
+ reconciliation_progress = (100 / (float( to_reconcile + today_reconcile) or 1.0)) * today_reconcile
for id in ids:
- res_all[id] = res
- return res_all
+ res[id] = reconciliation_progress
+ return res
+#
+ def get_partners(self, cr, uid, context=None):
+ query= ''
+ if context and context.get('account_type', False) == 'payable':
+ query = 'AND p.supplier = True'
+ cr.execute(
+ """
+ SELECT p.id
+ FROM res_partner p
+ RIGHT JOIN (
+ SELECT l.partner_id AS partner_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
+ FROM account_move_line l
+ LEFT JOIN account_account a ON (a.id = l.account_id)
+ LEFT JOIN res_partner p ON (l.partner_id = p.id)
+ WHERE a.reconcile IS TRUE
+ AND l.reconcile_id IS NULL
+ AND (p.last_reconciliation_date IS NULL OR l.date > p.last_reconciliation_date)
+ AND l.state <> 'draft' """ +query + """
+ GROUP BY l.partner_id
+ ) AS s ON (p.id = s.partner_id)
+ ORDER BY p.last_reconciliation_date""")
+ return cr.fetchall()
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- obj_move_line = self.pool.get('account.move.line')
ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count)
- res_ids = []
- for id in ids:
- last_reconciliation_date = self.browse(cr, uid, id, context=context).last_reconciliation_date
- if not last_reconciliation_date:
- res_ids.append(id)
- else:
- move_ids = obj_move_line.search(cr, uid, [('partner_id','=', id),('date','>', last_reconciliation_date)])
- if move_ids:
- res_ids.append(id)
- return res_ids
+ res = self.get_partners(cr, uid, context=context)
+ return map(lambda x: x[0], res)
def skip_partner(self, cr, uid, ids, context):
- res_partner = self.pool.get('res.partner')
- for partner in self.browse(cr, uid, ids, context=context):
- res_partner.write(cr, uid, [partner.id] ,{'last_reconciliation_date':time.strftime("%Y-%m-%d")})
-
+ self.pool.get('res.partner').write(cr, uid, ids ,{'last_reconciliation_date':time.strftime("%Y-%m-%d")}, context)
_columns = {
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
- 'unreconcile_count':fields.integer('Unreconcile Count'),
}
+
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
SELECT move_line.partner_id as id, move_line.partner_id,
- MAX(move_line.date) as latest_date,
- (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count
+ MAX(move_line.date) as latest_date
FROM account_move_line as move_line where move_line.state <> 'draft'
GROUP by move_line.partner_id
)
""")
account_move_reconciliation()
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 5e26b9c0bec..256492bfa48 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -17,7 +17,7 @@
-
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 3c27d3cfec1..2093b548044 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1544,8 +1544,7 @@
form
tree,form
- [('partner_id.customer','=',True)]
-
+
@@ -1554,8 +1553,7 @@
form
tree,form
- [('partner_id.supplier','=',True)]
-
+
).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see .
+#
+##############################################################################
from osv import fields, osv
import tools
@@ -12,12 +32,11 @@ class account_move_reconciliation(osv.osv):
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
- CREATE or REPLACE VIEW account_move_reconciliation as (
+ CREATE or REPLACE VIEW account_move_reconciliation as (
SELECT move_line.partner_id as id, move_line.partner_id,
- MAX(move_line.date) as latest_date,
MAX(move_line.followup_date) as followup_date,
MAX(move_line.followup_line_id) as max_followup_id,
- (select count(unreconcile.id) from account_move_line as unreconcile where unreconcile.reconcile_id is null and unreconcile.partner_id = move_line.partner_id) as unreconcile_count
+ MAX(move_line.date) as latest_date
FROM account_move_line as move_line where move_line.state <> 'draft'
GROUP by move_line.partner_id
)
From 03dd0da485edba261d8f6b97bd5b5c14a25136d5 Mon Sep 17 00:00:00 2001
From: "RGA(OpenERP)" <>
Date: Mon, 27 Aug 2012 12:15:31 +0530
Subject: [PATCH 074/166] Remove print
bzr revid: rgaopenerp-20120827064531-hxwor2pr6nn5f53r
---
addons/account/wizard/account_reconcile.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py
index ceed4c267df..5696079bedf 100644
--- a/addons/account/wizard/account_reconcile.py
+++ b/addons/account/wizard/account_reconcile.py
@@ -92,7 +92,6 @@ class account_move_line_reconcile(osv.osv_memory):
partner_id = tmp_ml_id.partner_id and tmp_ml_id.partner_id.id or False
debit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('debit', '>', 0)], context=context)
credit_ml_ids = account_move_line_obj.search(cr, uid, [('partner_id', '=', partner_id), ('account_id.reconcile', '=', True), ('reconcile_id', '=', False), ('credit', '>', 0)], context=context)
- print 'REREWREW',credit_ml_ids, debit_ml_ids, context
for ml_id in context['active_ids']:
if ml_id in debit_ml_ids:
debit_ml_ids.remove(ml_id)
From d55eaccb232913e0414769a591cf3d192e6cf941 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 29 Aug 2012 12:07:32 +0530
Subject: [PATCH 075/166] [REF] account: sql view of manual reconcilation move
line
bzr revid: hmo@tinyerp.com-20120829063732-2yn3sj0lshnx4n35
---
addons/account/account_move_reconciliation.py | 101 ++++++------------
.../account/account_move_reconciliation.xml | 34 ++++++
addons/account/account_view.xml | 32 ------
.../src/js/account_move_reconciliation.js | 10 +-
.../account_move_reconciliation.py | 24 +++--
.../account_move_reconciliation.xml | 4 +-
6 files changed, 85 insertions(+), 120 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 232a0ae9aa7..901fc8164bf 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -34,48 +34,26 @@ account_move_line();
class account_move_reconciliation(osv.osv):
_name = "account.move.reconciliation"
- _description = "All partner info related account move line"
+ _description = "partner info related account move line"
_auto = False
+ _order = 'last_reconciliation_date'
- def _get_to_reconcile(self, cr, uid, context=None):
- query= ''
- if context and context.get('account_type', False) == 'payable':
- query = 'AND p.supplier = True'
+ def search(self, cr, uid, args, offset=0, limit=None, order=None,
+ context=None, count=False):
+ if context is None:
+ context = {}
+ account_type = context.get('account_type', False)
+ if account_type == "receivable":
+ args += [('customer','=', True)]
+ if account_type == "payable":
+ args += [('supplier','=', True)]
+ return super(account_move_reconciliation, self).search(cr, uid, args, offset, limit,
+ order, context=context, count=count)
- cr.execute("""
- SELECT p_id FROM (SELECT l.partner_id as p_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
- FROM account_move_line AS l LEFT JOIN account_account a ON (l.account_id = a.id)
- LEFT JOIN res_partner p ON (p.id = l.partner_id)
- WHERE a.reconcile = 't'
- AND l.reconcile_id IS NULL
- AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') OR p.last_reconciliation_date IS NULL )
- AND l.state <> 'draft' """ +query + """
- GROUP BY l.partner_id) AS tmp
- WHERE debit >= 0
- AND credit >= 0
- """,(time.strftime('%Y-%m-%d'),)
- )
- return len(map(lambda x: x[0], cr.fetchall())) - 1
-
- def _get_today_reconciled(self, cr, uid, context=None):
- query= ''
- if context and context.get('account_type', False) == 'payable':
- query = 'AND p.supplier = True'
-
- cr.execute(
- """SELECT l.partner_id
- FROM account_move_line AS l LEFT JOIN res_partner p ON (p.id = l.partner_id)
- WHERE l.reconcile_id IS NULL
- AND %s = to_char(p.last_reconciliation_date, 'YYYY-MM-DD')
- AND l.state <> 'draft' """ +query + """
- GROUP BY l.partner_id """,(time.strftime('%Y-%m-%d'),)
- )
- return len(map(lambda x: x[0], cr.fetchall())) + 1
-
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
- to_reconcile = self._get_to_reconcile(cr, uid, context)
- today_reconcile = self._get_today_reconciled(cr, uid, context)
+ to_reconcile = self.search(cr, uid, [], context=context)
+ today_reconcile = self.search(cr, uid, [('last_reconciliation_date','=',time.strftime('%Y-%m-%d'))], context=context)
if to_reconcile < 0:
reconciliation_progress = 100
else:
@@ -83,34 +61,8 @@ class account_move_reconciliation(osv.osv):
for id in ids:
res[id] = reconciliation_progress
return res
-#
- def get_partners(self, cr, uid, context=None):
- query= ''
- if context and context.get('account_type', False) == 'payable':
- query = 'AND p.supplier = True'
- cr.execute(
- """
- SELECT p.id
- FROM res_partner p
- RIGHT JOIN (
- SELECT l.partner_id AS partner_id, SUM(l.debit) AS debit, SUM(l.credit) AS credit
- FROM account_move_line l
- LEFT JOIN account_account a ON (a.id = l.account_id)
- LEFT JOIN res_partner p ON (l.partner_id = p.id)
- WHERE a.reconcile IS TRUE
- AND l.reconcile_id IS NULL
- AND (p.last_reconciliation_date IS NULL OR l.date > p.last_reconciliation_date)
- AND l.state <> 'draft' """ +query + """
- GROUP BY l.partner_id
- ) AS s ON (p.id = s.partner_id)
- ORDER BY p.last_reconciliation_date""")
- return cr.fetchall()
-
- def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
- ids = super(account_move_reconciliation, self).search(cr, uid, args, offset, limit, order, context, count)
- res = self.get_partners(cr, uid, context=context)
- return map(lambda x: x[0], res)
-
+
+
def skip_partner(self, cr, uid, ids, context):
self.pool.get('res.partner').write(cr, uid, ids ,{'last_reconciliation_date':time.strftime("%Y-%m-%d")}, context)
@@ -118,6 +70,8 @@ class account_move_reconciliation(osv.osv):
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
+ 'supplier': fields.related('partner_id', 'supplier' ,type='boolean', string='Supplier'),
+ 'customer': fields.related('partner_id', 'customer' ,type='boolean', string='Customer'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
}
@@ -125,12 +79,17 @@ class account_move_reconciliation(osv.osv):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT move_line.partner_id as id, move_line.partner_id,
- MAX(move_line.date) as latest_date
- FROM account_move_line as move_line where move_line.state <> 'draft'
- GROUP by move_line.partner_id
- )
+ SELECT move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit, MAX(move_line.date) AS latest_date
+ FROM account_move_line move_line
+ LEFT JOIN account_account a ON (a.id = move_line.account_id)
+ RIGHT JOIN res_partner partner ON (move_line.partner_id = partner.id)
+ WHERE a.reconcile IS TRUE
+ AND move_line.reconcile_id IS NULL
+ AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
+ AND move_line.state <> 'draft'
+ GROUP BY move_line.partner_id
+ )
""")
account_move_reconciliation()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 256492bfa48..b99a691486c 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -1,6 +1,7 @@
+
account.move.reconciliation.form
account.move.reconciliation
@@ -32,5 +33,38 @@
+
+
+
+ Entries To Reconcile
+ account.move.line
+ form
+ tree,form
+
+
+
+
+
+ Entries To Reconcile
+ account.move.line
+ form
+ tree,form
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 2093b548044..04e3acf1ff8 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1538,38 +1538,6 @@
-
- Entries To Reconcile
- account.move.line
- form
- tree,form
-
-
-
-
-
- Entries To Reconcile
- account.move.line
- form
- tree,form
-
-
-
-
-
-
-
-
-
-
-
'draft'
- GROUP by move_line.partner_id
- )
+ SELECT move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit, MAX(move_line.date) AS latest_date,
+ MAX(move_line.followup_date) as followup_date
+ FROM account_move_line move_line
+ LEFT JOIN account_account a ON (a.id = move_line.account_id)
+ RIGHT JOIN res_partner partner ON (move_line.partner_id = partner.id)
+ WHERE a.reconcile IS TRUE
+ AND move_line.reconcile_id IS NULL
+ AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
+ AND move_line.state <> 'draft'
+ GROUP BY move_line.partner_id
+ )
""")
-account_move_reconciliation()
\ No newline at end of file
+account_move_reconciliation()
diff --git a/addons/account_followup/account_move_reconciliation.xml b/addons/account_followup/account_move_reconciliation.xml
index f27bf9207eb..a3b8fa0dfdb 100644
--- a/addons/account_followup/account_move_reconciliation.xml
+++ b/addons/account_followup/account_move_reconciliation.xml
@@ -9,8 +9,8 @@
-
-
+
+
From 62d7cea01eebb5099b8b79f3a1f51e843664cec4 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 29 Aug 2012 13:03:19 +0530
Subject: [PATCH 076/166] [FIX] account: reconciliation query
bzr revid: hmo@tinyerp.com-20120829073319-ke9wbhj7jr6hfc09
---
addons/account/account_move_reconciliation.py | 10 +++++++---
addons/account_followup/account_move_reconciliation.py | 4 +++-
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 901fc8164bf..688b1f2c47f 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -52,8 +52,10 @@ class account_move_reconciliation(osv.osv):
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
- to_reconcile = self.search(cr, uid, [], context=context)
- today_reconcile = self.search(cr, uid, [('last_reconciliation_date','=',time.strftime('%Y-%m-%d'))], context=context)
+ to_reconcile_ids = self.search(cr, uid, [], context=context)
+ to_reconcile = to_reconcile_ids and len(to_reconcile_ids) or 0
+ today_reconcile_ids = self.search(cr, uid, [('last_reconciliation_date','=',time.strftime('%Y-%m-%d'))], context=context)
+ today_reconcile = today_reconcile_ids and len(today_reconcile_ids) or 0
if to_reconcile < 0:
reconciliation_progress = 100
else:
@@ -79,7 +81,9 @@ class account_move_reconciliation(osv.osv):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit, MAX(move_line.date) AS latest_date
+ SELECT move_line.partner_id AS id, move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit,
+ MAX(move_line.date) AS latest_date,
+ MIN(partner.last_reconciliation_date) AS last_reconciliation_date
FROM account_move_line move_line
LEFT JOIN account_account a ON (a.id = move_line.account_id)
RIGHT JOIN res_partner partner ON (move_line.partner_id = partner.id)
diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py
index 81922f67a47..edfafcf628d 100644
--- a/addons/account_followup/account_move_reconciliation.py
+++ b/addons/account_followup/account_move_reconciliation.py
@@ -33,7 +33,9 @@ class account_move_reconciliation(osv.osv):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit, MAX(move_line.date) AS latest_date,
+ SELECT move_line.partner_id AS id, move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit,
+ MAX(move_line.date) AS latest_date,
+ MIN(partner.last_reconciliation_date) AS last_reconciliation_date,
MAX(move_line.followup_date) as followup_date
FROM account_move_line move_line
LEFT JOIN account_account a ON (a.id = move_line.account_id)
From e8c35f4abecf793d09ca4bd1f3ea15839c24b098 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 29 Aug 2012 15:27:06 +0530
Subject: [PATCH 077/166] [FIX] account: reconcilalition view
bzr revid: hmo@tinyerp.com-20120829095706-b0d71e8ilvx9w10n
---
addons/account/account_move_reconciliation.py | 13 ++++++-------
addons/account/account_move_reconciliation.xml | 4 ++--
.../static/src/js/account_move_reconciliation.js | 13 +++++++------
.../account_followup/account_move_reconciliation.py | 6 +++---
4 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 688b1f2c47f..1cb5517a88f 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -43,10 +43,8 @@ class account_move_reconciliation(osv.osv):
if context is None:
context = {}
account_type = context.get('account_type', False)
- if account_type == "receivable":
- args += [('customer','=', True)]
- if account_type == "payable":
- args += [('supplier','=', True)]
+ if account_type:
+ args += [('type','=', account_type)]
return super(account_move_reconciliation, self).search(cr, uid, args, offset, limit,
order, context=context, count=count)
@@ -72,6 +70,7 @@ class account_move_reconciliation(osv.osv):
'partner_id':fields.many2one('res.partner', 'Partner'),
'last_reconciliation_date':fields.related('partner_id', 'last_reconciliation_date' ,type='datetime', relation='res.partner', string='Last Reconciliation'),
'latest_date' :fields.date('Latest Entry'),
+ 'type': fields.char('Type', size=156),
'supplier': fields.related('partner_id', 'supplier' ,type='boolean', string='Supplier'),
'customer': fields.related('partner_id', 'customer' ,type='boolean', string='Customer'),
'reconciliation_progress': fields.function(_rec_progress, string='Progress (%)', type='float'),
@@ -81,17 +80,17 @@ class account_move_reconciliation(osv.osv):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT move_line.partner_id AS id, move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit,
+ SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit,
MAX(move_line.date) AS latest_date,
MIN(partner.last_reconciliation_date) AS last_reconciliation_date
FROM account_move_line move_line
LEFT JOIN account_account a ON (a.id = move_line.account_id)
- RIGHT JOIN res_partner partner ON (move_line.partner_id = partner.id)
+ LEFT JOIN res_partner partner ON (move_line.partner_id = partner.id)
WHERE a.reconcile IS TRUE
AND move_line.reconcile_id IS NULL
AND (partner.last_reconciliation_date IS NULL OR move_line.date > partner.last_reconciliation_date)
AND move_line.state <> 'draft'
- GROUP BY move_line.partner_id
+ GROUP BY move_line.partner_id, a.type
)
""")
account_move_reconciliation()
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index b99a691486c..5cfa81d5721 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -41,7 +41,7 @@
form
tree,form
-
+
@@ -50,7 +50,7 @@
form
tree,form
-
+
partner.last_reconciliation_date)
AND move_line.state <> 'draft'
- GROUP BY move_line.partner_id
+ GROUP BY move_line.partner_id, a.type
)
""")
account_move_reconciliation()
From 6281b9d42393097e33e5f809d2780fc5b5500bcd Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 29 Aug 2012 16:07:40 +0530
Subject: [PATCH 078/166] [FIX] account_followup: setup followup level in
reconciliation form
bzr revid: hmo@tinyerp.com-20120829103740-w69kk53x84quvrsg
---
addons/account/account_move_reconciliation.py | 4 +++-
addons/account/account_move_reconciliation.xml | 2 +-
.../account_move_reconciliation.py | 17 ++++++++++++++---
.../account_move_reconciliation.xml | 4 ++--
4 files changed, 20 insertions(+), 7 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index 1cb5517a88f..eb3eaf31458 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -80,7 +80,9 @@ class account_move_reconciliation(osv.osv):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit,
+ SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id,
+ SUM(move_line.debit) AS debit,
+ SUM(move_line.credit) AS credit,
MAX(move_line.date) AS latest_date,
MIN(partner.last_reconciliation_date) AS last_reconciliation_date
FROM account_move_line move_line
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 5cfa81d5721..20e3ba1486c 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -27,7 +27,7 @@
Nothing to Reconcile
-
+
diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py
index 4345c921954..00ae40f3aa8 100644
--- a/addons/account_followup/account_move_reconciliation.py
+++ b/addons/account_followup/account_move_reconciliation.py
@@ -23,17 +23,28 @@ import tools
class account_move_reconciliation(osv.osv):
_inherit = 'account.move.reconciliation'
+
+ def _get_followup(self, cr, uid, ids, field_name, arg, context=None):
+ result = {}
+ move_obj = self.pool.get("account.move.line")
+ for rec in self.browse(cr, uid, ids, context=context):
+ move_line_ids = move_obj.search(cr, uid, [('partner_id','=',rec.partner_id.id),('followup_date','=',rec.followup_date)], context=context)
+ move_line = move_line_ids and move_obj.browse(cr, uid, move_line_ids[0], context=context) or False
+ result[rec.id] = move_line and move_line.followup_line_id or False
+ return result
+
_columns = {
'followup_date': fields.date('Latest Follow-up'),
- #'followup_id':fields.many2one('account_followup.followup.line',
- # 'Max Follow Up Level' )
+ 'followup_id':fields.function(_get_followup, type='many2one', relation='account_followup.followup.line', string='Max Follow Up Level')
}
def init(self, cr):
tools.drop_view_if_exists(cr, 'account_move_reconciliation')
cr.execute("""
CREATE or REPLACE VIEW account_move_reconciliation as (
- SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id, SUM(move_line.debit) AS debit, SUM(move_line.credit) AS credit,
+ SELECT move_line.partner_id AS id, a.type AS type, move_line.partner_id AS partner_id,
+ SUM(move_line.debit) AS debit,
+ SUM(move_line.credit) AS credit,
MAX(move_line.date) AS latest_date,
MIN(partner.last_reconciliation_date) AS last_reconciliation_date,
MAX(move_line.followup_date) as followup_date
diff --git a/addons/account_followup/account_move_reconciliation.xml b/addons/account_followup/account_move_reconciliation.xml
index a3b8fa0dfdb..6ec70fd18a5 100644
--- a/addons/account_followup/account_move_reconciliation.xml
+++ b/addons/account_followup/account_move_reconciliation.xml
@@ -6,10 +6,10 @@
account.move.reconciliation
-
+
-
+
From 20eb0a5e882878e792c2b7f1f713d0415e740542 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 29 Aug 2012 18:13:03 +0530
Subject: [PATCH 079/166] [FIX] account: refactor js of account_reconciliation
bzr revid: hmo@tinyerp.com-20120829124303-8kw2jz4x4p2jr64u
---
.../account/account_move_reconciliation.xml | 4 +-
.../src/js/account_move_reconciliation.js | 59 +++++++++----------
2 files changed, 30 insertions(+), 33 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 20e3ba1486c..e5ccb090988 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -36,7 +36,7 @@
- Entries To Reconcile
+ Reconcile Customer Entries
account.move.line
form
tree,form
@@ -45,7 +45,7 @@
- Entries To Reconcile
+ Reconcile Supplier Entries
account.move.line
form
tree,form
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 03e6529ae9b..8339d7e2768 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -10,29 +10,20 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
this.setup_exended_form_view(this.action.context.extended_model, this.action.context.extended_view_id);
},
setup_exended_form_view: function(view_model, view_id){
- var self = this,
- from_view,
- obj_from_view;
+ var self = this;
from_view = this.registry.get_object('form_clone');
this.dataset_form = new instance.web.DataSetSearch(this, view_model, this.action.context, this.action.domain);
- this.dataset_loaded = this.dataset_form.read_slice()
- obj_from_view = new from_view(self, this.dataset_form, view_id, options={});
- obj_from_view.template = 'ExtendedFormView'
- view_promise = obj_from_view.appendTo(this.$el.find('.oe_extended_form_view'))
- $.when(view_promise, this.dataset_loaded).then(function() {
- self.action.context.active_ids = self.dataset_form.ids;
- if (!_.isEmpty(self.dataset_form.ids)) {
- obj_from_view.on_pager_action('first')
- }
- })
+ this.dataset_loaded = this.dataset_form.read_slice();
+ obj_from_view = new from_view(self, self.dataset_form, view_id, options={});
+ obj_from_view.template = 'ExtendedFormView';
+ view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
+ $.when(view_form, this.dataset_loaded).then(function() {
+ obj_from_view.post_action();
+ });
}
})
instance.account.extend_form_view = instance.web.FormView.extend({
- init :function(){
- this._super.apply(this,arguments);
- this.original_domain = this.getParent().action.domain;
- },
on_loaded: function(data) {
this._super.apply(this,arguments);
var self = this
@@ -65,23 +56,32 @@ instance.account.extend_form_view = instance.web.FormView.extend({
result.result.flags = result.result.flags || {};
result.result.flags.new_window = true;
self.do_action(result.result, function () {
- // reload view
- list_view.reload();
- self.reload();
+ self.post_action();
});
});
},
+
+ post_action: function(){
+ // hide if not records otherwise go next record
+ var self = this;
+ var viewmanager = this.getParent();
+ this.dataset.read_slice().done(function(){
+ if (_.isEmpty(self.dataset.ids)){
+ self.$el.hide();
+ viewmanager.action.context.next_partner_only = false;
+ viewmanager.searchview.do_search();
+ }
+ else{
+ self.on_pager_action('next');
+ }
+ });
+ },
do_nothing_to_reconcile:function(){
- var self = this
- if (!_.isEmpty(this.dataset.ids)){
+ var self = this;
this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
- self.dataset.read_slice().done(function(){
- if (!_.isEmpty(self.dataset.ids))
- self.on_pager_action('first');
- });
- })
- }
+ self.post_action();
+ });
},
do_update_pager: function(hide_index) {
@@ -93,13 +93,10 @@ instance.account.extend_form_view = instance.web.FormView.extend({
on_pager_action: function(action) {
var self = this
var viewmanager = self.getParent();
- viewmanager.action.domain = this.original_domain
$.when(this._super(action)).then(function() {
var id = self.get_fields_values().partner_id;
viewmanager.action.context.next_partner_only = true;
viewmanager.action.context.partner_id = [id];
- // apply domain on list
- //viewmanager.action.domain = (viewmanager.action.domain || []).concat([["partner_id", "=", id]])
viewmanager.searchview.do_search();
})
},
From ca603482093bd42788c7ee97e62b43272ce7f088 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Thu, 30 Aug 2012 16:09:54 +0530
Subject: [PATCH 080/166] [FIX] account: reconciliation wizard, improve
calculattion of pert.
bzr revid: hmo@tinyerp.com-20120830103954-mueab873pcunqjod
---
addons/account/account_move_reconciliation.py | 33 ++++++++++++++++---
.../src/js/account_move_reconciliation.js | 7 ++--
2 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index eb3eaf31458..a3f171fae7c 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -50,14 +50,37 @@ class account_move_reconciliation(osv.osv):
def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
res = {}
- to_reconcile_ids = self.search(cr, uid, [], context=context)
- to_reconcile = to_reconcile_ids and len(to_reconcile_ids) or 0
- today_reconcile_ids = self.search(cr, uid, [('last_reconciliation_date','=',time.strftime('%Y-%m-%d'))], context=context)
- today_reconcile = today_reconcile_ids and len(today_reconcile_ids) or 0
+ if context is None:
+ context = {}
+ ctx = dict(context)
+ ctx['next_partner_only'] = False
+ move_line_obj = self.pool.get("account.move.line")
+
+ to_reconcile_ids = move_line_obj.search(cr, uid, [
+ ('reconcile_id','=',False),
+ ('account_id.reconcile','=',True),
+ ('state','!=', 'draft'),
+ ('partner_id','!=', False),
+ '|', ('partner_id.last_reconciliation_date', '=', False),('partner_id.last_reconciliation_date','<',time.strftime('%Y-%m-%d 00:00:00')),
+ '|', ('debit', '>' ,0), ('credit', '>' ,0)
+ ],
+ context=ctx)
+ partner_ids = []
+ for move_line in move_line_obj.browse(cr, uid, to_reconcile_ids, context=ctx):
+ partner = move_line.partner_id
+ if move_line.date > partner.last_reconciliation_date and partner.id not in partner_ids:
+ partner_ids.append(move_line.partner_id.id)
+
+ to_reconcile = len(partner_ids)
+ today_reconciled_ids = self.pool.get('res.partner').search(cr, uid, [
+ ('last_reconciliation_date','>=',time.strftime('%Y-%m-%d 00:00:00')),
+ ('last_reconciliation_date','<=',time.strftime('%Y-%m-%d 23:59:59'))
+ ], context=ctx)
+ today_reconciled = today_reconciled_ids and len(today_reconciled_ids) or 0 # total partners which reconciled today
if to_reconcile < 0:
reconciliation_progress = 100
else:
- reconciliation_progress = (100 / (float( to_reconcile + today_reconcile) or 1.0)) * today_reconcile
+ reconciliation_progress = (100 / (float( to_reconcile + today_reconciled) or 1.0)) * today_reconciled
for id in ids:
res[id] = reconciliation_progress
return res
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 8339d7e2768..0af38246f0f 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -67,12 +67,13 @@ instance.account.extend_form_view = instance.web.FormView.extend({
var viewmanager = this.getParent();
this.dataset.read_slice().done(function(){
if (_.isEmpty(self.dataset.ids)){
- self.$el.hide();
+ viewmanager.action.context.next_partner_only = true;
+ /*self.$el.hide();
viewmanager.action.context.next_partner_only = false;
- viewmanager.searchview.do_search();
+ viewmanager.searchview.do_search();*/
}
else{
- self.on_pager_action('next');
+ self.on_pager_action('first');
}
});
},
From 08db03bfa247a12913231216cf2d49c70dd90b5a Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Thu, 30 Aug 2012 17:40:41 +0530
Subject: [PATCH 081/166] [IMP] account: split in small functions
bzr revid: hmo@tinyerp.com-20120830121041-pruspkwkav090foc
---
addons/account/account_move_reconciliation.py | 31 ++++++++++++++-----
.../src/js/account_move_reconciliation.js | 5 ++-
2 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/addons/account/account_move_reconciliation.py b/addons/account/account_move_reconciliation.py
index a3f171fae7c..b89dbacf623 100644
--- a/addons/account/account_move_reconciliation.py
+++ b/addons/account/account_move_reconciliation.py
@@ -48,14 +48,13 @@ class account_move_reconciliation(osv.osv):
return super(account_move_reconciliation, self).search(cr, uid, args, offset, limit,
order, context=context, count=count)
- def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
- res = {}
+
+ def _get_to_reconcile_partners(self, cr, uid, context=None):
if context is None:
context = {}
ctx = dict(context)
ctx['next_partner_only'] = False
move_line_obj = self.pool.get("account.move.line")
-
to_reconcile_ids = move_line_obj.search(cr, uid, [
('reconcile_id','=',False),
('account_id.reconcile','=',True),
@@ -69,14 +68,30 @@ class account_move_reconciliation(osv.osv):
for move_line in move_line_obj.browse(cr, uid, to_reconcile_ids, context=ctx):
partner = move_line.partner_id
if move_line.date > partner.last_reconciliation_date and partner.id not in partner_ids:
- partner_ids.append(move_line.partner_id.id)
+ partner_ids.append(partner.id)
+ return len(partner_ids)
- to_reconcile = len(partner_ids)
+ def _get_today_reconciled_partners(self, cr, uid, context=None):
+ if context is None:
+ context = {}
+ account_type = context.get("account_type", False)
+ supplier = False
+ customer = False
+ if account_type == 'payable':
+ supplier = True
+ else:
+ customer = True
today_reconciled_ids = self.pool.get('res.partner').search(cr, uid, [
('last_reconciliation_date','>=',time.strftime('%Y-%m-%d 00:00:00')),
- ('last_reconciliation_date','<=',time.strftime('%Y-%m-%d 23:59:59'))
- ], context=ctx)
- today_reconciled = today_reconciled_ids and len(today_reconciled_ids) or 0 # total partners which reconciled today
+ ('last_reconciliation_date','<=',time.strftime('%Y-%m-%d 23:59:59')),
+ '|', ('supplier','=',supplier), ('customer','=',customer)
+ ], context=context)
+ return today_reconciled_ids and len(today_reconciled_ids) or 0
+
+ def _rec_progress(self, cr, uid, ids, prop, unknow_none, context=None):
+ res = {}
+ to_reconcile = self._get_to_reconcile_partners(cr, uid, context=context)
+ today_reconciled = self._get_today_reconciled_partners(cr, uid, context=context)
if to_reconcile < 0:
reconciliation_progress = 100
else:
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 0af38246f0f..9b5aacf28bf 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -86,7 +86,10 @@ instance.account.extend_form_view = instance.web.FormView.extend({
},
do_update_pager: function(hide_index) {
- var index = hide_index ? '-' : this.dataset.index + 1;
+ var index = this.dataset.index + 1
+ if (this.dataset.ids.length == 0)
+ index = 0;
+ index = hide_index ? '-' : index;
this.$el.find('span.oe_pager_index_extend').html(index).end()
.find('span.oe_pager_count_extend').html(this.dataset.ids.length);
},
From 6461c5e31f18fd1fa7352b95cb7bbf46567a94c8 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Thu, 30 Aug 2012 18:56:29 +0530
Subject: [PATCH 082/166] [FIX] account: rector js of account reconcilation
bzr revid: hmo@tinyerp.com-20120830132629-72mnqvtwespvik0b
---
.../src/js/account_move_reconciliation.js | 41 +++++++++----------
1 file changed, 19 insertions(+), 22 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 9b5aacf28bf..8196779fa1d 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -18,7 +18,7 @@ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
obj_from_view.template = 'ExtendedFormView';
view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
$.when(view_form, this.dataset_loaded).then(function() {
- obj_from_view.post_action();
+ obj_from_view.on_pager_action('first');
});
}
@@ -56,32 +56,20 @@ instance.account.extend_form_view = instance.web.FormView.extend({
result.result.flags = result.result.flags || {};
result.result.flags.new_window = true;
self.do_action(result.result, function () {
- self.post_action();
+ self.dataset.read_slice().done(function(){
+ self.on_pager_action('next');
+ });
});
});
},
- post_action: function(){
- // hide if not records otherwise go next record
- var self = this;
- var viewmanager = this.getParent();
- this.dataset.read_slice().done(function(){
- if (_.isEmpty(self.dataset.ids)){
- viewmanager.action.context.next_partner_only = true;
- /*self.$el.hide();
- viewmanager.action.context.next_partner_only = false;
- viewmanager.searchview.do_search();*/
- }
- else{
- self.on_pager_action('first');
- }
- });
- },
-
+
do_nothing_to_reconcile:function(){
var self = this;
this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
- self.post_action();
+ self.dataset.read_slice().done(function(){
+ self.on_pager_action('next');
+ });
});
},
@@ -97,12 +85,21 @@ instance.account.extend_form_view = instance.web.FormView.extend({
on_pager_action: function(action) {
var self = this
var viewmanager = self.getParent();
+ viewmanager.action.context.next_partner_only = true;
+ //TODO: if no records, than it's not working, it giving error
+ if (this.dataset.ids.length == 0){
+ self.dataset.index = null;
+ viewmanager.action.context.partner_id = [];
+ viewmanager.searchview.do_search();
+ self.reload();
+ return
+ }
+
$.when(this._super(action)).then(function() {
var id = self.get_fields_values().partner_id;
- viewmanager.action.context.next_partner_only = true;
viewmanager.action.context.partner_id = [id];
viewmanager.searchview.do_search();
- })
+ });
},
})
From f577f5b990622d6713cbbcc646f9245307402e53 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Fri, 31 Aug 2012 14:12:24 +0530
Subject: [PATCH 083/166] [FIX] account_followup: fix function of followup
level
bzr revid: hmo@tinyerp.com-20120831084224-y42jdzjf9arz54fh
---
addons/account_followup/account_move_reconciliation.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/account_followup/account_move_reconciliation.py b/addons/account_followup/account_move_reconciliation.py
index 00ae40f3aa8..01338ddb6eb 100644
--- a/addons/account_followup/account_move_reconciliation.py
+++ b/addons/account_followup/account_move_reconciliation.py
@@ -30,7 +30,7 @@ class account_move_reconciliation(osv.osv):
for rec in self.browse(cr, uid, ids, context=context):
move_line_ids = move_obj.search(cr, uid, [('partner_id','=',rec.partner_id.id),('followup_date','=',rec.followup_date)], context=context)
move_line = move_line_ids and move_obj.browse(cr, uid, move_line_ids[0], context=context) or False
- result[rec.id] = move_line and move_line.followup_line_id or False
+ result[rec.id] = move_line and move_line.followup_line_id.id or False
return result
_columns = {
From 432601cb7ec9f30629df0b290cccddf0a5a0c1ef Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 5 Sep 2012 13:21:20 +0530
Subject: [PATCH 084/166] [FIX] account: reconciliation form , set false if not
data
bzr revid: hmo@tinyerp.com-20120905075120-kcf31riknnaha8v0
---
.../src/js/account_move_reconciliation.js | 22 ++++++++++---------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 8196779fa1d..3d046f99312 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -86,20 +86,22 @@ instance.account.extend_form_view = instance.web.FormView.extend({
var self = this
var viewmanager = self.getParent();
viewmanager.action.context.next_partner_only = true;
- //TODO: if no records, than it's not working, it giving error
if (this.dataset.ids.length == 0){
- self.dataset.index = null;
+ self.datarecord = {}
viewmanager.action.context.partner_id = [];
viewmanager.searchview.do_search();
- self.reload();
- return
+ _(this.fields).each(function (field, f) {
+ field.set_value(self.datarecord[f] || false);
+ });
+ self.do_update_pager();
+ }
+ else{
+ $.when(this._super(action)).then(function() {
+ var id = self.get_fields_values().partner_id;
+ viewmanager.action.context.partner_id = [id];
+ viewmanager.searchview.do_search();
+ });
}
-
- $.when(this._super(action)).then(function() {
- var id = self.get_fields_values().partner_id;
- viewmanager.action.context.partner_id = [id];
- viewmanager.searchview.do_search();
- });
},
})
From ef06a2d41a1e7a4c5e8c0269d60abacf69fb917d Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 5 Sep 2012 13:28:20 +0530
Subject: [PATCH 085/166] [REF] account: account reconciliation JS
bzr revid: hmo@tinyerp.com-20120905075820-1uu55c972rmdhpjb
---
.../static/src/js/account_move_reconciliation.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 3d046f99312..680eca18374 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -81,25 +81,28 @@ instance.account.extend_form_view = instance.web.FormView.extend({
this.$el.find('span.oe_pager_index_extend').html(index).end()
.find('span.oe_pager_count_extend').html(this.dataset.ids.length);
},
+
+ do_search_move_line: function(partner_ids){
+ var viewmanager = this.getParent();
+ viewmanager.action.context.next_partner_only = true;
+ viewmanager.action.context.partner_id = partner_ids;
+ viewmanager.searchview.do_search();
+ },
on_pager_action: function(action) {
var self = this
- var viewmanager = self.getParent();
- viewmanager.action.context.next_partner_only = true;
if (this.dataset.ids.length == 0){
self.datarecord = {}
- viewmanager.action.context.partner_id = [];
- viewmanager.searchview.do_search();
_(this.fields).each(function (field, f) {
field.set_value(self.datarecord[f] || false);
});
self.do_update_pager();
+ self.do_search_move_line([]);
}
else{
$.when(this._super(action)).then(function() {
var id = self.get_fields_values().partner_id;
- viewmanager.action.context.partner_id = [id];
- viewmanager.searchview.do_search();
+ self.do_search_move_line([id]);
});
}
},
From 031ccce1504e3d058a1855551543cfc6b724d2f9 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 5 Sep 2012 13:41:42 +0530
Subject: [PATCH 086/166] [FIX] account: account reconciliation JS, return
false if not datarecord on click on reconciliation, nothing reconciliation
buttons
bzr revid: hmo@tinyerp.com-20120905081142-6zdw8cs919v0l0j8
---
.../account/static/src/js/account_move_reconciliation.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 680eca18374..88b263038b4 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -36,6 +36,9 @@ instance.account.extend_form_view = instance.web.FormView.extend({
},
do_reconcilation:function(event){
var self = this
+ if (!self.datarecord.id){
+ return false;
+ }
var list_view = this.getParent().views['list'].controller
ids = list_view.get_selected_ids()
if (ids.length == 0) {
@@ -66,6 +69,9 @@ instance.account.extend_form_view = instance.web.FormView.extend({
do_nothing_to_reconcile:function(){
var self = this;
+ if (!self.datarecord.id){
+ return false;
+ }
this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
self.dataset.read_slice().done(function(){
self.on_pager_action('next');
@@ -91,6 +97,7 @@ instance.account.extend_form_view = instance.web.FormView.extend({
on_pager_action: function(action) {
var self = this
+
if (this.dataset.ids.length == 0){
self.datarecord = {}
_(this.fields).each(function (field, f) {
From c1cbb42b0a917ccd565138f67c6f2fef3a15f8d1 Mon Sep 17 00:00:00 2001
From: "Harry (OpenERP)"
Date: Wed, 5 Sep 2012 18:46:38 +0530
Subject: [PATCH 087/166] [FIX] account_voucher: open payment entry for bank
statement
bzr revid: hmo@tinyerp.com-20120905131638-6nwbwe3acaw0n1nn
---
addons/account_voucher/account_voucher.py | 60 ++++++++-----------
.../account_voucher/account_voucher_view.xml | 4 --
2 files changed, 24 insertions(+), 40 deletions(-)
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 91dfdfcf420..cb2e93705bb 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -334,9 +334,15 @@ class account_voucher(osv.osv):
}
def create(self, cr, uid, vals, context=None):
- voucher = super(account_voucher, self).create(cr, uid, vals, context=context)
- self.create_send_note(cr, uid, [voucher], context=context)
- return voucher
+ if context is None:
+ context = {}
+ bank_line_id = context.get('bank_statement_line_id', False)
+ bank_line_obj = self.pool.get("account.bank.statement.line")
+ voucher_id = super(account_voucher, self).create(cr, uid, vals, context=context)
+ if bank_line_id:
+ bank_line_obj.write(cr, uid, bank_line_id, {'voucher_id': voucher_id})
+ self.create_send_note(cr, uid, [voucher_id], context=context)
+ return voucher_id
def compute_tax(self, cr, uid, ids, context=None):
tax_pool = self.pool.get('account.tax')
@@ -1496,49 +1502,31 @@ class account_bank_statement_line(osv.osv):
_inherit = 'account.bank.statement.line'
def action_payment_reconcile(self, cr, uid, ids, context=None):
+ if context is None:
+ context = {}
+ ctx = dict(context)
statement_id = ids[0]
statement = self.browse(cr, uid, statement_id, context=context)
+ ctx['bank_statement_line_id'] = statement.id
+ ctx.update({
+ 'line_type': statement.type,
+ 'type': statement.amount > 0 and 'payment' or 'receipt',
+ 'partner_id': statement.partner_id and statement.partner_id.id or False,
+ 'journal_id': statement.statement_id.journal_id and statement.statement_id.journal_id.id or False,
+ 'amount': abs(statement.amount),
+ 'reference': statement.ref,
+ 'date': statement.date,
+ 'name': statement.name
+ })
voucher = statement.voucher_id or False
voucher_id = voucher and voucher.id or False
- if not voucher:
- voucher_obj = self.pool.get('account.voucher')
- sign = 1
- type = 'general'
- ttype = statement.amount < 0 and 'payment' or 'receipt'
- if statement.journal_id.type in ('sale', 'sale_refund'):
- type = 'customer'
- ttype = 'receipt'
- elif statement.journal_id.type in ('purchase', 'purhcase_refund'):
- type = 'supplier'
- ttype = 'payment'
- sign = -1
-
- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=statement.partner_id.id, journal_id=statement.journal_id.id, amount=sign*statement.amount, currency_id= False, ttype=ttype, date=statement.date, context=context)
- voucher_res = { 'type': ttype,
- 'name': statement.name,
- 'partner_id': statement.partner_id.id,
- 'journal_id': statement.journal_id.id,
- 'account_id': result.get('account_id', statement.journal_id.default_credit_account_id.id),
- 'company_id': statement.company_id.id,
- 'date': statement.date,
- 'amount': sign*statement.amount,
- }
- voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
- self.write(cr, uid, statement_id, {'voucher_id':voucher_id}, context=context)
- mod_obj = self.pool.get('ir.model.data')
- if voucher and voucher.type == 'customer':
- res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_receipt_form')
- else:
- res = mod_obj.get_object_reference(cr, uid, 'account_voucher', 'view_vendor_payment_form')
- view_id = res and res[1] or False
return {
'name': _('Payment Entry'),
'res_model': 'account.voucher',
'view_type': 'form',
'view_mode': 'form',
'target':'new',
- 'view_id':view_id,
- 'context': context,
+ 'context': ctx,
'res_id':voucher_id,
'type': 'ir.actions.act_window'
}
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index 47a326e4f96..5577dceec82 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -213,10 +213,6 @@
-
From eb28892a3a947fd683f5bb240f593651831497d2 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sun, 9 Sep 2012 15:41:56 +0530
Subject: [PATCH 088/166] [IMP]: MOVE PROCUREMENT CHANGES INTO PROCUREMENT..
bzr revid: atp@tinyerp.com-20120909101156-9pna66qbx28px2ii
---
addons/procurement/__openerp__.py | 12 +-
addons/sale/__openerp__.py | 18 +--
addons/sale/report/sale_report.py | 4 +-
addons/sale/res_config.py | 20 +---
addons/sale/res_config_view.xml | 16 +--
addons/sale/sale.py | 106 +++++++++++-------
addons/sale/sale_data.xml | 18 +--
addons/sale/sale_demo.xml | 42 ++++++-
addons/sale/sale_unit_test.xml | 4 +-
addons/sale/sale_view.xml | 56 +++++----
addons/sale/sale_workflow.xml | 7 +-
addons/sale/security/ir.model.access.csv | 2 +-
addons/sale/security/sale_security.xml | 4 +-
addons/sale/test/cancel_order.yml | 20 +++-
addons/sale/test/delete_order.yml | 2 +-
addons/sale/test/edi_sale_order.yml | 22 ++--
.../test/manual_order_policy.yml | 36 +++---
addons/sale/wizard/__init__.py | 3 +-
addons/sale_analytic_plans/__openerp__.py | 5 +-
.../sale_analytic_plans_view.xml | 5 +
addons/sale_crm/__openerp__.py | 16 +--
addons/sale_crm/wizard/crm_make_sale.py | 2 +-
addons/sale_journal/__openerp__.py | 12 +-
addons/sale_margin/__openerp__.py | 24 ++--
addons/sale_margin/test/sale_margin.yml | 2 +-
addons/sale_mrp/__openerp__.py | 5 +-
addons/sale_order_dates/__openerp__.py | 15 +--
addons/sale_stock/__openerp__.py | 14 +--
addons/sale_stock/res_config.py | 10 +-
addons/sale_stock/res_config_view.xml | 23 ++--
addons/sale_stock/sale_stock.py | 105 ++++++++---------
addons/sale_stock/sale_stock_data.xml | 6 +
addons/sale_stock/sale_stock_demo.xml | 27 ++---
addons/sale_stock/sale_stock_view.xml | 41 ++++---
addons/sale_stock/sale_stock_workflow.xml | 9 +-
.../test/prepaid_order_policy.yml | 6 +-
.../wizard/sale_make_invoice_advance.xml | 3 +
37 files changed, 390 insertions(+), 332 deletions(-)
rename addons/{sale_stock => sale}/test/manual_order_policy.yml (74%)
rename addons/{sale => sale_stock}/test/prepaid_order_policy.yml (62%)
diff --git a/addons/procurement/__openerp__.py b/addons/procurement/__openerp__.py
index f401b42c596..7dc9ddba08c 100644
--- a/addons/procurement/__openerp__.py
+++ b/addons/procurement/__openerp__.py
@@ -26,8 +26,9 @@
"author" : "OpenERP SA",
"website" : "http://www.openerp.com",
"category" : "Hidden/Dependency",
- "depends" : ["base","process", "product", "stock"],
+ "depends" : ["process", "product", "stock"],
"description": """
+
This is the module for computing Procurements.
==============================================
@@ -43,8 +44,7 @@ for the product which needs replenishment. This procurement will start a
task, either a purchase order form for the supplier, or a production order
depending on the product's configuration.
""",
- 'init_xml': [],
- 'update_xml': [
+ 'data': [
'security/ir.model.access.csv',
'security/procurement_security.xml',
'procurement_data.xml',
@@ -55,13 +55,13 @@ depending on the product's configuration.
'procurement_view.xml',
'procurement_workflow.xml',
'process/procurement_process.xml',
- "company_view.xml",
+ 'company_view.xml',
'board_mrp_procurement_view.xml',
],
- 'demo_xml': ['stock_orderpoint.xml'],
+ 'demo': ['stock_orderpoint.xml'],
'test': ['test/procurement.yml'],
'installable': True,
- 'auto_install': False,
+ 'auto_install': True,
'certificate': '00954248826881074509',
'images': ['images/compute_schedulers.jpeg','images/config_companies_sched.jpeg', 'images/minimum_stock_rules.jpeg'],
}
diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py
index 95f92309577..b6067ff6c71 100644
--- a/addons/sale/__openerp__.py
+++ b/addons/sale/__openerp__.py
@@ -23,15 +23,15 @@
'name': 'Sales Management',
'version': '1.0',
'category': 'Sales Management',
- "sequence": 14,
- "summary": "Quotations, Sale Orders, Invoicing",
+ 'sequence': 14,
+ 'summary': 'Quotations, Sale Orders, Invoicing',
'description': """
The base module to manage quotations and sales orders.
======================================================
Workflow with validation steps:
-------------------------------
- * Quotation -> Sales order -> Invoice
+ * **Quotation** -> **Sales order** -> **Invoice**
Create Invoice:
---------------
@@ -51,9 +51,11 @@ Dashboard for Sales Manager that includes:
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': ['images/deliveries_to_invoice.jpeg','images/sale_dashboard.jpeg','images/Sale_order_line_to_invoice.jpeg','images/sale_order.jpeg','images/sales_analysis.jpeg'],
- 'depends': ['board', 'account_voucher'],
- 'init_xml': [],
- 'update_xml': ['wizard/sale_line_invoice.xml',
+ 'depends': ['account_voucher'],
+ 'data': [
+ 'wizard/sale_make_invoice_advance.xml',
+ 'wizard/sale_line_invoice.xml',
+ 'wizard/sale_make_invoice.xml',
'security/sale_security.xml',
'security/ir.model.access.csv',
'sale_workflow.xml',
@@ -68,10 +70,10 @@ Dashboard for Sales Manager that includes:
'edi/sale_order_action_data.xml',
'res_config_view.xml',
],
- 'demo_xml': ['sale_demo.xml'],
+ 'demo': ['sale_demo.xml'],
'test': [
'test/sale_order_demo.yml',
- 'test/prepaid_order_policy.yml',
+ 'test/manual_order_policy.yml',
'test/cancel_order.yml',
'test/delete_order.yml',
'test/edi_sale_order.yml',
diff --git a/addons/sale/report/sale_report.py b/addons/sale/report/sale_report.py
index 0062ca4313c..54d5d9f278e 100644
--- a/addons/sale/report/sale_report.py
+++ b/addons/sale/report/sale_report.py
@@ -79,7 +79,7 @@ class sale_report(osv.osv):
s.partner_id as partner_id,
s.user_id as user_id,
s.shop_id as shop_id,
- s.company_id as company_id,
+ s.company_id as company_id,
extract(epoch from avg(date_trunc('day',s.date_confirm)-date_trunc('day',s.create_date)))/(24*60*60)::decimal(16,2) as delay,
s.state,
t.categ_id as categ_id,
@@ -103,7 +103,7 @@ class sale_report(osv.osv):
s.partner_id,
s.user_id,
s.shop_id,
- s.company_id,
+ s.company_id,
s.state,
s.pricelist_id,
s.project_id
diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py
index 150034dcf51..9ee28464145 100644
--- a/addons/sale/res_config.py
+++ b/addons/sale/res_config.py
@@ -27,9 +27,6 @@ class sale_configuration(osv.osv_memory):
_inherit = 'sale.config.settings'
_columns = {
- 'group_invoice_so_lines': fields.boolean('generate invoices based on the sale order',
- implied_group='sale.group_invoice_so_lines',
- help="To allow your salesman to make invoices for sale order lines using the menu 'Lines to Invoice'."),
'timesheet': fields.boolean('prepare invoices based on timesheets',
help = """For modifying account analytic view to show important data to project manager of services companies.
You can also view the report of account analytic summary user-wise as well as month wise.
@@ -40,11 +37,7 @@ class sale_configuration(osv.osv_memory):
(650€/day for a developer), the duration (one year support contract).
You will be able to follow the progress of the contract and invoice automatically.
It installs the account_analytic_analysis module."""),
- 'default_order_policy': fields.selection(
- [('manual', 'Invoice Based on Sales Orders')],
- 'The default invoicing method is', default_model='sale.order',
- help="You can generate invoices based on sales orders."),
- 'time_unit': fields.many2one('product.uom', 'The default working time unit for services is'),
+ 'time_unit': fields.many2one('product.uom', 'the default working time unit for services is'),
'group_sale_pricelist':fields.boolean("use pricelists to adapt your price per customers",
implied_group='product.group_sale_pricelist',
help="""Allows to manage different prices based on rules per category of customers.
@@ -76,6 +69,8 @@ class sale_configuration(osv.osv_memory):
But the possibility to change these values is still available.
This installs the module analytic_user_function."""),
'module_project': fields.boolean("Project"),
+ 'module_sale_stock': fields.boolean("Sale and Warehouse Management",
+ help="""Allows you to Make Quotation, Sale Order using different Order policy and Manage Related Stock """),
}
def default_get(self, cr, uid, fields, context=None):
@@ -94,11 +89,9 @@ class sale_configuration(osv.osv_memory):
return ids and ids[0] or False
_defaults = {
- 'default_order_policy': 'manual',
'time_unit': _get_default_time_unit,
}
-
def set_sale_defaults(self, cr, uid, ids, context=None):
ir_model_data = self.pool.get('ir.model.data')
wizard = self.browse(cr, uid, ids)[0]
@@ -110,12 +103,7 @@ class sale_configuration(osv.osv_memory):
if wizard.module_project and wizard.time_unit:
user = self.pool.get('res.users').browse(cr, uid, uid, context)
user.company_id.write({'project_time_mode_id': wizard.time_unit.id})
-
- return {}
-
- def onchange_invoice_methods(self, cr, uid, ids, group_invoice_so_lines, context=None):
- if group_invoice_so_lines:
- return {'value': {'default_order_policy': 'manual'}}
+
return {}
def onchange_task_work(self, cr, uid, ids, task_work, context=None):
diff --git a/addons/sale/res_config_view.xml b/addons/sale/res_config_view.xml
index 0b0cf9bc6aa..5b27ee554ee 100644
--- a/addons/sale/res_config_view.xml
+++ b/addons/sale/res_config_view.xml
@@ -11,23 +11,15 @@
-
-
-
-
-
-
+
-
-
-
-
@@ -53,6 +45,10 @@
+
+
+
+
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index d5410d5f1c1..de25012dcf9 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -47,7 +47,7 @@ sale_shop()
class sale_order(osv.osv):
_name = "sale.order"
- _inherit = ['ir.needaction_mixin', 'mail.thread']
+ _inherit = ['mail.thread', 'ir.needaction_mixin']
_description = "Sales Order"
def copy(self, cr, uid, id, default=None, context=None):
@@ -157,8 +157,9 @@ class sale_order(osv.osv):
_columns = {
'name': fields.char('Order Reference', size=64, required=True,
readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True),
- 'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
+ 'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
'origin': fields.char('Source Document', size=64, help="Reference of the document that generated this sales order request."),
+
'client_order_ref': fields.char('Customer Reference', size=64),
'state': fields.selection([
('draft', 'Draft Quotation'),
@@ -166,6 +167,7 @@ class sale_order(osv.osv):
('cancel', 'Cancelled'),
('waiting_date', 'Waiting Schedule'),
('progress', 'Sale Order'),
+ ('manual', 'Sale to Invoice'),
('invoice_except', 'Invoice Exception'),
('done', 'Done'),
], 'Status', readonly=True, help="Gives the state of the quotation or sales order. \nThe exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception). \nThe 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the order date.", select=True),
@@ -177,7 +179,7 @@ class sale_order(osv.osv):
'partner_invoice_id': fields.many2one('res.partner', 'Invoice Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Invoice address for current sales order."),
'partner_shipping_id': fields.many2one('res.partner', 'Shipping Address', readonly=True, required=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, help="Shipping address for current sales order."),
'order_policy': fields.selection([
- ('prepaid', 'Before Delivery'),
+ ('manual', 'On Demand'),
], 'Create Invoice', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
help="""This field controls how invoice and delivery operations are synchronized.
- With 'Before Delivery', a draft invoice is created, and it must be paid before delivery."""),
@@ -217,7 +219,7 @@ class sale_order(osv.osv):
}
_defaults = {
'date_order': fields.date.context_today,
- 'order_policy': 'prepaid',
+ 'order_policy': 'manual',
'state': 'draft',
'user_id': lambda obj, cr, uid, context: uid,
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'sale.order'),
@@ -242,17 +244,6 @@ class sale_order(osv.osv):
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
- def onchange_shop_id(self, cr, uid, ids, shop_id):
- v = {}
- if shop_id:
- shop = self.pool.get('sale.shop').browse(cr, uid, shop_id)
- v['project_id'] = shop.project_id.id
- # Que faire si le client a une pricelist a lui ?
- if shop.pricelist_id.id:
- v['pricelist_id'] = shop.pricelist_id.id
- return {'value': v}
-
-
def onchange_pricelist_id(self, cr, uid, ids, pricelist_id, order_lines, context={}):
if (not pricelist_id) or (not order_lines):
return {}
@@ -317,7 +308,6 @@ class sale_order(osv.osv):
if not journal_ids:
raise osv.except_osv(_('Error!'),
_('Please define sales journal for this company: "%s" (id:%d).') % (order.company_id.name, order.company_id.id))
-
invoice_vals = {
'name': order.client_order_ref or '',
'origin': order.name,
@@ -333,12 +323,12 @@ class sale_order(osv.osv):
'fiscal_position': order.fiscal_position.id or order.partner_id.property_account_position.id,
'date_invoice': context.get('date_invoice', False),
'company_id': order.company_id.id,
- 'user_id': order.user_id and order.user_id.id or False
+ 'user_id': order.user_id and order.user_id.id or False,
+
}
# Care for deprecated _inv_get() hook - FIXME: to be removed after 6.1
invoice_vals.update(self._inv_get(cr, uid, order, context=context))
-
return invoice_vals
def _make_invoice(self, cr, uid, order, lines, context=None):
@@ -414,6 +404,37 @@ class sale_order(osv.osv):
result.update(view_id = res and res[1] or False)
return result
+ def manual_invoice(self, cr, uid, ids, context=None):
+ """ create invoices for the given sale orders (ids), and open the form
+ view of one of the newly created invoices
+ """
+ mod_obj = self.pool.get('ir.model.data')
+ wf_service = netsvc.LocalService("workflow")
+
+ # create invoices through the sale orders' workflow
+ inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
+ for id in ids:
+ wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
+ inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
+ # determine newly created invoices
+ new_inv_ids = list(inv_ids1 - inv_ids0)
+
+ res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
+ res_id = res and res[1] or False,
+
+ return {
+ 'name': _('Customer Invoices'),
+ 'view_type': 'form',
+ 'view_mode': 'form',
+ 'view_id': [res_id],
+ 'res_model': 'account.invoice',
+ 'context': "{'type':'out_invoice'}",
+ 'type': 'ir.actions.act_window',
+ 'nodestroy': True,
+ 'target': 'current',
+ 'res_id': new_inv_ids and new_inv_ids[0] or False,
+ }
+
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
res = False
invoices = {}
@@ -517,6 +538,7 @@ class sale_order(osv.osv):
#
if order.state == 'invoice_except':
self.write(cr, uid, [order.id], {'state': 'progress'}, context=context)
+ self.invoice_paid_send_note(cr, uid, [order.id], context=context)
return True
def action_cancel(self, cr, uid, ids, context=None):
@@ -563,7 +585,7 @@ class sale_order(osv.osv):
for o in self.browse(cr, uid, ids):
if not o.order_line:
raise osv.except_osv(_('Error !'),_('You cannot confirm a sale order which has no line.'))
- self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
+ self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
self.confirm_send_note(cr, uid, ids, context)
return True
@@ -591,37 +613,42 @@ class sale_order(osv.osv):
'context': ctx,
'nodestroy': True,
}
-
+
+ def action_done(self, cr, uid, ids, context=None):
+ self.done_send_note(cr, uid, ids, context=context)
+ return self.write(cr, uid, ids, {'state': 'done'}, context=context)
+
# ------------------------------------------------
# OpenChatter methods and notifications
# ------------------------------------------------
- def get_needaction_user_ids(self, cr, uid, ids, context=None):
- result = super(sale_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
- for obj in self.browse(cr, uid, ids, context=context):
- if (obj.state == 'progress'):
- result[obj.id].append(obj.user_id.id)
- return result
+ def needaction_domain_get(self, cr, uid, ids, context=None):
+ return [('state', '=', 'draft'), ('user_id','=',uid)]
def create_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_append_note(cr, uid, [obj.id], body=_("Quotation for %s has been created .") % (obj.partner_id.name), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("Quotation for %s created .") % (obj.partner_id.name), context=context)
def confirm_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_append_note(cr, uid, [obj.id], body=_("Quotation for %s converted to Sale Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("Quotation for %s converted to Sale Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), context=context)
def cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
self.message_append_note(cr, uid, [obj.id], body=_("Sale Order for %s cancelled .") % (obj.partner_id.name), context=context)
+
+ def done_send_note(self, cr, uid, ids, context=None):
+ for obj in self.browse(cr, uid, ids, context=context):
+ self.message_append_note(cr, uid, [obj.id], body=_("Sale Order for %s has been done ") % (obj.partner_id.name), context=context)
+
def invoice_paid_send_note(self, cr, uid, ids, context=None):
- self.message_append_note(cr, uid, ids, body=_("Invoice paid ."), context=context)
+ self.message_append_note(cr, uid, ids, body=_("Invoice has been paid ."), context=context)
def invoice_send_note(self, cr, uid, ids, invoice_id, context=None):
for order in self.browse(cr, uid, ids, context=context):
for invoice in (inv for inv in order.invoice_ids if inv.id == invoice_id):
self.message_append_note(cr, uid, [order.id], body=_("Draft Invoice of %s %s waiting for validation .") % (invoice.amount_total, invoice.currency_id.symbol), context=context)
-
+
sale_order()
# TODO add a field price_unit_uos
@@ -642,8 +669,6 @@ class sale_order_line(osv.osv):
res[line.id] = cur_obj.round(cr, uid, cur, taxes['total'])
return res
-
-
def _get_uom_id(self, cr, uid, *args):
try:
proxy = self.pool.get('ir.model.data')
@@ -679,7 +704,8 @@ class sale_order_line(osv.osv):
\n* The \'Cancelled\' state is set when a user cancel the sales order related.'),
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', store=True, string='Customer'),
'salesman_id':fields.related('order_id', 'user_id', type='many2one', relation='res.users', store=True, string='Salesperson'),
- 'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
+ 'company_id': fields.related('order_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True),
+
}
_order = 'sequence, id'
_defaults = {
@@ -704,7 +730,7 @@ class sale_order_line(osv.osv):
(this is used for returning products including service)
:return: dict of values to create() the invoice line
"""
-
+ res = {}
def _get_line_qty(line):
if (line.order_id.invoice_quantity=='order'):
if line.product_uos:
@@ -716,7 +742,6 @@ class sale_order_line(osv.osv):
if line.product_uos:
return line.product_uos.id
return line.product_uom.id
-
if not line.invoiced:
if not account_id:
if line.product_id:
@@ -743,7 +768,7 @@ class sale_order_line(osv.osv):
if not account_id:
raise osv.except_osv(_('Error!'),
_('There is no Fiscal Position defined or Income category account defined for default properties of Product categories.'))
- return {
+ res = {
'name': line.name,
'origin': line.order_id.name,
'account_id': account_id,
@@ -756,7 +781,7 @@ class sale_order_line(osv.osv):
'account_analytic_id': line.order_id.project_id and line.order_id.project_id.id or False,
}
- return False
+ return res
def invoice_line_create(self, cr, uid, ids, context=None):
if context is None:
@@ -842,10 +867,9 @@ class sale_order_line(osv.osv):
'product_uos': []}}
if not date_order:
date_order = time.strftime(DEFAULT_SERVER_DATE_FORMAT)
-
- res = {}
- result = res
- warning_msgs = res.get('warning') and res['warning']['message'] or ''
+#
+ result = {}
+ warning_msgs = {}
product_obj = product_obj.browse(cr, uid, product, context=context)
uom2 = False
diff --git a/addons/sale/sale_data.xml b/addons/sale/sale_data.xml
index e67ed6df7d0..4b6649ab43e 100644
--- a/addons/sale/sale_data.xml
+++ b/addons/sale/sale_data.xml
@@ -39,14 +39,16 @@
-
-
-
-
- The Sales Management application has been installed.
- This modules allows you to create and send easily quotations and process your sales orders; from the delivery to the invoicing.
-If you need to manage your sales pipeline (leads, opportunities, phonecalls), you can install the module <i>CRM</i> from the top menu Settings.
-
+
+
+ mail.group
+
+ notification
+ Sales Management application installed!
+ This application lets you create and send quotations and process your sales orders; from delivery to invoicing.
+
+If you need to manage your sales pipeline (leads, opportunities, phonecalls), the <i>CRM</i> application may be useful. Use the Settings menu to install it.
+
diff --git a/addons/sale/sale_demo.xml b/addons/sale/sale_demo.xml
index 2a1878a78c3..4c2ad474123 100644
--- a/addons/sale/sale_demo.xml
+++ b/addons/sale/sale_demo.xml
@@ -9,7 +9,6 @@
- prepaid
@@ -49,6 +48,7 @@
+ manual
@@ -78,6 +78,7 @@
+ manual
@@ -107,7 +108,6 @@
- prepaid
@@ -212,9 +212,9 @@
-
+ manual
@@ -264,6 +264,7 @@
+ manual
@@ -285,10 +286,41 @@
12.50
-
+
-
+
+
+ sale.order
+
+ Hi,
+I have a confusion for pricing of Services, I have heard there is a discount above 25 hours.
+Can you clarify please?
+ comment
+
+
+
+
+ sale.order
+
+
+ Hello,
+Sorry but that scheme is not available for now,
+We would like to know if you confirm the quotation with pricing we sent to you.
+Thanks,
+Sales Department
+ comment
+
+
+
+
+ sale.order
+
+
+ Ok, fine, we will intimate you after discussing with our team.
+ comment
+
+
diff --git a/addons/sale/sale_unit_test.xml b/addons/sale/sale_unit_test.xml
index e2a930146a7..18a59320d9c 100644
--- a/addons/sale/sale_unit_test.xml
+++ b/addons/sale/sale_unit_test.xml
@@ -13,7 +13,7 @@
- [PC1] Basic PC
+ [PCSC234] PC Assemble SC234
450
@@ -23,7 +23,7 @@
- [RAM512] DDR 512MB PC400
+ [HDD-SH2] HDD SH-2
90
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 68e3344c2e6..6bc0f2f7f9d 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -1,7 +1,6 @@
-
@@ -130,8 +128,8 @@
sale.order
2
-
-
+
+
@@ -152,18 +150,21 @@
-
-
-
-
+
+
+
+
+
-
+
+
+
-
+
@@ -180,7 +181,7 @@
-
+
@@ -237,25 +238,26 @@
+
-
-
+
-
-
-
+
+
+
+
@@ -278,7 +280,7 @@
-
+
@@ -319,13 +321,27 @@
+
+
+ sale.order.form.editable.list
+ sale.order
+
+
+
+
+
+
+
+
+
sale.order.list.select
sale.order
-
+
diff --git a/addons/sale/sale_workflow.xml b/addons/sale/sale_workflow.xml
index 5e032eab8c6..41684e519cd 100644
--- a/addons/sale/sale_workflow.xml
+++ b/addons/sale/sale_workflow.xml
@@ -39,7 +39,7 @@
done
True
function
- write({'state':'done'})
+ action_done()
AND
@@ -135,10 +135,10 @@
cancel
-
+
- (order_policy=='prepaid')
+ manual_invoice
@@ -146,6 +146,7 @@
subflow.paid
+
diff --git a/addons/sale/security/ir.model.access.csv b/addons/sale/security/ir.model.access.csv
index 4d00f8bb212..504aa76a233 100644
--- a/addons/sale/security/ir.model.access.csv
+++ b/addons/sale/security/ir.model.access.csv
@@ -1,6 +1,6 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_sale_shop,sale.shop,model_sale_shop,base.group_user,1,0,0,0
access_sale_order,sale.order,model_sale_order,base.group_sale_salesman,1,1,1,0
+access_sale_shop,sale.shop,model_sale_shop,base.group_user,1,0,0,0
access_sale_order_line,sale.order.line,model_sale_order_line,base.group_sale_salesman,1,1,1,1
access_sale_order_line_accountant,sale.order.line accountant,model_sale_order_line,account.group_account_user,1,1,0,0
access_account_invoice_tax_salesman,account_invoice_tax salesman,account.model_account_invoice_tax,base.group_sale_salesman,1,1,1,0
diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml
index 8b64b360435..6dd9492394c 100644
--- a/addons/sale/security/sale_security.xml
+++ b/addons/sale/security/sale_security.xml
@@ -51,7 +51,7 @@
-
+
@@ -73,7 +73,7 @@
['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]
-
+
diff --git a/addons/sale/test/cancel_order.yml b/addons/sale/test/cancel_order.yml
index 71f6d404516..2f0c1a61120 100644
--- a/addons/sale/test/cancel_order.yml
+++ b/addons/sale/test/cancel_order.yml
@@ -1,19 +1,31 @@
-
In order to test the cancel sale order.
- First I confirm order.
+ I confirm order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_8}
-
+
I check state of order in 'Sale Order'.
-
!assert {model: sale.order, id: sale_order_8, string: Sale order should be In Progress state}:
- - state == 'progress'
+ - state == 'manual'
-
- I check that Invoice should be created.
+ I check that Invoice should not be created.
-
!python {model: sale.order}: |
sale_order = self.browse(cr, uid, ref("sale_order_8"))
- assert len(sale_order.invoice_ids) == True, "Invoice should be created."
+ assert len(sale_order.invoice_ids) == False, "Invoice should not be created."
+
+-
+ I create advance invoice.
+-
+ !python {model: sale.advance.payment.inv}: |
+ ctx = context.copy()
+ ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_8")], "active_id":ref("sale.sale_order_8")})
+ order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale_order_line_20"), context=context)
+ pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
+ self.create_invoices(cr, uid, [pay_id], context=ctx)
+
-
To cancel the sale order from Invoice Exception, I have to cancel the invoice of sale order.
-
diff --git a/addons/sale/test/delete_order.yml b/addons/sale/test/delete_order.yml
index 751505237b6..3dbb2cb4033 100644
--- a/addons/sale/test/delete_order.yml
+++ b/addons/sale/test/delete_order.yml
@@ -10,5 +10,5 @@
I make duplicate order and delete.
-
!python {model: sale.order}: |
- id = self.copy(cr, uid, ref('sale_order_1'))
+ id = self.copy(cr, uid, ref('sale_order_2'))
self.unlink(cr, uid, [id])
diff --git a/addons/sale/test/edi_sale_order.yml b/addons/sale/test/edi_sale_order.yml
index 2469581e070..9245cf35520 100644
--- a/addons/sale/test/edi_sale_order.yml
+++ b/addons/sale/test/edi_sale_order.yml
@@ -11,13 +11,13 @@
product_uom_qty: 1.0
product_uom: 1
price_unit: 150.0
- name: 'Basic pc'
+ name: 'PC Assemble SC234'
order_line:
- product_id: product.product_product_5
product_uom_qty: 10.0
product_uom: 1
price_unit: 200.0
- name: 'Medium pc'
+ name: 'PC Assemble + Custom (PC on Demand)'
-
I confirm the sale order
-
@@ -72,10 +72,10 @@
"__model": "purchase.order.line",
"__import_module": "sale",
"__import_model": "sale.order.line",
- "name": "Basic PC",
+ "name": "PC Assemble SC234",
"date_planned": "2011-09-30",
"price_unit": 150.0,
- "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_3", "[PC1] Basic PC"],
+ "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_3", "[PCSC234] PC Assemble SC234"],
"product_qty": 1.0,
"product_uom": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_uom_unit", "Unit"],
},
@@ -85,10 +85,10 @@
"__model": "purchase.order.line",
"__import_module": "sale",
"__import_model": "sale.order.line",
- "name": "Medium PC",
+ "name": "PC on Demand",
"date_planned": "2011-09-15",
"price_unit": 100.0,
- "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_5", "[PC3] Medium PC"],
+ "product_id": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_product_5", "[PC-DEM] PC on Demand"],
"product_qty": 2.0,
"product_uom": ["product:5af1272e-dd26-11e0-b65e-701a04e25543.product_uom_unit", "Unit"],
}],
@@ -107,13 +107,15 @@
assert order_new.amount_untaxed == 350, "Untaxed amount is wrong"
assert len(order_new.order_line) == 2, "Sale order lines mismatch"
for sale_line in order_new.order_line:
- if sale_line.name == 'Basic PC':
- # assert sale_line.delay == 18 , "incorrect delay: got %s, expected 18"%(sale_line.delay,)
+
+ if sale_line.name == 'PC Assemble SC234':
+ #assert sale_line.delay == 18 , "incorrect delay: got %s, expected 18"%(sale_line.delay,)
assert sale_line.product_uom.name == "Unit" , "uom is not same"
assert sale_line.price_unit == 150 , "unit price is not same, got %s, expected 150"%(sale_line.price_unit,)
assert sale_line.product_uom_qty == 1 , "product qty is not same"
- elif sale_line.name == 'Medium PC':
- # assert sale_line.delay == 3 , "incorrect delay: got %s, expected 3"%(sale_line.delay,)
+
+ elif sale_line.name == 'PC on Demand':
+ #assert sale_line.delay == 3 , "incorrect delay: got %s, expected 3"%(sale_line.delay,)
assert sale_line.product_uom.name == "Unit" , "uom is not same"
assert sale_line.price_unit == 100 , "unit price is not same, got %s, expected 100"%(sale_line.price_unit,)
assert sale_line.product_uom_qty == 2 , "product qty is not same"
diff --git a/addons/sale_stock/test/manual_order_policy.yml b/addons/sale/test/manual_order_policy.yml
similarity index 74%
rename from addons/sale_stock/test/manual_order_policy.yml
rename to addons/sale/test/manual_order_policy.yml
index 4c200e0fa5f..731a723d068 100644
--- a/addons/sale_stock/test/manual_order_policy.yml
+++ b/addons/sale/test/manual_order_policy.yml
@@ -1,27 +1,27 @@
-
I confirm the Quotation with "Deliver & invoice on demand".
-
- !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_7}
+ !workflow {model: sale.order, action: order_confirm, ref: sale_order_7}
-
I check that Invoice should not created.
-
!python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("sale.sale_order_7"))
+ sale_order = self.browse(cr, uid, ref("sale_order_7"))
assert len(sale_order.invoice_ids) == False, "Invoice should not created."
-
I create advance invoice.
-
!python {model: sale.advance.payment.inv}: |
ctx = context.copy()
- ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.sale_order_7")], "active_id":ref("sale.sale_order_7")})
- order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale.sale_order_line_16"), context=context)
+ ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_7")], "active_id":ref("sale_order_7")})
+ order_line = self.pool.get('sale.order.line').browse(cr, uid, ref("sale_order_line_16"), context=context)
pay_id = self.create(cr, uid, {'advance_payment_method': 'fixed', 'product_id': order_line.product_id.id, 'amount': order_line.price_subtotal, 'qtty': order_line.product_uom_qty})
self.create_invoices(cr, uid, [pay_id], context=ctx)
-
I check Invoice which made advance
-
!python {model: sale.order}: |
- order = self.browse(cr, uid, ref('sale.sale_order_7'))
+ order = self.browse(cr, uid, ref('sale_order_7'))
assert order.invoice_ids, "Invoice should be created after make advance invoice."
-
I create manual Invoice for order.
@@ -31,7 +31,7 @@
-
!python {model: sale.make.invoice}: |
ctx = context.copy()
- ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.sale_order_7")], "active_id":ref("sale.sale_order_7")})
+ ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_7")], "active_id":ref("sale_order_7")})
self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context)
-
@@ -39,13 +39,13 @@
-
!python {model: sale.order.line.make.invoice}: |
ctx = context.copy()
- ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("sale.sale_order_line_17")], "active_id":ref("sale.sale_order_line_17")})
+ ctx.update({"active_model": 'sale.order.line', "active_ids": [ref("sale_order_line_17")], "active_id":ref("sale_order_line_17")})
self.make_invoices(cr, uid, [], context=ctx)
-
I check Invoice which made from sale order line.
-
!python {model: sale.order.line}: |
- line = self.browse(cr, uid, ref('sale.sale_order_line_17'))
+ line = self.browse(cr, uid, ref('sale_order_line_17'))
assert line.invoiced, "Line is not invoiced."
assert line.invoice_lines, "Invoice line should be created."
-
@@ -56,7 +56,7 @@
-
!python {model: sale.make.invoice}: |
ctx = context.copy()
- ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale.sale_order_7")], "active_id":ref("sale.sale_order_7")})
+ ctx = ctx.update({"active_model": 'sale.order', "active_ids": [ref("sale_order_7")], "active_id":ref("sale_order_7")})
self.make_invoices(cr, uid, [ref("sale_make_invoice_1")], context)
-
I open the Invoice.
@@ -64,7 +64,7 @@
!python {model: sale.order}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
- so = self.browse(cr, uid, ref("sale.sale_order_7"))
+ so = self.browse(cr, uid, ref("sale_order_7"))
for invoice in so.invoice_ids:
wf_service.trg_validate(uid, 'account.invoice', invoice.id, 'invoice_open', cr)
-
@@ -72,29 +72,19 @@
-
!python {model: account.invoice}: |
sale_order = self.pool.get('sale.order')
- order = sale_order.browse(cr, uid, ref("sale.sale_order_7"))
+ order = sale_order.browse(cr, uid, ref("sale_order_7"))
journal_ids = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', order.company_id.id)], limit=1)
for invoice in order.invoice_ids:
invoice.pay_and_reconcile(
invoice.amount_total, ref('account.cash'), ref('account.period_8'),
- journal_ids[0], ref('account.cash'),
+ journal_ids[0], ref('account.cash'),
ref('account.period_8'), journal_ids[0],
name='test')
-
I check Invoice after do manual.
-
!python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("sale.sale_order_7"))
+ sale_order = self.browse(cr, uid, ref("sale_order_7"))
assert sale_order.invoice_ids, "Invoice should be created."
assert sale_order.invoiced, "Order is not invoiced."
assert sale_order.state == 'manual', 'Order should be in Manual.'
-
--
- I set order policy "Deliver & invoice on demand" as default policy.
--
- !record {model: sale.config.settings, id: sale_configuration_0}:
- default_order_policy: 'manual'
--
- !python {model: sale.config.settings}: |
- self.execute(cr, uid, [ref("sale_configuration_0")], context=context)
-
diff --git a/addons/sale/wizard/__init__.py b/addons/sale/wizard/__init__.py
index f243b959526..79692a5d7be 100644
--- a/addons/sale/wizard/__init__.py
+++ b/addons/sale/wizard/__init__.py
@@ -19,5 +19,6 @@
#
##############################################################################
import sale_line_invoice
-
+import sale_make_invoice_advance
+import sale_make_invoice
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
diff --git a/addons/sale_analytic_plans/__openerp__.py b/addons/sale_analytic_plans/__openerp__.py
index 621d1e4876e..df33feae578 100644
--- a/addons/sale_analytic_plans/__openerp__.py
+++ b/addons/sale_analytic_plans/__openerp__.py
@@ -33,9 +33,8 @@ Using this module you will be able to link analytic accounts to sales orders.
'website': 'http://www.openerp.com',
'images': ['images/sale_order_analytic_account.jpeg', 'images/sales_order_line.jpeg'],
'depends': ['sale', 'account_analytic_plans'],
- 'init_xml': [],
- 'update_xml': ['sale_analytic_plans_view.xml'],
- 'demo_xml': [],
+ 'data': ['sale_analytic_plans_view.xml'],
+ 'demo': [],
'installable': True,
'auto_install': False,
'certificate': '0066055860861',
diff --git a/addons/sale_analytic_plans/sale_analytic_plans_view.xml b/addons/sale_analytic_plans/sale_analytic_plans_view.xml
index 6701ede5ae5..6c788866520 100644
--- a/addons/sale_analytic_plans/sale_analytic_plans_view.xml
+++ b/addons/sale_analytic_plans/sale_analytic_plans_view.xml
@@ -22,6 +22,11 @@
+
+
+
+
+
sale.order.line.form2.inherit
sale.order.line
diff --git a/addons/sale_crm/__openerp__.py b/addons/sale_crm/__openerp__.py
index f4137047fff..4846b61f624 100644
--- a/addons/sale_crm/__openerp__.py
+++ b/addons/sale_crm/__openerp__.py
@@ -38,14 +38,14 @@ modules.
'website': 'http://www.openerp.com',
'images': ['images/crm_statistics_dashboard.jpeg', 'images/opportunity_to_quote.jpeg'],
'depends': ['sale_stock', 'crm'],
- 'init_xml': [],
- 'update_xml': ['wizard/crm_make_sale_view.xml',
- 'sale_crm_view.xml',
- 'process/sale_crm_process.xml',
- 'security/sale_crm_security.xml',
- 'security/ir.model.access.csv'
- ],
- 'demo_xml': [],
+ 'data': [
+ 'wizard/crm_make_sale_view.xml',
+ 'sale_crm_view.xml',
+ 'process/sale_crm_process.xml',
+ 'security/sale_crm_security.xml',
+ 'security/ir.model.access.csv'
+ ],
+ 'demo': [],
'test': ['test/sale_crm.yml'],
'installable': True,
'auto_install': True,
diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py
index 6ca9ac8230f..2597c1db56c 100644
--- a/addons/sale_crm/wizard/crm_make_sale.py
+++ b/addons/sale_crm/wizard/crm_make_sale.py
@@ -106,7 +106,7 @@ class crm_make_sale(osv.osv_memory):
case_obj.write(cr, uid, [case.id], {'ref': 'sale.order,%s' % new_id})
new_ids.append(new_id)
message = _("Opportunity has been converted to the quotation %s .") % (sale_order.name)
- case.message_append_note(body=message)
+ case.message_post(body=message)
if make.close:
case_obj.case_close(cr, uid, data)
if not new_ids:
diff --git a/addons/sale_journal/__openerp__.py b/addons/sale_journal/__openerp__.py
index 6373cce1810..ee625b9c3a9 100644
--- a/addons/sale_journal/__openerp__.py
+++ b/addons/sale_journal/__openerp__.py
@@ -30,17 +30,19 @@ The sales journal modules allows you to categorise your sales and deliveries (pi
This module is very helpful for bigger companies that works by departments.
You can use journal for different purposes, some examples:
+----------------------------------------------------------
* isolate sales of different departments
* journals for deliveries by truck or by UPS
Journals have a responsible and evolves between different status:
+-----------------------------------------------------------------
* draft, open, cancel, done.
Batch operations can be processed on the different journals to confirm all sales
at once, to validate or invoice packing.
-It also supports batch invoicing methods that can be configured by partners and
-sales orders, examples:
+It also supports batch invoicing methods that can be configured by partners and sales orders, examples:
+-------------------------------------------------------------------------------------------------------
* daily invoicing
* monthly invoicing
@@ -50,12 +52,12 @@ Some statistics by journals are provided.
'website': 'http://www.openerp.com',
'images': ['images/invoice_type.jpeg'],
'depends': ['sale_stock'],
- 'init_xml': ['sale_journal_data.xml'],
- 'update_xml': [
+ 'data': [
'security/ir.model.access.csv',
'sale_journal_view.xml',
+ 'sale_journal_data.xml'
],
- 'demo_xml': ['sale_journal_demo.xml'],
+ 'demo': ['sale_journal_demo.xml'],
'test': [ ],
'installable': True,
'auto_install': False,
diff --git a/addons/sale_margin/__openerp__.py b/addons/sale_margin/__openerp__.py
index 4e622e71b33..6cacdcda7b4 100644
--- a/addons/sale_margin/__openerp__.py
+++ b/addons/sale_margin/__openerp__.py
@@ -19,25 +19,25 @@
##############################################################################
{
- "name": "Margins in Sales Orders",
- "version":"1.0",
- "category" : "Sales Management",
- "description": """
+ 'name': 'Margins in Sales Orders',
+ 'version':'1.0',
+ 'category' : 'Sales Management',
+ 'description': """
This module adds the 'Margin' on sales order.
=============================================
This gives the profitability by calculating the difference between the Unit
Price and Cost Price.
""",
- "author":"OpenERP SA",
- "images":["images/sale_margin.jpeg"],
- "depends":["sale_stock"],
- "demo_xml":[],
+ 'author':'OpenERP SA',
+ 'images':['images/sale_margin.jpeg'],
+ 'depends':['sale_stock'],
+ 'demo':[],
'test': ['test/sale_margin.yml'],
- "update_xml":["security/ir.model.access.csv","sale_margin_view.xml"],
- "auto_install": False,
- "installable": True,
- "certificate" : "001165700015525701661",
+ 'data':['security/ir.model.access.csv','sale_margin_view.xml'],
+ 'auto_install': False,
+ 'installable': True,
+ 'certificate' : '001165700015525701661',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale_margin/test/sale_margin.yml b/addons/sale_margin/test/sale_margin.yml
index 17f71807074..8038ea1aa5f 100644
--- a/addons/sale_margin/test/sale_margin.yml
+++ b/addons/sale_margin/test/sale_margin.yml
@@ -9,7 +9,7 @@
invoice_quantity: order
name: Test_SO011
order_line:
- - name: '[KEYA] Keyboard - AZERTY'
+ - name: '[CARD] Graphics Card'
price_unit: 7.0
product_uom: product.product_uom_unit
product_uom_qty: 100.0
diff --git a/addons/sale_mrp/__openerp__.py b/addons/sale_mrp/__openerp__.py
index b1aed2c67b5..c93fdcc91fd 100644
--- a/addons/sale_mrp/__openerp__.py
+++ b/addons/sale_mrp/__openerp__.py
@@ -35,12 +35,11 @@ from sales order. It adds sales name and sales Reference on production order.
'website': 'http://www.openerp.com',
'images': ['images/SO_to_MO.jpeg'],
'depends': ['mrp', 'sale_stock'],
- 'init_xml': [],
- 'update_xml': [
+ 'data': [
'security/ir.model.access.csv',
'sale_mrp_view.xml',
],
- 'demo_xml': [],
+ 'demo': [],
'test':['test/sale_mrp.yml'],
'installable': True,
'auto_install': True,
diff --git a/addons/sale_order_dates/__openerp__.py b/addons/sale_order_dates/__openerp__.py
index f67c7034821..7c3360f3547 100644
--- a/addons/sale_order_dates/__openerp__.py
+++ b/addons/sale_order_dates/__openerp__.py
@@ -29,22 +29,17 @@ Add additional date information to the sales order.
===================================================
You can add the following additional dates to a sale order:
+-----------------------------------------------------------
* Requested Date
* Commitment Date
* Effective Date
""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
- 'images': ["images/sale_order_dates.jpeg"],
- 'depends': ["sale_stock"],
- 'init_xml': [
- ],
-
- 'update_xml': [
- 'sale_order_dates_view.xml',
- ],
- 'demo_xml': [
- ],
+ 'images': ['images/sale_order_dates.jpeg'],
+ 'depends': ['sale_stock'],
+ 'data': ['sale_order_dates_view.xml'],
+ 'demo': [],
'test': [],
'installable': True,
'auto_install': False,
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
index 268e641cf41..ff4ef80e5ea 100644
--- a/addons/sale_stock/__openerp__.py
+++ b/addons/sale_stock/__openerp__.py
@@ -20,10 +20,11 @@
##############################################################################
{
- 'name': 'Sale To Stock',
+ 'name': 'Sales and Warehouse Management',
'version': '1.0',
'category': 'Hidden',
'description': """
+ 'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control',
This Module manage quotations and sales orders.
===========================================================================
@@ -61,11 +62,9 @@ Dashboard for Sales Manager that includes:
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': [],
- 'depends': ['sale', 'procurement'],
+ 'depends': ['sale', 'stock', 'procurement'],
'init_xml': [],
- 'update_xml': ['wizard/sale_make_invoice_advance.xml',
- 'wizard/sale_make_invoice.xml',
- 'security/sale_stock_security.xml',
+ 'update_xml': ['security/sale_stock_security.xml',
'security/ir.model.access.csv',
'company_view.xml',
'sale_stock_view.xml',
@@ -73,15 +72,16 @@ Dashboard for Sales Manager that includes:
'res_config_view.xml',
'report/sale_report_view.xml',
'process/sale_stock_process.xml',
+
],
'data': ['sale_stock_data.xml'],
'demo_xml': ['sale_stock_demo.xml'],
'test': ['test/cancel_order_sale_stock.yml',
'test/picking_order_policy.yml',
- 'test/manual_order_policy.yml'
+ 'test/prepaid_order_policy.yml',
],
'installable': True,
'auto_install': True,
}
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py
index b7f51afb967..73724b64999 100644
--- a/addons/sale_stock/res_config.py
+++ b/addons/sale_stock/res_config.py
@@ -26,6 +26,9 @@ from tools.translate import _
class sale_configuration(osv.osv_memory):
_inherit = 'sale.config.settings'
_columns = {
+ 'group_invoice_so_lines': fields.boolean('generate invoices based on the sale order',
+ implied_group='sale.group_invoice_so_lines',
+ help="To allow your salesman to make invoices for sale order lines using the menu 'Lines to Invoice'."),
'group_invoice_deli_orders': fields.boolean('generate invoices after and based on delivery orders',
implied_group='sale_stock.group_invoice_deli_orders',
help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."),
@@ -52,8 +55,11 @@ class sale_configuration(osv.osv_memory):
help="This allows to configure and use multiple shops."),
'module_project_timesheet': fields.boolean("Project Timesheet"),
'module_project_mrp': fields.boolean("Project MRP"),
-
- }
+ }
+
+ _defaults = {
+ 'default_order_policy': 'manual',
+ }
def default_get(self, cr, uid, fields, context=None):
res = super(sale_configuration, self).default_get(cr, uid, fields, context)
diff --git a/addons/sale_stock/res_config_view.xml b/addons/sale_stock/res_config_view.xml
index 24ece1673b3..1f5380b0f58 100644
--- a/addons/sale_stock/res_config_view.xml
+++ b/addons/sale_stock/res_config_view.xml
@@ -9,7 +9,11 @@
-
+
+
+
+
+
@@ -22,7 +26,11 @@
-
+
+
+
+
+
@@ -44,24 +52,15 @@
-
-
+
-
-
-
-
-
-
-
-
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 8786b45668d..c23f8ff46b8 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -28,9 +28,11 @@ from tools.translate import _
class sale_shop(osv.osv):
_inherit = "sale.shop"
_columns = {
- 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
+ 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse'),
}
+sale_shop()
+
class sale_order(osv.osv):
_inherit = "sale.order"
@@ -110,7 +112,7 @@ class sale_order(osv.osv):
return res
_columns = {
- 'state': fields.selection([
+ 'state': fields.selection([
('draft', 'Draft Quotation'),
('sent', 'Quotation Sent'),
('cancel', 'Cancelled'),
@@ -142,7 +144,7 @@ class sale_order(osv.osv):
'picked_rate': fields.function(_picked_rate, string='Picked', type='float'),
'invoice_quantity': fields.selection([('order', 'Ordered Quantities'), ('procurement', 'Shipped Quantities')], 'Invoice on',
help="The sale order will automatically create the invoice proposition (draft invoice).\
- You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),
+ You have to choose if you want your invoice based on ordered ", required=True, readonly=True, states={'draft': [('readonly', False)]}),
}
_defaults = {
'picking_policy': 'direct',
@@ -162,7 +164,16 @@ class sale_order(osv.osv):
return osv.osv.unlink(self, cr, uid, unlink_ids, context=context)
-
+ def onchange_shop_id(self, cr, uid, ids, shop_id):
+ v = {}
+ if shop_id:
+ shop = self.pool.get('sale.shop').browse(cr, uid, shop_id)
+ v['project_id'] = shop.project_id.id
+ # Que faire si le client a une pricelist a lui ?
+ if shop.pricelist_id.id:
+ v['pricelist_id'] = shop.pricelist_id.id
+ return {'value': v}
+
def action_view_delivery(self, cr, uid, ids, context=None):
'''
@@ -210,42 +221,11 @@ class sale_order(osv.osv):
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
self.confirm_send_note(cr, uid, ids, context)
return True
-
- def manual_invoice(self, cr, uid, ids, context=None):
- """ create invoices for the given sale orders (ids), and open the form
- view of one of the newly created invoices
- """
- mod_obj = self.pool.get('ir.model.data')
- wf_service = netsvc.LocalService("workflow")
-
- # create invoices through the sale orders' workflow
- inv_ids0 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
- for id in ids:
- wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
- inv_ids1 = set(inv.id for sale in self.browse(cr, uid, ids, context) for inv in sale.invoice_ids)
- # determine newly created invoices
- new_inv_ids = list(inv_ids1 - inv_ids0)
-
- res = mod_obj.get_object_reference(cr, uid, 'account', 'invoice_form')
- res_id = res and res[1] or False,
-
- return {
- 'name': _('Customer Invoices'),
- 'view_type': 'form',
- 'view_mode': 'form',
- 'view_id': [res_id],
- 'res_model': 'account.invoice',
- 'context': "{'type':'out_invoice'}",
- 'type': 'ir.actions.act_window',
- 'nodestroy': True,
- 'target': 'current',
- 'res_id': new_inv_ids and new_inv_ids[0] or False,
- }
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
- res = super(sale_order,self).action_invoice_create( cr, uid, ids, grouped=grouped, states=states, date_inv = date_inv, context=context)
picking_obj = self.pool.get('stock.picking')
+ res = super(sale_order,self).action_invoice_create( cr, uid, ids, grouped=grouped, states=states, date_inv = date_inv, context=context)
if context is None:
context = {}
# If date was specified, use it as date invoiced, usefull when invoices are generated this month and put the
@@ -518,9 +498,6 @@ class sale_order(osv.osv):
def get_needaction_user_ids(self, cr, uid, ids, context=None):
result = super(sale_order, self).get_needaction_user_ids(cr, uid, ids, context=context)
- for obj in self.browse(cr, uid, ids, context=context):
- if (obj.state == 'manual' or obj.state == 'progress'):
- result[obj.id].append(obj.user_id.id)
return result
def delivery_send_note(self, cr, uid, ids, picking_id, context=None):
@@ -550,14 +527,13 @@ class sale_order_line(osv.osv):
_inherit = 'sale.order.line'
_columns = {
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the shipping of the products to the customer", readonly=True, states={'draft': [('readonly', False)]}),
- 'procurement_id': fields.many2one('procurement.order', 'Procurement'),
'type': fields.selection([('make_to_stock', 'from stock'), ('make_to_order', 'on order')], 'Procurement Method', required=True, readonly=True, states={'draft': [('readonly', False)]},
help="If 'on order', it triggers a procurement when the sale order is confirmed to create a task, purchase order or manufacturing order linked to this sale order line."),
- 'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}),
+ 'property_ids': fields.many2many('mrp.property', 'sale_order_line_property_rel', 'order_id', 'property_id', 'Properties', readonly=True, states={'draft': [('readonly', False)]}),
+ 'procurement_id': fields.many2one('procurement.order', 'Procurement'),
'product_packaging': fields.many2one('product.packaging', 'Packaging'),
'move_ids': fields.one2many('stock.move', 'sale_line_id', 'Inventory Moves', readonly=True),
'number_packages': fields.function(_number_packages, type='integer', string='Number Packages'),
-
}
_defaults = {
'delay': 0.0,
@@ -567,23 +543,33 @@ class sale_order_line(osv.osv):
def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
res = super(sale_order_line, self)._prepare_order_line_invoice_line(cr, uid, line, account_id=account_id, context=context)
-
+
def _get_line_qty(line):
- if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
+ if (line.order_id.invoice_quantity=='order') or not line.procurement_id:
+ if line.product_uos:
+ return line.product_uos_qty or 0.0
+ return line.product_uom_qty
+ else:
return self.pool.get('procurement.order').quantity_get(cr, uid,
line.procurement_id.id, context=context)
-
+
def _get_line_uom(line):
- if not (line.order_id.invoice_quantity=='order') or line.procurement_id:
+ if (line.order_id.invoice_quantity=='order') or not line.procurement_id:
+ if line.product_uos:
+ return line.product_uos.id
+ return line.product_uom.id
+ else:
return self.pool.get('procurement.order').uom_get(cr, uid,
line.procurement_id.id, context=context)
- uosqty = _get_line_qty(line)
- uos_id = _get_line_uom(line)
- pu = 0.0
- if uosqty:
+
+ if not line.invoiced:
+ uosqty = _get_line_qty(line)
+ uos_id = _get_line_uom(line)
+ pu = 0.0
+ if uosqty:
pu = round(line.price_unit * line.product_uom_qty / uosqty,
- self.pool.get('decimal.precision').precision_get(cr, uid, 'Sale Price'))
- res.update({'price_unit': pu, 'quantity': uosqty,'uos_id': uos_id})
+ self.pool.get('decimal.precision').precision_get(cr, uid, 'Product Price'))
+ res.update({'price_unit': pu, 'quantity': uosqty, 'uos_id': uos_id})
return res
def product_packaging_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False,
@@ -644,14 +630,14 @@ class sale_order_line(osv.osv):
res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
-
+
if not product:
return {'value': {'th_weight': 0, 'product_packaging': False,
'product_uos_qty': qty}, 'domain': {'product_uom': [],
'product_uos': []}}
- res = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
- result = res.get('value', {})
- warning_msgs = res.get('warning') and res['warning']['message'] or ''
+ res_packing = self.product_packaging_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, packaging, context=context)
+ result = res_packing.get('value', {})
+ warning_msgs = res_packing.get('warning') and res_packing['warning']['message'] or ''
product_obj = product_obj.browse(cr, uid, product, context=context)
uom2 = False
if uom:
@@ -671,7 +657,10 @@ class sale_order_line(osv.osv):
warning_msgs += _("Not enough stock ! : ") + warn_msg + "\n\n"
# get unit price
if warning_msgs:
- warning.update({'message': warning_msgs})
+ warning = {
+ 'title': _('Configuration Error!'),
+ 'message' : warning_msgs
+ }
res.update({'warning': warning})
return res
@@ -683,4 +672,4 @@ class sale_order_line(osv.osv):
raise osv.except_osv(
_('Cannot cancel sales order line!'),
_('You must first cancel stock moves attached to this sales order line.'))
- return res
\ No newline at end of file
+ return res
diff --git a/addons/sale_stock/sale_stock_data.xml b/addons/sale_stock/sale_stock_data.xml
index cc6aa0a68cb..7c4844de33a 100644
--- a/addons/sale_stock/sale_stock_data.xml
+++ b/addons/sale_stock/sale_stock_data.xml
@@ -1,8 +1,14 @@
+
+
+
+
\ No newline at end of file
diff --git a/addons/sale_stock/sale_stock_demo.xml b/addons/sale_stock/sale_stock_demo.xml
index 9ebedb077e6..15b1e60b829 100644
--- a/addons/sale_stock/sale_stock_demo.xml
+++ b/addons/sale_stock/sale_stock_demo.xml
@@ -1,35 +1,26 @@
-
-
- manual
+
+
+ prepaid
-
-
- manual
+
+
+ prepaid
-
+
picking
-
+
picking
-
- manual
-
-
-
- manual
-
-
+
-
-
make_to_order
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index d89a465e560..4dadbd60c6a 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -2,19 +2,18 @@
-
- sale.shop.sale.stock
+
+ sale.shop.inherit.form
sale.shop
- form
-
-
+
+
-
+
sale.shop.sale.stock
sale.shop
@@ -27,6 +26,7 @@
+
sale.order.tree.sale.stock
@@ -47,27 +47,25 @@
form
-
+
-
+
-
+
-
+
-
-
-
+
-
+
-
+
-
+
@@ -124,18 +122,17 @@
-
+
-
-
+
+
+
-
+
-
-
diff --git a/addons/sale_stock/sale_stock_workflow.xml b/addons/sale_stock/sale_stock_workflow.xml
index 7b757501e48..e90f64b9d2e 100644
--- a/addons/sale_stock/sale_stock_workflow.xml
+++ b/addons/sale_stock/sale_stock_workflow.xml
@@ -53,17 +53,16 @@
-
(order_policy=='picking')
-
-
-
+
+
+
- manual_invoice
+ (order_policy=='prepaid')
diff --git a/addons/sale/test/prepaid_order_policy.yml b/addons/sale_stock/test/prepaid_order_policy.yml
similarity index 62%
rename from addons/sale/test/prepaid_order_policy.yml
rename to addons/sale_stock/test/prepaid_order_policy.yml
index 330896571b6..e35a9a82cf9 100644
--- a/addons/sale/test/prepaid_order_policy.yml
+++ b/addons/sale_stock/test/prepaid_order_policy.yml
@@ -1,10 +1,12 @@
-
Now I confirm the Quotation with "Pay before delivery" policy.
-
- !workflow {model: sale.order, action: order_confirm, ref: sale_order_4}
+ !workflow {model: sale.order, action: order_confirm, ref: sale.sale_order_4}
-
I check that delivery order should not created before invoice is paid.
-
!python {model: sale.order}: |
- sale_order = self.browse(cr, uid, ref("sale_order_4"))
+ sale_order = self.browse(cr, uid, ref("sale.sale_order_4"))
+ assert len(sale_order.picking_ids) == False, "Delivery order should not created before invoice."
assert sale_order.invoice_ids, "Invoice should be created."
+
diff --git a/addons/sale_stock/wizard/sale_make_invoice_advance.xml b/addons/sale_stock/wizard/sale_make_invoice_advance.xml
index 5bb7d231e94..97e9c843683 100644
--- a/addons/sale_stock/wizard/sale_make_invoice_advance.xml
+++ b/addons/sale_stock/wizard/sale_make_invoice_advance.xml
@@ -22,6 +22,9 @@
attrs="{'invisible': [('advance_payment_method', '!=', 'percentage')]}"/>
+
+
+
Date: Sun, 9 Sep 2012 17:49:03 +0530
Subject: [PATCH 089/166] [REM]: move sale_stock wizard into sale wizard
bzr revid: atp@tinyerp.com-20120909121903-62z33di4idwsrzjf
---
addons/sale/__openerp__.py | 2 +-
addons/sale/edi/sale_order_action_data.xml | 4 ++--
addons/sale/sale.py | 4 ++--
addons/{sale_stock => sale}/wizard/sale_make_invoice.py | 0
addons/{sale_stock => sale}/wizard/sale_make_invoice.xml | 0
.../wizard/sale_make_invoice_advance.py | 0
.../wizard/sale_make_invoice_advance.xml | 0
addons/sale_stock/__init__.py | 1 -
addons/sale_stock/__openerp__.py | 7 +++----
addons/sale_stock/sale_stock.py | 4 ++--
addons/sale_stock/wizard/__init__.py | 3 ---
11 files changed, 10 insertions(+), 15 deletions(-)
rename addons/{sale_stock => sale}/wizard/sale_make_invoice.py (100%)
rename addons/{sale_stock => sale}/wizard/sale_make_invoice.xml (100%)
rename addons/{sale_stock => sale}/wizard/sale_make_invoice_advance.py (100%)
rename addons/{sale_stock => sale}/wizard/sale_make_invoice_advance.xml (100%)
diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py
index b6067ff6c71..5c67b69b820 100644
--- a/addons/sale/__openerp__.py
+++ b/addons/sale/__openerp__.py
@@ -53,8 +53,8 @@ Dashboard for Sales Manager that includes:
'images': ['images/deliveries_to_invoice.jpeg','images/sale_dashboard.jpeg','images/Sale_order_line_to_invoice.jpeg','images/sale_order.jpeg','images/sales_analysis.jpeg'],
'depends': ['account_voucher'],
'data': [
- 'wizard/sale_make_invoice_advance.xml',
'wizard/sale_line_invoice.xml',
+ 'wizard/sale_make_invoice_advance.xml',
'wizard/sale_make_invoice.xml',
'security/sale_security.xml',
'security/ir.model.access.csv',
diff --git a/addons/sale/edi/sale_order_action_data.xml b/addons/sale/edi/sale_order_action_data.xml
index dcaf0828aef..478606e35ea 100644
--- a/addons/sale/edi/sale_order_action_data.xml
+++ b/addons/sale/edi/sale_order_action_data.xml
@@ -28,10 +28,10 @@
-
- -->
+
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 988b4d86cf6..5e6e24e0083 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -635,11 +635,11 @@ class sale_order(osv.osv):
def cancel_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_append_note(cr, uid, [obj.id], body=_("Sale Order for %s cancelled .") % (obj.partner_id.name), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("Sale Order for %s cancelled .") % (obj.partner_id.name), context=context)
def done_send_note(self, cr, uid, ids, context=None):
for obj in self.browse(cr, uid, ids, context=context):
- self.message_append_note(cr, uid, [obj.id], body=_("Sale Order for %s has been done ") % (obj.partner_id.name), context=context)
+ self.message_post(cr, uid, [obj.id], body=_("Sale Order for %s has been done ") % (obj.partner_id.name), context=context)
def invoice_paid_send_note(self, cr, uid, ids, context=None):
self.message_post(cr, uid, ids, body=_("Invoice has been paid ."), context=context)
diff --git a/addons/sale_stock/wizard/sale_make_invoice.py b/addons/sale/wizard/sale_make_invoice.py
similarity index 100%
rename from addons/sale_stock/wizard/sale_make_invoice.py
rename to addons/sale/wizard/sale_make_invoice.py
diff --git a/addons/sale_stock/wizard/sale_make_invoice.xml b/addons/sale/wizard/sale_make_invoice.xml
similarity index 100%
rename from addons/sale_stock/wizard/sale_make_invoice.xml
rename to addons/sale/wizard/sale_make_invoice.xml
diff --git a/addons/sale_stock/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
similarity index 100%
rename from addons/sale_stock/wizard/sale_make_invoice_advance.py
rename to addons/sale/wizard/sale_make_invoice_advance.py
diff --git a/addons/sale_stock/wizard/sale_make_invoice_advance.xml b/addons/sale/wizard/sale_make_invoice_advance.xml
similarity index 100%
rename from addons/sale_stock/wizard/sale_make_invoice_advance.xml
rename to addons/sale/wizard/sale_make_invoice_advance.xml
diff --git a/addons/sale_stock/__init__.py b/addons/sale_stock/__init__.py
index 1b63b8b2b8b..b5899113530 100644
--- a/addons/sale_stock/__init__.py
+++ b/addons/sale_stock/__init__.py
@@ -21,7 +21,6 @@
import sale_stock
import stock
-import wizard
import report
import company
import res_config
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
index ff4ef80e5ea..7ad341fd741 100644
--- a/addons/sale_stock/__openerp__.py
+++ b/addons/sale_stock/__openerp__.py
@@ -69,10 +69,9 @@ Dashboard for Sales Manager that includes:
'company_view.xml',
'sale_stock_view.xml',
'sale_stock_workflow.xml',
- 'res_config_view.xml',
- 'report/sale_report_view.xml',
- 'process/sale_stock_process.xml',
-
+ 'res_config_view.xml',
+ 'report/sale_report_view.xml',
+ 'process/sale_stock_process.xml',
],
'data': ['sale_stock_data.xml'],
'demo_xml': ['sale_stock_demo.xml'],
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index c23f8ff46b8..ad4d185b6e0 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -507,10 +507,10 @@ class sale_order(osv.osv):
# convert it to the user TZ and re-render it with %Z to add the timezone
picking_datetime = fields.DT.datetime.strptime(picking.min_date, DEFAULT_SERVER_DATETIME_FORMAT)
picking_date_str = fields.datetime.context_timestamp(cr, uid, picking_datetime, context=context).strftime(DATETIME_FORMATS_MAP['%+'] + " (%Z)")
- self.message_append_note(cr, uid, [order.id], body=_("Delivery Order %s scheduled for %s.") % (picking.name, picking_date_str), context=context)
+ self.message_post(cr, uid, [order.id], body=_("Delivery Order %s scheduled for %s.") % (picking.name, picking_date_str), context=context)
def delivery_end_send_note(self, cr, uid, ids, context=None):
- self.message_append_note(cr, uid, ids, body=_("Order delivered ."), context=context)
+ self.message_post(cr, uid, ids, body=_("Order delivered ."), context=context)
class sale_order_line(osv.osv):
diff --git a/addons/sale_stock/wizard/__init__.py b/addons/sale_stock/wizard/__init__.py
index 504e6eddbc0..53c4cba0865 100644
--- a/addons/sale_stock/wizard/__init__.py
+++ b/addons/sale_stock/wizard/__init__.py
@@ -19,7 +19,4 @@
#
##############################################################################
-import sale_make_invoice
-import sale_make_invoice_advance
-
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
From 30bf8715cf0cec624f902a99e00a0044c066c2fb Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sun, 9 Sep 2012 18:02:16 +0530
Subject: [PATCH 090/166] [IMP]: Change workflow transition. remove type field
bzr revid: atp@tinyerp.com-20120909123216-vys9dyuqk5i7grgr
---
addons/sale/edi/sale_order_action_data.xml | 4 ++--
addons/sale/sale_view.xml | 1 -
addons/sale/security/sale_security.xml | 4 ++++
addons/sale_stock/process/sale_stock_process.xml | 2 +-
addons/sale_stock/res_config.py | 2 +-
addons/sale_stock/sale_stock_view.xml | 2 +-
addons/sale_stock/security/sale_stock_security.xml | 5 -----
7 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/addons/sale/edi/sale_order_action_data.xml b/addons/sale/edi/sale_order_action_data.xml
index 478606e35ea..d9ba420fd89 100644
--- a/addons/sale/edi/sale_order_action_data.xml
+++ b/addons/sale/edi/sale_order_action_data.xml
@@ -28,10 +28,10 @@
-
+
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 6bc0f2f7f9d..87db4e28c31 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -246,7 +246,6 @@
groups="base.group_user"
on_change="product_id_change(parent.pricelist_id, product_id, product_uom_qty, product_uom, product_uos_qty, product_uos, name, parent.partner_id, False, True, parent.date_order, False, parent.fiscal_position, False, context)"/>
-
diff --git a/addons/sale/security/sale_security.xml b/addons/sale/security/sale_security.xml
index 6dd9492394c..4b5cb7fba56 100644
--- a/addons/sale/security/sale_security.xml
+++ b/addons/sale/security/sale_security.xml
@@ -25,6 +25,10 @@
+
+ Properties on lines
+
+
Addresses in Sale Orders
diff --git a/addons/sale_stock/process/sale_stock_process.xml b/addons/sale_stock/process/sale_stock_process.xml
index 5ad6399fe51..112487a8e70 100644
--- a/addons/sale_stock/process/sale_stock_process.xml
+++ b/addons/sale_stock/process/sale_stock_process.xml
@@ -146,7 +146,7 @@
-
+
diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py
index 73724b64999..2c2409bebd1 100644
--- a/addons/sale_stock/res_config.py
+++ b/addons/sale_stock/res_config.py
@@ -48,7 +48,7 @@ class sale_configuration(osv.osv_memory):
'default_picking_policy' : fields.boolean("Deliver all at once when all products are available.",
help = "Sales order by default will be configured to deliver all products at once instead of delivering each product when it is available. This may have an impact on the shipping price."),
'group_mrp_properties': fields.boolean('Product properties on order lines',
- implied_group='sale_stock.group_mrp_properties',
+ implied_group='sale.group_mrp_properties',
help="Allows you to tag sale order lines with properties."),
'group_multiple_shops': fields.boolean("Manage Multiple Shops",
implied_group='stock.group_locations',
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index 4dadbd60c6a..8d5fc90ec95 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -104,7 +104,7 @@
+ groups="sale.group_mrp_properties"/>
diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml
index 73badf9ad0e..ac8bfef9864 100644
--- a/addons/sale_stock/security/sale_stock_security.xml
+++ b/addons/sale_stock/security/sale_stock_security.xml
@@ -2,11 +2,6 @@
-
- Properties on lines
-
-
-
Enable Invoicing Delivery orders
From 3017f5d6e35d77df9705b54c30c6a074fe1eac2f Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sun, 9 Sep 2012 18:43:38 +0530
Subject: [PATCH 091/166] [FIX]: ADD sale_stock dependency
bzr revid: atp@tinyerp.com-20120909131338-p6bfigvid3f6876m
---
addons/sale_margin/__openerp__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/sale_margin/__openerp__.py b/addons/sale_margin/__openerp__.py
index cb1812b8e9f..6cacdcda7b4 100644
--- a/addons/sale_margin/__openerp__.py
+++ b/addons/sale_margin/__openerp__.py
@@ -31,7 +31,7 @@ Price and Cost Price.
""",
'author':'OpenERP SA',
'images':['images/sale_margin.jpeg'],
- 'depends':['sale'],
+ 'depends':['sale_stock'],
'demo':[],
'test': ['test/sale_margin.yml'],
'data':['security/ir.model.access.csv','sale_margin_view.xml'],
From 4cd3b7cecb5bff4b78a907d6bca7f52bacf649ba Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sun, 9 Sep 2012 22:33:41 +0530
Subject: [PATCH 092/166] [IMP]:Inherit advance invoice wizard for order policy
picking..
bzr revid: atp@tinyerp.com-20120909170341-1th57w16upi6c3dt
---
.../sale/wizard/sale_make_invoice_advance.py | 17 ------
addons/sale_stock/sale_stock.py | 61 +++++++++++++++++++
2 files changed, 61 insertions(+), 17 deletions(-)
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
index a672c6b680a..820144852f5 100644
--- a/addons/sale/wizard/sale_make_invoice_advance.py
+++ b/addons/sale/wizard/sale_make_invoice_advance.py
@@ -178,23 +178,6 @@ class sale_advance_payment_inv(osv.osv_memory):
# add the invoice to the sale order's invoices
sale.write({'invoice_ids': [(4, inv_id)]})
- # If invoice on picking: add the cost on the SO
- # If not, the advance will be deduced when generating the final invoice
- if sale.order_policy == 'picking':
- vals = {
- 'order_id': sale.id,
- 'name': res.get('name'),
- 'price_unit': -inv_amount,
- 'product_uom_qty': wizard.qtty or 1.0,
- 'product_uos_qty': wizard.qtty or 1.0,
- 'product_uos': res.get('uos_id', False),
- 'product_uom': res.get('uom_id', False),
- 'product_id': wizard.product_id.id or False,
- 'discount': False,
- 'tax_id': res.get('invoice_line_tax_id'),
- }
- self.pool.get('sale.order.line').create(cr, uid, vals, context=context)
-
if context.get('open_invoices', False):
return self.open_invoices( cr, uid, ids, inv_ids, context=context)
return {'type': 'ir.actions.act_window_close'}
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index ad4d185b6e0..b6ed699355f 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -673,3 +673,64 @@ class sale_order_line(osv.osv):
_('Cannot cancel sales order line!'),
_('You must first cancel stock moves attached to this sales order line.'))
return res
+
+class sale_advance_payment_inv(osv.osv_memory):
+ _inherit = "sale.advance.payment.inv"
+
+ def create_invoices(self, cr, uid, ids, context=None):
+ """ create invoices for the active sale orders """
+ result = super(sale_advance_payment_inv, self).create_invoices(cr, uid, ids, context=context)
+ sale_obj = self.pool.get('sale.order')
+ inv_line_obj = self.pool.get('account.invoice.line')
+ wizard = self.browse(cr, uid, ids[0], context)
+ sale_ids = context.get('active_ids', [])
+
+ assert wizard.advance_payment_method in ('fixed', 'percentage')
+ inv_ids = []
+ for sale in sale_obj.browse(cr, uid, sale_ids, context=context):
+ if sale.order_policy == 'postpaid':
+ raise osv.except_osv(
+ _('Error!'),
+ _("You cannot make an advance on a sales order \
+ that is defined as 'Automatic Invoice after delivery'."))
+
+ val = inv_line_obj.product_id_change(cr, uid, [], wizard.product_id.id,
+ uom=False, partner_id=sale.partner_id.id, fposition_id=sale.fiscal_position.id)
+ res = val['value']
+ # determine invoice amount
+ if wizard.advance_payment_method == 'percentage':
+ inv_amount = sale.amount_total * wizard.amount / 100
+ if not res.get('name'):
+ res['name'] = _("Advance of %s %%") % (wizard.amount)
+ else:
+ inv_amount = wizard.amount
+ if not res.get('name'):
+ #TODO: should find a way to call formatLang() from rml_parse
+ symbol = sale.pricelist_id.currency_id.symbol
+ if sale.pricelist_id.currency_id.position == 'after':
+ res['name'] = _("Advance of %s %s") % (inv_amount, symbol)
+ else:
+ res['name'] = _("Advance of %s %s") % (symbol, inv_amount)
+
+ # determine taxes
+ if res.get('invoice_line_tax_id'):
+ res['invoice_line_tax_id'] = [(6, 0, res.get('invoice_line_tax_id'))]
+ else:
+ res['invoice_line_tax_id'] = False
+ # If invoice on picking: add the cost on the SO
+ # If not, the advance will be deduced when generating the final invoice
+ if sale.order_policy == 'picking':
+ vals = {
+ 'order_id': sale.id,
+ 'name': res.get('name'),
+ 'price_unit': -inv_amount,
+ 'product_uom_qty': wizard.qtty or 1.0,
+ 'product_uos_qty': wizard.qtty or 1.0,
+ 'product_uos': res.get('uos_id', False),
+ 'product_uom': res.get('uom_id', False),
+ 'product_id': wizard.product_id.id or False,
+ 'discount': False,
+ 'tax_id': res.get('invoice_line_tax_id'),
+ }
+ self.pool.get('sale.order.line').create(cr, uid, vals, context=context)
+ return result
From d630d3b6b663a821946c17cd7ce711b694ec830e Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Sun, 9 Sep 2012 23:00:20 +0530
Subject: [PATCH 093/166] [IMP]: improve progress bar from sale order line tree
view.
bzr revid: atp@tinyerp.com-20120909173020-gljs3gss7ljm310w
---
addons/sale/sale_view.xml | 1 -
addons/sale/wizard/sale_make_invoice_advance.py | 16 +++++++++-------
addons/sale_stock/sale_stock.py | 3 ++-
addons/sale_stock/sale_stock_view.xml | 12 ------------
4 files changed, 11 insertions(+), 21 deletions(-)
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 87db4e28c31..8bd10ac43cd 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -134,7 +134,6 @@
-
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
index 820144852f5..7c35e411876 100644
--- a/addons/sale/wizard/sale_make_invoice_advance.py
+++ b/addons/sale/wizard/sale_make_invoice_advance.py
@@ -69,19 +69,24 @@ class sale_advance_payment_inv(osv.osv_memory):
""" create invoices for the active sale orders """
if context is None:
context = {}
+ sale_obj = self.pool.get('sale.order')
+ inv_obj = self.pool.get('account.invoice')
+ inv_line_obj = self.pool.get('account.invoice.line')
+ ir_property_obj = self.pool.get('ir.property')
+ act_window = self.pool.get('ir.actions.act_window')
+ fiscal_obj = self.pool.get('account.fiscal.position')
wizard = self.browse(cr, uid, ids[0], context)
sale_ids = context.get('active_ids', [])
if wizard.advance_payment_method == 'all':
# create the final invoices of the active sale orders
- res = self.pool.get('sale.order').manual_invoice(cr, uid, sale_ids, context)
+ res = sale_obj.manual_invoice(cr, uid, sale_ids, context)
if context.get('open_invoices', False):
return res
return {'type': 'ir.actions.act_window_close'}
if wizard.advance_payment_method == 'lines':
# open the list view of sale order lines to invoice
- act_window = self.pool.get('ir.actions.act_window')
res = act_window.for_xml_id(cr, uid, 'sale', 'action_order_line_tree2', context)
res['context'] = {
'search_default_uninvoiced': 1,
@@ -91,9 +96,6 @@ class sale_advance_payment_inv(osv.osv_memory):
assert wizard.advance_payment_method in ('fixed', 'percentage')
- sale_obj = self.pool.get('sale.order')
- inv_obj = self.pool.get('account.invoice')
- inv_line_obj = self.pool.get('account.invoice.line')
inv_ids = []
for sale in sale_obj.browse(cr, uid, sale_ids, context=context):
@@ -109,10 +111,10 @@ class sale_advance_payment_inv(osv.osv_memory):
# determine and check income account
if not wizard.product_id.id :
- prop = self.pool.get('ir.property').get(cr, uid,
+ prop = ir_property_obj.get(cr, uid,
'property_account_income_categ', 'product.category', context=context)
prop_id = prop and prop.id or False
- account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, sale.fiscal_position.id or False, prop_id)
+ account_id = fiscal_obj.map_account(cr, uid, sale.fiscal_position.id or False, prop_id)
if not account_id:
raise osv.except_osv(_('Configuration Error!'),
_('There is no income account defined as global property.'))
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index b6ed699355f..b3a44117453 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -682,6 +682,7 @@ class sale_advance_payment_inv(osv.osv_memory):
result = super(sale_advance_payment_inv, self).create_invoices(cr, uid, ids, context=context)
sale_obj = self.pool.get('sale.order')
inv_line_obj = self.pool.get('account.invoice.line')
+ sale_line_obj = self.pool.get('sale.order.line')
wizard = self.browse(cr, uid, ids[0], context)
sale_ids = context.get('active_ids', [])
@@ -732,5 +733,5 @@ class sale_advance_payment_inv(osv.osv_memory):
'discount': False,
'tax_id': res.get('invoice_line_tax_id'),
}
- self.pool.get('sale.order.line').create(cr, uid, vals, context=context)
+ sale_line_obj.create(cr, uid, vals, context=context)
return result
diff --git a/addons/sale_stock/sale_stock_view.xml b/addons/sale_stock/sale_stock_view.xml
index 8d5fc90ec95..2e239424233 100644
--- a/addons/sale_stock/sale_stock_view.xml
+++ b/addons/sale_stock/sale_stock_view.xml
@@ -28,18 +28,6 @@
-
- sale.order.tree.sale.stock
- sale.order
-
- tree
-
-
-
-
-
-
-
sale.order.form.sale.stock
sale.order
From b5ab7849aef257b61d4defa92655cdb97b20d90f Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Mon, 10 Sep 2012 11:08:59 +0530
Subject: [PATCH 094/166] [FIX]: Fix waning message in sale_stock
bzr revid: atp@tinyerp.com-20120910053859-gb6697ni0uk3is6i
---
addons/sale_stock/__openerp__.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
index 7ad341fd741..37671cdb7cb 100644
--- a/addons/sale_stock/__openerp__.py
+++ b/addons/sale_stock/__openerp__.py
@@ -23,14 +23,15 @@
'name': 'Sales and Warehouse Management',
'version': '1.0',
'category': 'Hidden',
- 'description': """
'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control',
+ 'description': """
+
This Module manage quotations and sales orders.
===========================================================================
Workflow with validation steps:
-------------------------------
- * Quotation -> Sales order -> Invoice
+ * **Quotation** -> **Sales order** -> **Invoice**
Create Invoice:
---------------
@@ -45,7 +46,7 @@ Partners preferences:
* Invoicing
Products stocks and prices:
---------------------------
+---------------------------
Delivery method:
-----------------
From 39cbe2711ea701c6a95cf4e51f49c64a1ff6dd3b Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Tue, 11 Sep 2012 15:17:54 +0530
Subject: [PATCH 095/166] [FIX]: Sale order in done state after invoice using
sale order line. Create invoice button disappeared in SO line when its Done.
bzr revid: atp@tinyerp.com-20120911094754-d1q40uyt2waahkzg
---
addons/sale/sale_view.xml | 6 +++---
addons/sale/wizard/sale_line_invoice.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml
index 8bd10ac43cd..a59a72b96dd 100644
--- a/addons/sale/sale_view.xml
+++ b/addons/sale/sale_view.xml
@@ -474,9 +474,9 @@
diff --git a/addons/sale/wizard/sale_line_invoice.py b/addons/sale/wizard/sale_line_invoice.py
index 613b07039d5..f442cbe0a8e 100644
--- a/addons/sale/wizard/sale_line_invoice.py
+++ b/addons/sale/wizard/sale_line_invoice.py
@@ -104,7 +104,7 @@ class sale_order_line_make_invoice(osv.osv_memory):
flag = False
break
if flag:
- wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'all_lines', cr)
+ wf_service.trg_validate(uid, 'sale.order', line.order_id.id, 'manual_invoice', cr)
sales_order_obj.write(cr, uid, [line.order_id.id], {'state': 'progress'})
if not invoices:
From e488f9b5682cd1599b3df0c26aee44e6b48539c1 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Tue, 11 Sep 2012 19:17:17 +0530
Subject: [PATCH 096/166] [FIX]: Fix bug:1043181 : remove so line invoice after
giving advance percentage payment
bzr revid: atp@tinyerp.com-20120911134717-vfdhltg2lno13nqf
---
.../sale/wizard/sale_make_invoice_advance.py | 21 ++++++++++++++++++-
addons/sale_stock/sale_stock.py | 2 --
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/addons/sale/wizard/sale_make_invoice_advance.py b/addons/sale/wizard/sale_make_invoice_advance.py
index 7c35e411876..91f9c78eb05 100644
--- a/addons/sale/wizard/sale_make_invoice_advance.py
+++ b/addons/sale/wizard/sale_make_invoice_advance.py
@@ -43,6 +43,26 @@ class sale_advance_payment_inv(osv.osv_memory):
help="The amount to be invoiced in advance."),
}
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
+ if context is None:context = {}
+ user_obj = self.pool.get('res.users')
+ res = super(sale_advance_payment_inv, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
+ active_ids = context.get('active_ids', False)
+ invoice_obj = self.pool.get('account.invoice')
+ model = context.get('active_model', '')
+ model_obj = self.pool.get(model)
+ if context.get('active_model', '') in ['sale.order'] and context.get('active_ids', []):
+ order_data = model_obj.read(cr, uid, context.get('active_ids'), ['invoice_ids'])[0]
+ for inv in invoice_obj.browse(cr, uid, order_data.get('invoice_ids')):
+ for line in inv.invoice_line:
+ # if percentage(Advance payment) is given then remove sale order lines option..
+ if str(line.name).startswith("Advance of"):
+ for field in res['fields']:
+ if field == 'advance_payment_method':
+ res['fields'][field]['selection'] = [('all', 'Invoice all the Sale Order'), ('percentage', 'Percentage'), ('fixed', 'Fixed Price'),]
+ return res
+
def _get_advance_product(self, cr, uid, context=None):
try:
product = self.pool.get('ir.model.data').get_object(cr, uid, 'sale', 'advance_product_0')
@@ -93,7 +113,6 @@ class sale_advance_payment_inv(osv.osv_memory):
'search_default_order_id': sale_ids and sale_ids[0] or False,
}
return res
-
assert wizard.advance_payment_method in ('fixed', 'percentage')
inv_ids = []
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index b3a44117453..415410e0ca6 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -685,8 +685,6 @@ class sale_advance_payment_inv(osv.osv_memory):
sale_line_obj = self.pool.get('sale.order.line')
wizard = self.browse(cr, uid, ids[0], context)
sale_ids = context.get('active_ids', [])
-
- assert wizard.advance_payment_method in ('fixed', 'percentage')
inv_ids = []
for sale in sale_obj.browse(cr, uid, sale_ids, context=context):
if sale.order_policy == 'postpaid':
From 86912a60cda92a675375deda770baac769b700bb Mon Sep 17 00:00:00 2001
From: Vishmita
Date: Thu, 13 Sep 2012 11:46:57 +0530
Subject: [PATCH 097/166] [FIX]In page view,user shuold not allowed to drag and
drop list rows.
bzr revid: vja@tinyerp.com-20120913061657-o378iqz4tzaqej33
---
addons/web/static/src/js/view_list.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js
index 015cd1636f1..3c0ebae4122 100644
--- a/addons/web/static/src/js/view_list.js
+++ b/addons/web/static/src/js/view_list.js
@@ -1417,7 +1417,7 @@ instance.web.ListView.Groups = instance.web.Class.extend( /** @lends instance.we
if ((dataset.sort && dataset.sort())
|| !_(this.columns).any(function (column) {
return column.widget === 'handle'
- || column.name === 'sequence'; })) {
+ || column.name === 'sequence'; }) || !list.options.reorderable){
return;
}
var sequence_field = _(this.columns).find(function (c) {
From f35f86745e5c652421261e7eccf312d14e61d471 Mon Sep 17 00:00:00 2001
From: Vishmita
Date: Thu, 13 Sep 2012 15:09:21 +0530
Subject: [PATCH 098/166] [FIX]change image path of node.
bzr revid: vja@tinyerp.com-20120913093921-hv1jgfahc1cn2ef7
---
addons/process/static/src/js/process.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/addons/process/static/src/js/process.js b/addons/process/static/src/js/process.js
index bbf9080de95..57c6f196012 100644
--- a/addons/process/static/src/js/process.js
+++ b/addons/process/static/src/js/process.js
@@ -143,7 +143,7 @@ instance.web.ViewManager.include({
var image_node = nodes.kind == "subflow" ? "node-subflow" : "node";
image_node = nodes.gray ? image_node + "-gray" : image_node;
image_node = nodes.active ? 'node-current': image_node;
- var img_src = '/web_process/static/src/img/'+ image_node + '.png';
+ var img_src = '/process/static/src/img/'+ image_node + '.png';
var image = r['image'](img_src, nodes.x-25, nodes.y,150, 100).attr({"cursor": "default"}) .mousedown(function() { return false; });
//For Node
var process_node = r['rect'](nodes.x, nodes.y, 150, 150).attr({stroke: "none"});
From d9629687e97d3307d4a995096405f4bea95496b0 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Thu, 13 Sep 2012 11:54:14 +0200
Subject: [PATCH 099/166] [IMP] removed default_selection
bzr revid: nicolas.vanhoren@openerp.com-20120913095414-n0r5veemxniao6hi
---
addons/account/account_view.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index d89108c7726..a535d891d2e 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -1052,7 +1052,7 @@
account.move.line
-
+
@@ -1943,7 +1943,7 @@
account.move.line
-
+
From ff4c8c0c60e2e336e6dbbe1472e8ace47c5c2da3 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Thu, 13 Sep 2012 14:00:00 +0200
Subject: [PATCH 100/166] corrected javascript crap
bzr revid: nicolas.vanhoren@openerp.com-20120913120000-8lttbfrbgekz32ui
---
.../src/js/account_move_reconciliation.js | 45 ++++++++++---------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 88b263038b4..7770cb613bc 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -5,43 +5,44 @@ instance.web.views.add('form_clone', 'instance.account.extend_form_view');
instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
start : function(){
- this._super()
- if(this.action.context && this.action.context.extended_view_id && this.action.context.extended_model)
+ this._super();
+ if(this.action.context && this.action.context.extended_view_id && this.action.context.extended_model) {
this.setup_exended_form_view(this.action.context.extended_model, this.action.context.extended_view_id);
+ }
},
setup_exended_form_view: function(view_model, view_id){
var self = this;
- from_view = this.registry.get_object('form_clone');
+ var from_view = this.registry.get_object('form_clone');
this.dataset_form = new instance.web.DataSetSearch(this, view_model, this.action.context, this.action.domain);
this.dataset_loaded = this.dataset_form.read_slice();
- obj_from_view = new from_view(self, self.dataset_form, view_id, options={});
+ var obj_from_view = new from_view(self, self.dataset_form, view_id, {});
obj_from_view.template = 'ExtendedFormView';
- view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
+ var view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
$.when(view_form, this.dataset_loaded).then(function() {
obj_from_view.on_pager_action('first');
});
}
-
-})
+});
+
instance.account.extend_form_view = instance.web.FormView.extend({
on_loaded: function(data) {
this._super.apply(this,arguments);
- var self = this
- this.$el.find(".oe_reconcile").on('click', this.do_reconcilation)
- this.$el.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile)
+ var self = this;
+ this.$el.find(".oe_reconcile").on('click', this.do_reconcilation);
+ this.$el.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile);
this.$el.on('click','a[data-pager-action]',function() {
var action = $(this).data('pager-action');
self.on_pager_action(action);
});
},
do_reconcilation:function(event){
- var self = this
+ var self = this;
if (!self.datarecord.id){
return false;
}
- var list_view = this.getParent().views['list'].controller
- ids = list_view.get_selected_ids()
- if (ids.length == 0) {
+ var list_view = this.getParent().views['list'].controller;
+ var ids = list_view.get_selected_ids();
+ if (ids.length === 0) {
instance.web.dialog($("
").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
return false;
}
@@ -72,6 +73,8 @@ instance.account.extend_form_view = instance.web.FormView.extend({
if (!self.datarecord.id){
return false;
}
+ // how do you want this to not fail ???
+ var event = null;
this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
self.dataset.read_slice().done(function(){
self.on_pager_action('next');
@@ -80,8 +83,8 @@ instance.account.extend_form_view = instance.web.FormView.extend({
},
do_update_pager: function(hide_index) {
- var index = this.dataset.index + 1
- if (this.dataset.ids.length == 0)
+ var index = this.dataset.index + 1;
+ if (this.dataset.ids.length === 0)
index = 0;
index = hide_index ? '-' : index;
this.$el.find('span.oe_pager_index_extend').html(index).end()
@@ -96,10 +99,10 @@ instance.account.extend_form_view = instance.web.FormView.extend({
},
on_pager_action: function(action) {
- var self = this
+ var self = this;
- if (this.dataset.ids.length == 0){
- self.datarecord = {}
+ if (this.dataset.ids.length === 0){
+ self.datarecord = {};
_(this.fields).each(function (field, f) {
field.set_value(self.datarecord[f] || false);
});
@@ -113,6 +116,6 @@ instance.account.extend_form_view = instance.web.FormView.extend({
});
}
},
- })
+ });
-}
+};
From b7923e45be72ac32908919addd4c98d183928f62 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Thu, 13 Sep 2012 14:08:26 +0200
Subject: [PATCH 101/166] beautify js
bzr revid: nicolas.vanhoren@openerp.com-20120913120826-ar7dnrfmka7oebyp
---
.../src/js/account_move_reconciliation.js | 217 +++++++++---------
1 file changed, 109 insertions(+), 108 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 7770cb613bc..a47b2cfd51f 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -1,121 +1,122 @@
-openerp.account = function(instance) {
-var _t = instance.web._t,
- _lt = instance.web._lt;
-instance.web.views.add('form_clone', 'instance.account.extend_form_view');
-
-instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
- start : function(){
- this._super();
- if(this.action.context && this.action.context.extended_view_id && this.action.context.extended_model) {
- this.setup_exended_form_view(this.action.context.extended_model, this.action.context.extended_view_id);
- }
- },
- setup_exended_form_view: function(view_model, view_id){
- var self = this;
- var from_view = this.registry.get_object('form_clone');
- this.dataset_form = new instance.web.DataSetSearch(this, view_model, this.action.context, this.action.domain);
- this.dataset_loaded = this.dataset_form.read_slice();
- var obj_from_view = new from_view(self, self.dataset_form, view_id, {});
- obj_from_view.template = 'ExtendedFormView';
- var view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
- $.when(view_form, this.dataset_loaded).then(function() {
- obj_from_view.on_pager_action('first');
- });
- }
-});
+openerp.account = function (instance) {
+ var _t = instance.web._t,
+ _lt = instance.web._lt;
+ instance.web.views.add('form_clone', 'instance.account.extend_form_view');
-instance.account.extend_form_view = instance.web.FormView.extend({
- on_loaded: function(data) {
- this._super.apply(this,arguments);
- var self = this;
- this.$el.find(".oe_reconcile").on('click', this.do_reconcilation);
- this.$el.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile);
- this.$el.on('click','a[data-pager-action]',function() {
- var action = $(this).data('pager-action');
- self.on_pager_action(action);
- });
- },
- do_reconcilation:function(event){
- var self = this;
- if (!self.datarecord.id){
- return false;
+ instance.account.extend_viewmanager = instance.web.ViewManagerAction.include({
+ start: function () {
+ this._super();
+ if (this.action.context && this.action.context.extended_view_id && this.action.context.extended_model) {
+ this.setup_exended_form_view(this.action.context.extended_model, this.action.context.extended_view_id);
+ }
+ },
+ setup_exended_form_view: function (view_model, view_id) {
+ var self = this;
+ var from_view = this.registry.get_object('form_clone');
+ this.dataset_form = new instance.web.DataSetSearch(this, view_model, this.action.context, this.action.domain);
+ this.dataset_loaded = this.dataset_form.read_slice();
+ var obj_from_view = new from_view(self, self.dataset_form, view_id, {});
+ obj_from_view.template = 'ExtendedFormView';
+ var view_form = obj_from_view.appendTo(self.$el.find('.oe_extended_form_view'));
+ $.when(view_form, this.dataset_loaded).then(function () {
+ obj_from_view.on_pager_action('first');
+ });
}
- var list_view = this.getParent().views['list'].controller;
- var ids = list_view.get_selected_ids();
- if (ids.length === 0) {
- instance.web.dialog($("
").text(_t("You must choose at least one record.")), { title: _t("Warning"), modal: true });
- return false;
- }
- var additional_context = _.extend({
- active_id: ids[0],
- active_ids: ids,
- active_model: list_view.dataset.model
- });
- self.rpc("/web/action/load", {
- action_id: py.eval(event.target.name),
- context: additional_context
- }, function(result) {
+ });
+
+ instance.account.extend_form_view = instance.web.FormView.extend({
+ on_loaded: function (data) {
+ this._super.apply(this, arguments);
+ var self = this;
+ this.$el.find(".oe_reconcile").on('click', this.do_reconcilation);
+ this.$el.find(".oe_nothing_to_reconcile").on('click', this.do_nothing_to_reconcile);
+ this.$el.on('click', 'a[data-pager-action]', function () {
+ var action = $(this).data('pager-action');
+ self.on_pager_action(action);
+ });
+ },
+ do_reconcilation: function (event) {
+ var self = this;
+ if (!self.datarecord.id) {
+ return false;
+ }
+ var list_view = this.getParent().views['list'].controller;
+ var ids = list_view.get_selected_ids();
+ if (ids.length === 0) {
+ instance.web.dialog($("
").text(_t("You must choose at least one record.")), {
+ title: _t("Warning"),
+ modal: true
+ });
+ return false;
+ }
+ var additional_context = _.extend({
+ active_id: ids[0],
+ active_ids: ids,
+ active_model: list_view.dataset.model
+ });
+ self.rpc("/web/action/load", {
+ action_id: py.eval(event.target.name),
+ context: additional_context
+ }, function (result) {
result.result.context = _.extend(result.result.context || {},
- additional_context);
+ additional_context);
result.result.flags = result.result.flags || {};
result.result.flags.new_window = true;
self.do_action(result.result, function () {
- self.dataset.read_slice().done(function(){
+ self.dataset.read_slice().done(function () {
self.on_pager_action('next');
});
+ });
});
- });
- },
+ },
-
- do_nothing_to_reconcile:function(){
- var self = this;
- if (!self.datarecord.id){
- return false;
- }
- // how do you want this to not fail ???
- var event = null;
- this.dataset.call(event.target.name, [[self.datarecord.id], self.dataset.context]).then(function() {
- self.dataset.read_slice().done(function(){
- self.on_pager_action('next');
- });
- });
- },
-
- do_update_pager: function(hide_index) {
- var index = this.dataset.index + 1;
- if (this.dataset.ids.length === 0)
- index = 0;
- index = hide_index ? '-' : index;
- this.$el.find('span.oe_pager_index_extend').html(index).end()
- .find('span.oe_pager_count_extend').html(this.dataset.ids.length);
- },
- do_search_move_line: function(partner_ids){
- var viewmanager = this.getParent();
- viewmanager.action.context.next_partner_only = true;
- viewmanager.action.context.partner_id = partner_ids;
- viewmanager.searchview.do_search();
- },
-
- on_pager_action: function(action) {
- var self = this;
-
- if (this.dataset.ids.length === 0){
- self.datarecord = {};
- _(this.fields).each(function (field, f) {
- field.set_value(self.datarecord[f] || false);
+ do_nothing_to_reconcile: function () {
+ var self = this;
+ if (!self.datarecord.id) {
+ return false;
+ }
+ // how do you want this to not fail ???
+ var event = null;
+ this.dataset.call(event.target.name, [
+ [self.datarecord.id], self.dataset.context]).then(function () {
+ self.dataset.read_slice().done(function () {
+ self.on_pager_action('next');
+ });
});
- self.do_update_pager();
- self.do_search_move_line([]);
- }
- else{
- $.when(this._super(action)).then(function() {
- var id = self.get_fields_values().partner_id;
- self.do_search_move_line([id]);
- });
- }
- },
- });
+ },
-};
+ do_update_pager: function (hide_index) {
+ var index = this.dataset.index + 1;
+ if (this.dataset.ids.length === 0) index = 0;
+ index = hide_index ? '-' : index;
+ this.$el.find('span.oe_pager_index_extend').html(index).end().find('span.oe_pager_count_extend').html(this.dataset.ids.length);
+ },
+
+ do_search_move_line: function (partner_ids) {
+ var viewmanager = this.getParent();
+ viewmanager.action.context.next_partner_only = true;
+ viewmanager.action.context.partner_id = partner_ids;
+ viewmanager.searchview.do_search();
+ },
+
+ on_pager_action: function (action) {
+ var self = this;
+
+ if (this.dataset.ids.length === 0) {
+ self.datarecord = {};
+ _(this.fields).each(function (field, f) {
+ field.set_value(self.datarecord[f] || false);
+ });
+ self.do_update_pager();
+ self.do_search_move_line([]);
+ } else {
+ $.when(this._super(action)).then(function () {
+ var id = self.get_fields_values().partner_id;
+ self.do_search_move_line([id]);
+ });
+ }
+ },
+ });
+
+};
\ No newline at end of file
From 6c97d377b2fc4530c97be72693bae9775ad084f3 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Thu, 13 Sep 2012 14:10:14 +0200
Subject: [PATCH 102/166] added return statements
bzr revid: nicolas.vanhoren@openerp.com-20120913121014-bu2o3sboo2xd4731
---
addons/account/static/src/js/account_move_reconciliation.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index a47b2cfd51f..5973432c0ef 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -68,6 +68,7 @@ openerp.account = function (instance) {
});
});
});
+ return true;
},
@@ -84,6 +85,7 @@ openerp.account = function (instance) {
self.on_pager_action('next');
});
});
+ return true;
},
do_update_pager: function (hide_index) {
From 096251e8c58bd9b88e853e6a4011b561c1b9d676 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Thu, 13 Sep 2012 18:09:48 +0200
Subject: [PATCH 103/166] wip
bzr revid: nicolas.vanhoren@openerp.com-20120913160948-5wwnw7s2jk1zkr1o
---
.../account/account_move_reconciliation.xml | 36 ++++++++++++++++---
.../src/js/account_move_reconciliation.js | 15 ++++++--
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index e5ccb090988..714aaccf5eb 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -39,18 +39,46 @@
Reconcile Customer Entries
account.move.line
form
- tree,form
+ account_reconciliation_list,form
-
+
Reconcile Supplier Entries
account.move.line
form
- tree,form
+ account_reconciliation_list,form
-
+
+
+
+
+ account.move.line.account_reconciliation_list
+ account.move.line
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Date: Fri, 14 Sep 2012 15:06:30 +0200
Subject: [PATCH 104/166] wip
bzr revid: nicolas.vanhoren@openerp.com-20120914130630-h7384augk0135qa8
---
.../account/account_move_reconciliation.xml | 4 +-
.../src/js/account_move_reconciliation.js | 9 ++-
.../src/xml/account_move_reconciliation.xml | 64 +++++++++++++++++++
3 files changed, 73 insertions(+), 4 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 714aaccf5eb..1bf2bc7ecdf 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -41,7 +41,7 @@
form
account_reconciliation_list,form
-
+
@@ -50,7 +50,7 @@
form
account_reconciliation_list,form
-
+
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 7df1f7528cb..cde4e88773b 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -1,6 +1,7 @@
openerp.account = function (instance) {
var _t = instance.web._t,
_lt = instance.web._lt;
+ var QWeb = instance.web.qweb;
instance.web.account = {};
@@ -8,8 +9,12 @@ openerp.account = function (instance) {
instance.web.account.ReconciliationListView = instance.web.ListView.extend({
init: function() {
this._super.apply(this, arguments);
- console.log("coucou");
- }
+ },
+ on_loaded: function() {
+ var tmp = this._super.apply(this, arguments);
+ this.$el.prepend(QWeb.render("AccountReconciliation"));
+ return tmp;
+ },
});
/*instance.web.views.add('form_clone', 'instance.account.extend_form_view');
diff --git a/addons/account/static/src/xml/account_move_reconciliation.xml b/addons/account/static/src/xml/account_move_reconciliation.xml
index 9fe822aafb9..b40e00f5e99 100644
--- a/addons/account/static/src/xml/account_move_reconciliation.xml
+++ b/addons/account/static/src/xml/account_move_reconciliation.xml
@@ -2,6 +2,70 @@
+
+
+
+
From 4cc9269e4ba4a171b2cffe16c612f8d9f42e8d1c Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Fri, 14 Sep 2012 17:31:33 +0200
Subject: [PATCH 105/166] wip
bzr revid: nicolas.vanhoren@openerp.com-20120914153133-dghxbx2k8k7o98bu
---
.../account/account_move_reconciliation.xml | 36 ++-----------------
.../src/js/account_move_reconciliation.js | 10 ++++++
2 files changed, 12 insertions(+), 34 deletions(-)
diff --git a/addons/account/account_move_reconciliation.xml b/addons/account/account_move_reconciliation.xml
index 1bf2bc7ecdf..b3cbb062f2c 100644
--- a/addons/account/account_move_reconciliation.xml
+++ b/addons/account/account_move_reconciliation.xml
@@ -1,38 +1,6 @@
-
-
- account.move.reconciliation.form
- account.move.reconciliation
- form
-
-
-
-
-
-
-
-
- ()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -40,7 +8,7 @@
account.move.line
form
account_reconciliation_list,form
-
+
@@ -49,7 +17,7 @@
account.move.line
form
account_reconciliation_list,form
-
+
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index cde4e88773b..ab15242d593 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -15,6 +15,16 @@ openerp.account = function (instance) {
this.$el.prepend(QWeb.render("AccountReconciliation"));
return tmp;
},
+ do_search: function(domain, context, group_by) {
+ var sup = this._super;
+ var mod = new instance.web.Model(this.model, context, domain);
+ return mod.query("partner_id").group_by(["partner_id"]).pipe(function(result) {
+ var vals = _.chain(result).pluck("attributes").pluck("value")
+ .filter(function(el) {return !!el;}).value();
+ debugger;
+ return sup(new instance.web.CompoundDomain(domain, [["partner_id", "in", _.pluck(vals, 0)]]), context, group_by);
+ });
+ },
});
/*instance.web.views.add('form_clone', 'instance.account.extend_form_view');
From 87e8b0ea51af9f18763d6a4badcf4e8eca91651d Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Mon, 17 Sep 2012 11:12:43 +0530
Subject: [PATCH 106/166] [IMP]: Improve description of sale and sale_stock
module. change tooltips for res_config file
bzr revid: atp@tinyerp.com-20120917054243-iko6uihhcy9b0ref
---
addons/sale/__openerp__.py | 11 ++-----
addons/sale/res_config.py | 3 +-
addons/sale_stock/__openerp__.py | 50 ++++++++++++++------------------
addons/sale_stock/sale_stock.py | 12 ++------
4 files changed, 29 insertions(+), 47 deletions(-)
diff --git a/addons/sale/__openerp__.py b/addons/sale/__openerp__.py
index f8ad10f9a93..1e6585618b5 100644
--- a/addons/sale/__openerp__.py
+++ b/addons/sale/__openerp__.py
@@ -29,23 +29,18 @@
Manage sales quotations and orders
==================================
-This application allows you to manage your sales goals in an effective and efficient manner by keeping track of all sales orders and history.
+This application allows you to make a sale order, validate it and encode payment without having to deal with anything related to warehouse management.
-It handles the full sales workflow:
+It handles the sales workflow :
* **Quotation** -> **Sales order** -> **Invoice**
Preferences
-----------
-* Shipping: Choice of delivery at once or partial delivery
* Invoicing: choose how invoices will be paid
-* Incoterms: International Commercial terms
-
-You can choose flexible invoicing methods:
+There is one invoicing methods:
* *On Demand*: Invoices are created manually from Sales Orders when needed
-* *On Delivery Order*: Invoices are generated from picking (delivery)
-* *Before Delivery*: A Draft invoice is created and must be paid before delivery
The Dashboard for the Sales Manager will include
diff --git a/addons/sale/res_config.py b/addons/sale/res_config.py
index f0f99883c98..4cfb1e7eb06 100644
--- a/addons/sale/res_config.py
+++ b/addons/sale/res_config.py
@@ -70,7 +70,8 @@ class sale_configuration(osv.osv_memory):
This installs the module analytic_user_function."""),
'module_project': fields.boolean("Project"),
'module_sale_stock': fields.boolean("Sale and Warehouse Management",
- help="""Allows you to Make Quotation, Sale Order using different Order policy and Manage Related Stock """),
+ help="""Allows you to Make Quotation, Sale Order using different Order policy and Manage Related Stock.
+ This installs the module sale_stock."""),
}
def default_get(self, cr, uid, fields, context=None):
diff --git a/addons/sale_stock/__openerp__.py b/addons/sale_stock/__openerp__.py
index 37671cdb7cb..1bbafae7952 100644
--- a/addons/sale_stock/__openerp__.py
+++ b/addons/sale_stock/__openerp__.py
@@ -25,41 +25,33 @@
'category': 'Hidden',
'summary': 'Quotation, Sale Orders, Delivery & Invoicing Control',
'description': """
-
-This Module manage quotations and sales orders.
-===========================================================================
+Manage sales quotations and orders
+==================================
-Workflow with validation steps:
--------------------------------
- * **Quotation** -> **Sales order** -> **Invoice**
+This application allows you to manage your sales goals in an effective and efficient manner by keeping track of all sales orders and history.
-Create Invoice:
----------------
- * Invoice on Demand
- * Invoice on Delivery Order
- * Invoice Before Delivery
+It handles the full sales workflow:
-Partners preferences:
----------------------
- * Incoterm
- * Shipping
- * Invoicing
+* **Quotation** -> **Sales order** -> **Invoice**
-Products stocks and prices:
----------------------------
+Preferences
+-----------
+* Shipping: Choice of delivery at once or partial delivery
+* Invoicing: choose how invoices will be paid
+* Incoterms: International Commercial terms
-Delivery method:
------------------
- * The Poste
- * Free Delivery Charges
- * Normal Delivery Charges
- * Based on the Delivery Order(if not Add to sale order)
+You can choose flexible invoicing methods:
-Dashboard for Sales Manager that includes:
-------------------------------------------
- * My Quotations
- * Monthly Turnover (Graph)
- """,
+* *On Demand*: Invoices are created manually from Sales Orders when needed
+* *On Delivery Order*: Invoices are generated from picking (delivery)
+* *Before Delivery*: A Draft invoice is created and must be paid before delivery
+
+
+The Dashboard for the Sales Manager will include
+------------------------------------------------
+* My Quotations
+* Monthly Turnover (Graph)
+""",
'author': 'OpenERP SA',
'website': 'http://www.openerp.com',
'images': [],
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 92df2f3c8fb..29adf643d62 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -212,20 +212,14 @@ class sale_order(osv.osv):
def action_wait(self, cr, uid, ids, context=None):
+ res = super(sale_order, self).action_wait(cr, uid, ids, context=context)
for o in self.browse(cr, uid, ids):
- if not o.order_line:
- raise osv.except_osv(_('Error!'),_('You cannot confirm a sale order which has no line.'))
noprod = self.test_no_product(cr, uid, o, context)
if noprod and o.order_policy=='picking':
self.write(cr, uid, [o.id], {'order_policy': 'manual'}, context=context)
- if (o.order_policy == 'manual') or noprod:
- self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
- else:
+ if not (o.order_policy == 'manual') or not noprod:
self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
- self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
- self.confirm_send_note(cr, uid, ids, context)
- return True
-
+ return res
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
picking_obj = self.pool.get('stock.picking')
From 51ee2bf5ea6258dd05dbec24e76a9150502b0e34 Mon Sep 17 00:00:00 2001
From: "Vidhin Mehta (OpenERP)"
Date: Mon, 17 Sep 2012 11:23:26 +0530
Subject: [PATCH 107/166] [IMP]kanban view fix vertical group text possition.
bzr revid: vme@tinyerp.com-20120917055326-p7egwibhy2skyowm
---
addons/web_kanban/static/src/css/kanban.css | 2 +-
addons/web_kanban/static/src/css/kanban.sass | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/web_kanban/static/src/css/kanban.css b/addons/web_kanban/static/src/css/kanban.css
index 48cf725ead3..96d8e021347 100644
--- a/addons/web_kanban/static/src/css/kanban.css
+++ b/addons/web_kanban/static/src/css/kanban.css
@@ -135,7 +135,7 @@
white-space: nowrap;
display: none;
position: relative;
- top: 5px;
+ top: 25px;
}
.openerp .oe_kanban_view .oe_kanban_add, .openerp .oe_kanban_view .oe_kanban_header .oe_dropdown_toggle {
margin-left: 4px;
diff --git a/addons/web_kanban/static/src/css/kanban.sass b/addons/web_kanban/static/src/css/kanban.sass
index 95a63dbd1a2..a59c331bd1a 100644
--- a/addons/web_kanban/static/src/css/kanban.sass
+++ b/addons/web_kanban/static/src/css/kanban.sass
@@ -146,7 +146,7 @@
white-space: nowrap
display: none
position: relative
- top: 5px
+ top: 25px
// }}}
// KanbanQuickCreate {{{
.oe_kanban_add, .oe_kanban_header .oe_dropdown_toggle
From eef634b3dc0616bc3fba6f980f022e10afe32984 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Mon, 17 Sep 2012 11:51:00 +0530
Subject: [PATCH 108/166] [IMP]: Improve sale stock action_wait method
bzr revid: atp@tinyerp.com-20120917062100-pb6msmh01t4kirca
---
addons/sale/sale.py | 2 ++
addons/sale_stock/sale_stock.py | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/sale/sale.py b/addons/sale/sale.py
index 08fbeb87f02..1a17a389a9b 100644
--- a/addons/sale/sale.py
+++ b/addons/sale/sale.py
@@ -594,6 +594,8 @@ class sale_order(osv.osv):
noprod = self.test_no_product(cr, uid, o, context)
if (o.order_policy == 'manual') or noprod:
self.write(cr, uid, [o.id], {'state': 'manual', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
+ else:
+ self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
self.pool.get('sale.order.line').button_confirm(cr, uid, [x.id for x in o.order_line])
self.confirm_send_note(cr, uid, ids, context)
return True
diff --git a/addons/sale_stock/sale_stock.py b/addons/sale_stock/sale_stock.py
index 29adf643d62..bd81f2b1902 100644
--- a/addons/sale_stock/sale_stock.py
+++ b/addons/sale_stock/sale_stock.py
@@ -217,8 +217,6 @@ class sale_order(osv.osv):
noprod = self.test_no_product(cr, uid, o, context)
if noprod and o.order_policy=='picking':
self.write(cr, uid, [o.id], {'order_policy': 'manual'}, context=context)
- if not (o.order_policy == 'manual') or not noprod:
- self.write(cr, uid, [o.id], {'state': 'progress', 'date_confirm': fields.date.context_today(self, cr, uid, context=context)})
return res
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):
From 924b15f9747c81fd4381746a4bf12c60516e8f79 Mon Sep 17 00:00:00 2001
From: "Atul Patel (OpenERP)"
Date: Mon, 17 Sep 2012 12:44:59 +0530
Subject: [PATCH 109/166] [FIX]: Fix res configuration problem.
bzr revid: atp@tinyerp.com-20120917071459-tk7yropfczkfws22
---
addons/sale_stock/res_config.py | 2 +-
addons/sale_stock/security/sale_stock_security.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/addons/sale_stock/res_config.py b/addons/sale_stock/res_config.py
index 796a4cc20c5..36e1dc7ed21 100644
--- a/addons/sale_stock/res_config.py
+++ b/addons/sale_stock/res_config.py
@@ -30,7 +30,7 @@ class sale_configuration(osv.osv_memory):
implied_group='sale.group_invoice_so_lines',
help="To allow your salesman to make invoices for sale order lines using the menu 'Lines to Invoice'."),
'group_invoice_deli_orders': fields.boolean('Generate invoices after and based on delivery orders',
- implied_group='sale.group_invoice_deli_orders',
+ implied_group='sale_stock.group_invoice_deli_orders',
help="To allow your salesman to make invoices for Delivery Orders using the menu 'Deliveries to Invoice'."),
'task_work': fields.boolean("Prepare invoices based on task's activities",
help="""Lets you transfer the entries under tasks defined for Project Management to
diff --git a/addons/sale_stock/security/sale_stock_security.xml b/addons/sale_stock/security/sale_stock_security.xml
index ac8bfef9864..7f93084d43d 100644
--- a/addons/sale_stock/security/sale_stock_security.xml
+++ b/addons/sale_stock/security/sale_stock_security.xml
@@ -5,7 +5,7 @@
Enable Invoicing Delivery orders
-
+
From 230ed4a0614f2f7aa61b5652c31cd80ae3ea7f21 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Mon, 17 Sep 2012 10:23:04 +0200
Subject: [PATCH 110/166] fixed bug
bzr revid: nicolas.vanhoren@openerp.com-20120917082304-uufuuwa8gwtg39y3
---
addons/account/static/src/js/account_move_reconciliation.js | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index ab15242d593..ceda8417d75 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -16,12 +16,11 @@ openerp.account = function (instance) {
return tmp;
},
do_search: function(domain, context, group_by) {
- var sup = this._super;
+ var sup = _.bind(this._super, this);
var mod = new instance.web.Model(this.model, context, domain);
return mod.query("partner_id").group_by(["partner_id"]).pipe(function(result) {
var vals = _.chain(result).pluck("attributes").pluck("value")
.filter(function(el) {return !!el;}).value();
- debugger;
return sup(new instance.web.CompoundDomain(domain, [["partner_id", "in", _.pluck(vals, 0)]]), context, group_by);
});
},
From 8bca30ec6f9dcdb62333cffd09ab1471bc9eb5ac Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Mon, 17 Sep 2012 10:41:30 +0200
Subject: [PATCH 111/166] wip
bzr revid: nicolas.vanhoren@openerp.com-20120917084130-c3x2ryabewwksy5h
---
.../static/src/js/account_move_reconciliation.js | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index ceda8417d75..9d61152d6a6 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -16,14 +16,24 @@ openerp.account = function (instance) {
return tmp;
},
do_search: function(domain, context, group_by) {
- var sup = _.bind(this._super, this);
+ var self = this;
+ this.last_domain = domain;
+ this.last_context = context;
+ this.last_group_by = group_by;
+ this.old_search = _.bind(this._super, this);
var mod = new instance.web.Model(this.model, context, domain);
return mod.query("partner_id").group_by(["partner_id"]).pipe(function(result) {
- var vals = _.chain(result).pluck("attributes").pluck("value")
+ self.partners = _.chain(result).pluck("attributes").pluck("value")
.filter(function(el) {return !!el;}).value();
- return sup(new instance.web.CompoundDomain(domain, [["partner_id", "in", _.pluck(vals, 0)]]), context, group_by);
+ self.current_partner = self.partners.length == 0 ? null : 0;
+ return self.search_by_partner(self.current_partner);
+
});
},
+ search_by_partner: function(partner) {
+ return this.old_search(new instance.web.CompoundDomain(this.last_domain, [["partner_id", "in", partner === null ? [] : [this.partners[partner][0]] ]]),
+ this.last_context, this.last_group_by);
+ }
});
/*instance.web.views.add('form_clone', 'instance.account.extend_form_view');
From 48c3104836f5dccf0e36ac8e22ce3c2c30319b73 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Mon, 17 Sep 2012 11:55:18 +0200
Subject: [PATCH 112/166] wip
bzr revid: nicolas.vanhoren@openerp.com-20120917095518-fco1enwa3yl7mo2b
---
.../static/src/js/account_move_reconciliation.js | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 9d61152d6a6..9e4b9fd30dd 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -9,10 +9,11 @@ openerp.account = function (instance) {
instance.web.account.ReconciliationListView = instance.web.ListView.extend({
init: function() {
this._super.apply(this, arguments);
+ this.current_partner = null;
},
on_loaded: function() {
var tmp = this._super.apply(this, arguments);
- this.$el.prepend(QWeb.render("AccountReconciliation"));
+ this.$el.prepend(QWeb.render("AccountReconciliation", {widget: self}));
return tmp;
},
do_search: function(domain, context, group_by) {
@@ -26,14 +27,13 @@ openerp.account = function (instance) {
self.partners = _.chain(result).pluck("attributes").pluck("value")
.filter(function(el) {return !!el;}).value();
self.current_partner = self.partners.length == 0 ? null : 0;
- return self.search_by_partner(self.current_partner);
-
+ self.search_by_partner();
});
},
- search_by_partner: function(partner) {
- return this.old_search(new instance.web.CompoundDomain(this.last_domain, [["partner_id", "in", partner === null ? [] : [this.partners[partner][0]] ]]),
- this.last_context, this.last_group_by);
- }
+ search_by_partner: function() {
+ return this.old_search(new instance.web.CompoundDomain(this.last_domain, [["partner_id", "in", this.current_partner === null ? [] :
+ [this.partners[this.current_partner][0]] ]]), this.last_context, this.last_group_by);
+ },
});
/*instance.web.views.add('form_clone', 'instance.account.extend_form_view');
From 5638e061a84077bf03ce9853f974f1490cfd42e9 Mon Sep 17 00:00:00 2001
From: niv-openerp
Date: Mon, 17 Sep 2012 14:04:42 +0200
Subject: [PATCH 113/166] wip
bzr revid: nicolas.vanhoren@openerp.com-20120917120442-y9921oljzpiwdvv0
---
.../src/js/account_move_reconciliation.js | 3 +-
.../src/xml/account_move_reconciliation.xml | 74 ++++---------------
2 files changed, 17 insertions(+), 60 deletions(-)
diff --git a/addons/account/static/src/js/account_move_reconciliation.js b/addons/account/static/src/js/account_move_reconciliation.js
index 9e4b9fd30dd..5f86171b8e7 100644
--- a/addons/account/static/src/js/account_move_reconciliation.js
+++ b/addons/account/static/src/js/account_move_reconciliation.js
@@ -13,7 +13,8 @@ openerp.account = function (instance) {
},
on_loaded: function() {
var tmp = this._super.apply(this, arguments);
- this.$el.prepend(QWeb.render("AccountReconciliation", {widget: self}));
+ if (this.partners)
+ this.$el.prepend(QWeb.render("AccountReconciliation", {widget: this}));
return tmp;
},
do_search: function(domain, context, group_by) {
diff --git a/addons/account/static/src/xml/account_move_reconciliation.xml b/addons/account/static/src/xml/account_move_reconciliation.xml
index b40e00f5e99..33adc4e64a0 100644
--- a/addons/account/static/src/xml/account_move_reconciliation.xml
+++ b/addons/account/static/src/xml/account_move_reconciliation.xml
@@ -4,65 +4,21 @@
-