Skip to content

Commit

Permalink
Merge remote-tracking branch 'odoo/master' into master-default-order-…
Browse files Browse the repository at this point in the history
…list-ged
  • Loading branch information
ged-odoo committed Jun 23, 2014
2 parents 32ac515 + e862ff7 commit 31a8d3d
Show file tree
Hide file tree
Showing 147 changed files with 1,912 additions and 1,466 deletions.
2 changes: 0 additions & 2 deletions addons/.bzrignore

This file was deleted.

312 changes: 197 additions & 115 deletions addons/account/account_bank_statement.py

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion addons/account/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ def _get_invoice_from_reconcile(self, cr, uid, ids, context=None):
},
multi='all'),
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}, track_visibility='always'),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]},
domain="[('type', 'in', {'out_invoice': ['sale'], 'out_refund': ['sale_refund'], 'in_refund': ['purchase_refund'], 'in_invoice': ['purchase']}.get(type, [])), ('company_id', '=', company_id)]"),
'company_id': fields.many2one('res.company', 'Company', required=True, change_default=True, readonly=True, states={'draft':[('readonly',False)]}),
'check_total': fields.float('Verification Total', digits_compute=dp.get_precision('Account'), readonly=True, states={'draft':[('readonly',False)]}),
'reconciled': fields.function(_reconciled, string='Paid/Reconciled', type='boolean',
Expand Down
8 changes: 5 additions & 3 deletions addons/account/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def _amount_residual(self, cr, uid, ids, field_names, args, context=None):

if move_line.reconcile_id:
continue
if not move_line.account_id.type in ('payable', 'receivable'):
#this function does not suport to be used on move lines not related to payable or receivable accounts
if not move_line.account_id.reconcile:
#this function does not suport to be used on move lines not related to a reconcilable account
continue

if move_line.currency_id:
Expand Down Expand Up @@ -741,6 +741,8 @@ def onchange_account_id(self, cr, uid, ids, account_id=False, partner_id=False,
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
if context is None:
context = {}
if context.get('fiscalyear'):
args.append(('period_id.fiscalyear_id', '=', context.get('fiscalyear', False)))
if context and context.get('next_partner_only', False):
if not context.get('partner_id', False):
partner = self.list_partners_to_reconcile(cr, uid, context=context)
Expand Down Expand Up @@ -823,7 +825,7 @@ def reconcile_partial(self, cr, uid, ids, type='auto', context=None, writeoff_ac
'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge)
}, context=context)
move_rec_obj.reconcile_partial_check(cr, uid, [r_id] + merges_rec, context=context)
return True
return r_id

def reconcile(self, cr, uid, ids, type='auto', writeoff_acc_id=False, writeoff_period_id=False, writeoff_journal_id=False, context=None):
account_obj = self.pool.get('account.account')
Expand Down
2 changes: 1 addition & 1 deletion addons/account/account_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
<act_window
id="action_account_items"
name="Journal Items"
context="{'search_default_account_id': [active_id]}"
context="{'search_default_account_id': [active_id], 'fiscalyear': context.get('fiscalyear')}"
res_model="account.move.line"
src_model="account.account"
key2="tree_but_open"/>
Expand Down
8 changes: 4 additions & 4 deletions addons/account/demo/account_bank_statement.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<field name="balance_end_real" eval="3707.58"/>
</record>
<record id="demo_bank_statement_line_1" model="account.bank.statement.line">
<field name="ref">001</field>
<field name="ref"></field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="1"/>
<field name="company_id" ref="base.main_company"/>
Expand All @@ -26,7 +26,7 @@
<field name="partner_id" ref="base.res_partner_9"/>
</record>
<record id="demo_bank_statement_line_2" model="account.bank.statement.line">
<field name="ref">002</field>
<field name="ref">SAJ2014002</field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="2"/>
<field name="company_id" ref="base.main_company"/>
Expand All @@ -37,7 +37,7 @@
<field name="partner_id" ref="base.res_partner_9"/>
</record>
<record id="demo_bank_statement_line_3" model="account.bank.statement.line">
<field name="ref">003</field>
<field name="ref"></field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="3"/>
<field name="company_id" ref="base.main_company"/>
Expand All @@ -47,7 +47,7 @@
<field name="date" eval="time.strftime('%Y')+'-01-01'"/>
</record>
<record id="demo_bank_statement_line_4" model="account.bank.statement.line">
<field name="ref">004</field>
<field name="ref"></field>
<field name="statement_id" ref="demo_bank_statement_1"/>
<field name="sequence" eval="4"/>
<field name="company_id" ref="base.main_company"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@
cursor: pointer; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_match:not(.no_partner) .toggle_match {
visibility: hidden !important; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .partner_name, .openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line.no_partner .line_open_balance {
display: none !important; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line > table > tbody > tr:nth-child(1) > td table {
margin-bottom: 10px; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line table.details td:first-child {
Expand Down Expand Up @@ -202,10 +200,6 @@
cursor: pointer; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view td:nth-child(6) {
border-left: 1px solid black; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(5) {
border-top: 1px solid black; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .accounting_view tr.initial_line > td:nth-child(6) {
border-top: 1px solid black; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls {
padding: 0 0 5px 18px; }
.openerp .oe_bank_statement_reconciliation .oe_bank_statement_reconciliation_line .match .match_controls .filter {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,6 @@ $initialLineBackground: #f0f0f0;
}
}

&.no_partner {
.partner_name, .line_open_balance {
display: none !important;
}
}

/* gap between accounting_view and action view */
> table > tbody > tr:nth-child(1) > td table {
margin-bottom: 10px;
Expand Down Expand Up @@ -341,10 +335,6 @@ $initialLineBackground: #f0f0f0;

// accounting "T"
td:nth-child(6) { border-left: $accountingBorder; }
tr.initial_line > td {
&:nth-child(5) { border-top: $accountingBorder; }
&:nth-child(6) { border-top: $accountingBorder; }
}
}


Expand Down
59 changes: 31 additions & 28 deletions addons/account/static/src/js/account_widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ openerp.account = function (instance) {
deferred_promises.push(self.model_bank_statement
.call("get_format_currency_js_function", [self.statement_id])
.then(function(data){
self.formatCurrency = new Function("amount", data);
self.formatCurrency = new Function("amount, currency_id", data);
})
);

Expand Down Expand Up @@ -245,7 +245,7 @@ openerp.account = function (instance) {

keyboardShortcutsHandler: function(e) {
var self = this;
if (e.which === 13 && (e.ctrlKey || e.metaKey)) {
if ((e.which === 13 || e.which === 10) && (e.ctrlKey || e.metaKey)) {
$.each(self.getChildren(), function(i, o){
if (o.is_valid && o.persistAndDestroy()) {
self.lines_reconciled_with_ctrl_enter++;
Expand Down Expand Up @@ -789,6 +789,9 @@ openerp.account = function (instance) {
line.q_amount = (line.debit !== 0 ? "- "+line.q_debit : "") + (line.credit !== 0 ? line.q_credit : "");
line.q_popover = QWeb.render("bank_statement_reconciliation_move_line_details", {line: line});
line.q_label = line.name;
if (line.has_no_partner){
line.q_label = line.partner_name + ': ' +line.q_label;
}

// WARNING : pretty much of a ugly hack
// The value of account_move.ref is either the move's communication or it's name without the slashes
Expand Down Expand Up @@ -981,6 +984,7 @@ openerp.account = function (instance) {
lineOpenBalanceClickHandler: function() {
var self = this;
if (self.get("mode") === "create") {
self.addLineBeingEdited();
self.set("mode", "match");
} else {
self.set("mode", "create");
Expand Down Expand Up @@ -1038,7 +1042,8 @@ openerp.account = function (instance) {
var slice_start = self.get("pager_index") * self.max_move_lines_displayed;
var slice_end = (self.get("pager_index")+1) * self.max_move_lines_displayed;
_( _.filter(self.mv_lines_deselected, function(o){
return o.name.indexOf(self.filter) !== -1 || o.ref.indexOf(self.filter) !== -1 })
return o.q_label.indexOf(self.filter) !== -1 || (o.ref && o.ref.indexOf(self.filter) !== -1)
})
.slice(slice_start, slice_end)).each(function(line){
var $line = $(QWeb.render("bank_statement_reconciliation_move_line", {line: line, selected: false}));
self.bindPopoverTo($line.find(".line_info_button"));
Expand All @@ -1057,7 +1062,6 @@ openerp.account = function (instance) {

updatePagerControls: function() {
var self = this;

if (self.get("pager_index") === 0)
self.$(".pager_control_left").addClass("disabled");
else
Expand All @@ -1075,7 +1079,7 @@ openerp.account = function (instance) {
balanceChanged: function() {
var self = this;
var balance = self.get("balance");

self.$(".tbody_open_balance").empty();
// Special case hack : no identified partner
if (self.st_line.has_no_partner) {
if (Math.abs(balance).toFixed(3) === "0.000") {
Expand All @@ -1088,19 +1092,23 @@ openerp.account = function (instance) {
self.$(".button_ok").attr("disabled", "disabled");
self.$(".button_ok").text("OK");
self.is_valid = false;
var debit = (balance > 0 ? self.formatCurrency(balance, self.st_line.currency_id) : "");
var credit = (balance < 0 ? self.formatCurrency(-1*balance, self.st_line.currency_id) : "");
var $line = $(QWeb.render("bank_statement_reconciliation_line_open_balance", {debit: debit, credit: credit, account_code: self.map_account_id_code[self.st_line.open_balance_account_id]}));
$line.find('.js_open_balance')[0].innerHTML = "Choose counterpart";
self.$(".tbody_open_balance").append($line);
}
return;
}

self.$(".tbody_open_balance").empty();
if (Math.abs(balance).toFixed(3) === "0.000") {
self.$(".button_ok").addClass("oe_highlight");
self.$(".button_ok").text("OK");
} else {
self.$(".button_ok").removeClass("oe_highlight");
self.$(".button_ok").text("Keep open");
var debit = (balance > 0 ? self.formatCurrency(balance) : "");
var credit = (balance < 0 ? self.formatCurrency(-1*balance) : "");
var debit = (balance > 0 ? self.formatCurrency(balance, self.st_line.currency_id) : "");
var credit = (balance < 0 ? self.formatCurrency(-1*balance, self.st_line.currency_id) : "");
var $line = $(QWeb.render("bank_statement_reconciliation_line_open_balance", {debit: debit, credit: credit, account_code: self.map_account_id_code[self.st_line.open_balance_account_id]}));
self.$(".tbody_open_balance").append($line);
}
Expand All @@ -1111,21 +1119,15 @@ openerp.account = function (instance) {

self.$(".action_pane.active").removeClass("active");

// Special case hack : if no_partner, either inactive or create
// Special case hack : if no_partner and mode == inactive
if (self.st_line.has_no_partner) {
if (self.get("mode") === "inactive") {
self.$(".match").slideUp(self.animation_speed);
self.$(".create").slideUp(self.animation_speed);
self.$(".toggle_match").removeClass("visible_toggle");
self.el.dataset.mode = "inactive";
} else {
self.initializeCreateForm();
self.$(".match").slideUp(self.animation_speed);
self.$(".create").slideDown(self.animation_speed);
self.$(".toggle_match").addClass("visible_toggle");
self.el.dataset.mode = "create";
}
return;
return;
}
}

if (self.get("mode") === "inactive") {
Expand Down Expand Up @@ -1198,6 +1200,8 @@ openerp.account = function (instance) {
var self = this;
var line_created_being_edited = self.get("line_created_being_edited");
line_created_being_edited[0][elt.corresponding_property] = val.newValue;

line_created_being_edited[0].currency_id = self.st_line.currency_id;

// Specific cases
if (elt === self.account_id_field)
Expand All @@ -1215,7 +1219,7 @@ openerp.account = function (instance) {
var tax = data.taxes[0];
var tax_account_id = (amount > 0 ? tax.account_collected_id : tax.account_paid_id)
line_created_being_edited[0].amount = (data.total.toFixed(3) === amount.toFixed(3) ? amount : data.total);
line_created_being_edited[1] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true};
line_created_being_edited[1] = {id: line_created_being_edited[0].id, account_id: tax_account_id, account_num: self.map_account_id_code[tax_account_id], label: tax.name, amount: tax.amount, no_remove_action: true, currency_id: self.st_line.currency_id};
}
);
} else {
Expand All @@ -1228,10 +1232,9 @@ openerp.account = function (instance) {
$.when(deferred_tax).then(function(){
// Format amounts
if (line_created_being_edited[0].amount)
line_created_being_edited[0].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[0].amount));
line_created_being_edited[0].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[0].amount), line_created_being_edited[0].currency_id);
if (line_created_being_edited[1] && line_created_being_edited[1].amount)
line_created_being_edited[1].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[1].amount));

line_created_being_edited[1].amount_str = self.formatCurrency(Math.abs(line_created_being_edited[1].amount), line_created_being_edited[0].currency_id);
self.set("line_created_being_edited", line_created_being_edited);
self.createdLinesChanged(); // TODO For some reason, previous line doesn't trigger change handler
});
Expand Down Expand Up @@ -1268,10 +1271,10 @@ openerp.account = function (instance) {
line.initial_amount = line.debit !== 0 ? line.debit : -1 * line.credit;
if (balance < 0) {
line.debit -= balance;
line.debit_str = self.formatCurrency(line.debit);
line.debit_str = self.formatCurrency(line.debit, self.st_line.currency_id);
} else {
line.credit -= balance;
line.credit_str = self.formatCurrency(line.credit);
line.credit_str = self.formatCurrency(line.credit, self.st_line.currency_id);
}
line.propose_partial_reconcile = false;
line.partial_reconcile = true;
Expand All @@ -1291,12 +1294,13 @@ openerp.account = function (instance) {
},

unpartialReconcileLine: function(line) {
var self = this;
if (line.initial_amount > 0) {
line.debit = line.initial_amount;
line.debit_str = this.formatCurrency(line.debit);
line.debit_str = self.formatCurrency(line.debit, self.st_line.currency_id);
} else {
line.credit = -1 * line.initial_amount;
line.credit_str = this.formatCurrency(line.credit);
line.credit_str = self.formatCurrency(line.credit, self.st_line.currency_id);
}
line.propose_partial_reconcile = true;
line.partial_reconcile = false;
Expand Down Expand Up @@ -1359,16 +1363,15 @@ openerp.account = function (instance) {
if (limit > 0) {
// Load move lines
deferred_move_lines = self.model_bank_statement_line
.call("get_move_lines_counterparts", [self.st_line.id, excluded_ids, self.filter, offset, limit])
.call("get_move_lines_counterparts_id", [self.st_line.id, excluded_ids, self.filter, offset, limit])
.then(function (lines) {
_(lines).each(self.decorateMoveLine.bind(self));
move_lines = lines;
});
}

// Fetch the number of move lines corresponding to this statement line and this filter
var deferred_total_move_lines_num = self.model_bank_statement_line
.call("get_move_lines_counterparts", [self.st_line.id, excluded_ids, self.filter, offset, limit, true])
.call("get_move_lines_counterparts_id", [self.st_line.id, excluded_ids, self.filter, 0, undefined, true])
.then(function(num){
move_lines_num = num;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
<td><span class="toggle_create glyphicon glyphicon-play"></span></td>
<td><t t-esc="account_code"/></td>
<td></td>
<td>Open balance</td>
<td class="js_open_balance">Open balance</td>
<td><t t-esc="debit"/></td>
<td><t t-esc="credit"/></td>
<td></td>
Expand Down
2 changes: 1 addition & 1 deletion addons/account/views/report_agedpartnerbalance.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
</tr>
<tr t-foreach="get_lines_with_out_partner(data['form'])" t-as="not_partner">
<td>
<span t-esc="partner['name']"/>
<span t-esc="not_partner['name']"/>
</td>
<td class="text-right">
<span t-esc="formatLang(not_partner['direction'], currency_obj=res_company.currency_id)"/>
Expand Down
Loading

0 comments on commit 31a8d3d

Please sign in to comment.