[MERGE] forward port branch 10.0 up to 5e682451cb

This commit is contained in:
Christophe Simonis
2018-07-10 11:30:59 +02:00
9 changed files with 31 additions and 8 deletions
+3 -1
View File
@@ -244,6 +244,9 @@ class AccountMove(models.Model):
date = date or fields.Date.today()
reversed_moves = self.env['account.move']
for ac_move in self:
#unreconcile all lines reversed
aml = ac_move.line_ids.filtered(lambda x: x.account_id.reconcile or x.account_id.internal_type == 'liquidity')
aml.remove_move_reconcile()
reversed_move = ac_move._reverse_move(date=date,
journal_id=journal_id)
reversed_moves |= reversed_move
@@ -1743,7 +1746,6 @@ class AccountPartialReconcile(models.Model):
""" When removing a partial reconciliation, also unlink its full reconciliation if it exists """
full_to_unlink = self.env['account.full.reconcile']
for rec in self:
#without the deleted partial reconciliations, the full reconciliation won't be full anymore
if rec.full_reconcile_id:
full_to_unlink |= rec.full_reconcile_id
#reverse the tax basis move created at the reconciliation time
+4
View File
@@ -131,6 +131,8 @@ class OAuthController(http.Controller):
def signin(self, **kw):
state = json.loads(kw['state'])
dbname = state['d']
if not http.db_filter([dbname]):
return BadRequest()
provider = state['p']
context = state.get('c', {})
registry = registry_get(dbname)
@@ -180,6 +182,8 @@ class OAuthController(http.Controller):
dbname = db_monodb()
if not dbname:
return BadRequest()
if not http.db_filter([dbname]):
return BadRequest()
registry = registry_get(dbname)
with registry.cursor() as cr:
+8
View File
@@ -871,6 +871,14 @@ class Meeting(models.Model):
self.start = self.start_datetime
self.stop = fields.Datetime.to_string(start + timedelta(hours=self.duration))
@api.onchange('start_date')
def _onchange_start_date(self):
self.start = self.start_date
@api.onchange('stop_date')
def _onchange_stop_date(self):
self.stop = self.stop_date
####################################################
# Calendar Business, Reccurency, ...
####################################################
@@ -844,7 +844,7 @@ class GoogleCalendar(models.AbstractModel):
try:
# if already deleted from gmail or never created
recs.delete_an_event(current_event[0])
except Exception, e:
except urllib2.HTTPError, e:
if e.code in (401, 410,):
pass
else:
+7 -1
View File
@@ -221,7 +221,7 @@ exports.PosModel = Backbone.Model.extend({
fields: ['id', 'journal_ids','name','user_id','config_id','start_at','stop_at','sequence_number','login_number'],
domain: function(self){ return [['state','=','opened'],['user_id','=',session.uid]]; },
loaded: function(self,pos_sessions){
self.pos_session = pos_sessions[0];
self.pos_session = pos_sessions[0];
},
},{
model: 'pos.config',
@@ -241,6 +241,8 @@ exports.PosModel = Backbone.Model.extend({
self.db.set_uuid(self.config.uuid);
self.cashier = self.get_cashier();
// We need to do it here, since only then the local storage has the correct uuid
self.db.save('pos_session_id', self.pos_session.id);
var orders = self.db.get_orders();
for (var i = 0; i < orders.length; i++) {
@@ -577,6 +579,10 @@ exports.PosModel = Backbone.Model.extend({
// returns the user who is currently the cashier for this point of sale
get_cashier: function(){
// reset the cashier to the current user if session is new
if (this.db.load('pos_session_id') !== this.pos_session.id) {
this.set_cashier(this.user);
}
return this.db.get_cashier() || this.cashier || this.user;
},
// changes the current cashier
+2 -2
View File
@@ -52,7 +52,7 @@ class TestSaleStock(TestSale):
pick_2 = self.so.picking_ids[0]
pick_2.force_assign()
pick_2.pack_operation_product_ids.write({'qty_done': 1})
self.assertTrue(pick_2.do_new_transfer(), 'Sale Stock: second picking should be final without need for a backorder')
self.assertIsNone(pick_2.do_new_transfer(), 'Sale Stock: second picking should be final without need for a backorder')
self.assertEqual(self.so.invoice_status, 'to invoice', 'Sale Stock: so invoice_status should be "to invoice" after complete delivery')
del_qties = [sol.qty_delivered for sol in self.so.order_line]
del_qties_truth = [2.0 if sol.product_id.type in ['product', 'consu'] else 0.0 for sol in self.so.order_line]
@@ -100,7 +100,7 @@ class TestSaleStock(TestSale):
pick = self.so.picking_ids
pick.force_assign()
pick.pack_operation_product_ids.write({'qty_done': 2})
self.assertTrue(pick.do_new_transfer(), 'Sale Stock: complete delivery should not need a backorder')
self.assertIsNone(pick.do_new_transfer(), 'Sale Stock: complete delivery should not need a backorder')
del_qties = [sol.qty_delivered for sol in self.so.order_line]
del_qties_truth = [2.0 if sol.product_id.type in ['product', 'consu'] else 0.0 for sol in self.so.order_line]
self.assertEqual(del_qties, del_qties_truth, 'Sale Stock: delivered quantities are wrong after partial delivery')
+1 -1
View File
@@ -842,7 +842,7 @@ class Picking(models.Model):
if pack_operations_delete:
pack_operations_delete.unlink()
self.do_transfer()
return True
return
def check_backorder(self):
need_rereserve, all_op_processed = self.picking_recompute_remaining_quantities(done_qtys=True)
+2 -2
View File
@@ -26,7 +26,7 @@ class Http(models.AbstractModel):
"session_id": request.session.sid,
"uid": request.session.uid,
"is_system": request.env.user._is_system(),
"is_superuser": request.env.user._is_superuser(),
"is_superuser": request.env.user._is_superuser() if request.session.uid else False,
"user_context": request.session.get_context() if request.session.uid else {},
"db": request.session.db,
"server_version": version_info.get('server_version'),
@@ -36,7 +36,7 @@ class Http(models.AbstractModel):
"company_id": request.env.user.company_id.id if request.session.uid else None,
"partner_id": request.env.user.partner_id.id if request.session.uid and request.env.user.partner_id else None,
"user_companies": {'current_company': (user.company_id.id, user.company_id.name), 'allowed_companies': [(comp.id, comp.name) for comp in user.company_ids]} if display_switch_company_menu else False,
"currencies": self.get_currencies(),
"currencies": self.get_currencies() if request.session.uid else {},
}
def get_currencies(self):
+3
View File
@@ -4,6 +4,7 @@
import logging
from odoo import api, models
from odoo.exceptions import AccessDenied
_logger = logging.getLogger(__name__)
@@ -36,6 +37,8 @@ class AutoVacuum(models.AbstractModel):
@api.model
def power_on(self):
if not self.env.user._is_admin():
raise AccessDenied()
self.env['ir.attachment']._file_gc()
self._gc_transient_models()
self._gc_user_logs()