[MERGE] forward port of branch 7.0 up to da15c9d
This commit is contained in:
commit
7ab413724a
|
@ -1157,6 +1157,19 @@ class account_move(osv.osv):
|
|||
_description = "Account Entry"
|
||||
_order = 'id desc'
|
||||
|
||||
def account_assert_balanced(self, cr, uid, context=None):
|
||||
cr.execute("""\
|
||||
SELECT move_id
|
||||
FROM account_move_line
|
||||
WHERE state = 'valid'
|
||||
GROUP BY move_id
|
||||
HAVING abs(sum(debit) - sum(credit)) > 0.00001
|
||||
""")
|
||||
assert len(cr.fetchall()) == 0, \
|
||||
"For all Journal Items, the state is valid implies that the sum " \
|
||||
"of credits equals the sum of debits"
|
||||
return True
|
||||
|
||||
def account_move_prepare(self, cr, uid, journal_id, date=False, ref='', company_id=False, context=None):
|
||||
'''
|
||||
Prepares and returns a dictionary of values, ready to be passed to create() based on the parameters received.
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<assert model="account.move" search="[]" string="For all Journal Items, the state is valid implies that the sum of credits equals the sum of debits">
|
||||
<test expr="not len(line_id) or line_id[0].state != 'valid' or (sum([l.debit - l.credit for l in line_id]) <= 0.00001)"/>
|
||||
</assert>
|
||||
<function name="account_assert_balanced" model="account.move"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -25,5 +25,11 @@
|
|||
<field name="global" eval="True" />
|
||||
<field name="domain_force">[('warehouse_id.company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
<record id="rule_pos_order_report_multi_company" model="ir.rule">
|
||||
<field name="name">Point Of Sale Order Analysis multi-company</field>
|
||||
<field name="model_id" ref="model_report_pos_order"/>
|
||||
<field name="global" eval="True"/>
|
||||
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -671,7 +671,7 @@ function openerp_pos_models(instance, module){ //module is instance.point_of_sal
|
|||
get_all_prices: function(){
|
||||
var self = this;
|
||||
var currency_rounding = this.pos.currency.rounding;
|
||||
var base = round_pr(this.get_quantity() * this.get_unit_price() * (1.0 - (this.get_discount() / 100.0)), currency_rounding);
|
||||
var base = round_pr(round_pr(this.get_quantity() * this.get_unit_price(), currency_rounding) * (1.0 - (this.get_discount() / 100.0)), currency_rounding);
|
||||
var totalTax = base;
|
||||
var totalNoTax = base;
|
||||
|
||||
|
|
|
@ -790,7 +790,7 @@ class product_product(osv.osv):
|
|||
if not limit or len(ids) < limit:
|
||||
# we may underrun the limit because of dupes in the results, that's fine
|
||||
limit2 = (limit - len(ids)) if limit else False
|
||||
ids.update(self.search(cr, user, args + [('name', operator, name)], limit=limit2, context=context))
|
||||
ids.update(self.search(cr, user, args + [('name', operator, name), ('id', 'not in', list(ids))], limit=limit2, context=context))
|
||||
ids = list(ids)
|
||||
elif not ids and operator in expression.NEGATIVE_TERM_OPERATORS:
|
||||
ids = self.search(cr, user, args + ['&', ('default_code', operator, name), ('name', operator, name)], limit=limit, context=context)
|
||||
|
|
|
@ -474,7 +474,7 @@ class purchase_order(osv.osv):
|
|||
if not acc_id:
|
||||
acc_id = po_line.product_id.categ_id.property_account_expense_categ.id
|
||||
if not acc_id:
|
||||
raise osv.except_osv(_('Error!'), _('Define expense account for this company: "%s" (id:%d).') % (po_line.product_id.name, po_line.product_id.id,))
|
||||
raise osv.except_osv(_('Error!'), _('Define expense account for this product: "%s" (id:%d).') % (po_line.product_id.name, po_line.product_id.id,))
|
||||
else:
|
||||
acc_id = property_obj.get(cr, uid, 'property_account_expense_categ', 'product.category', context=context).id
|
||||
fpos = po_line.order_id.fiscal_position or False
|
||||
|
|
|
@ -2340,6 +2340,9 @@ class stock_move(osv.osv):
|
|||
context = {}
|
||||
src_company_ctx = dict(context,force_company=move.location_id.company_id.id)
|
||||
dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id)
|
||||
# do not take the company of the one of the user
|
||||
# used to select the correct period
|
||||
company_ctx = dict(context, company_id=move.company_id.id)
|
||||
account_moves = []
|
||||
# Outgoing moves (or cross-company output part)
|
||||
if move.location_id.company_id \
|
||||
|
@ -2371,7 +2374,8 @@ class stock_move(osv.osv):
|
|||
{
|
||||
'journal_id': j_id,
|
||||
'line_id': move_lines,
|
||||
'ref': move.picking_id and move.picking_id.name}, context=context)
|
||||
'company_id': move.company_id.id,
|
||||
'ref': move.picking_id and move.picking_id.name}, context=company_ctx)
|
||||
|
||||
def action_done(self, cr, uid, ids, context=None):
|
||||
""" Makes the move done and if all moves are done, it will finish the picking.
|
||||
|
|
|
@ -1521,7 +1521,11 @@ instance.web.search.DateField = instance.web.search.Field.extend(/** @lends inst
|
|||
return instance.web.date_to_str(facetValue.get('value'));
|
||||
},
|
||||
complete: function (needle) {
|
||||
var d = Date.parse(needle);
|
||||
try {
|
||||
var d = instance.web.str_to_date(instance.web.parse_value(needle, {'widget': 'date'}));
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
if (!d) { return $.when(null); }
|
||||
var date_string = instance.web.format_value(d, this.attrs);
|
||||
var label = _.str.sprintf(_.str.escapeHTML(
|
||||
|
|
|
@ -4109,7 +4109,6 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
|
|||
if (!this.fields_view || !this.editable()){
|
||||
return true;
|
||||
}
|
||||
this.o2m._dirty_flag = true;
|
||||
var r;
|
||||
return _.every(this.records.records, function(record){
|
||||
r = record;
|
||||
|
|
Loading…
Reference in New Issue