[MERGE] forward port of branch 8.0 up to cdf21eb
This commit is contained in:
@@ -2145,8 +2145,8 @@ class account_tax(osv.osv):
|
|||||||
|
|
||||||
@api.v8
|
@api.v8
|
||||||
def compute_all(self, price_unit, quantity, product=None, partner=None, force_excluded=False):
|
def compute_all(self, price_unit, quantity, product=None, partner=None, force_excluded=False):
|
||||||
return self._model.compute_all(
|
return account_tax.compute_all(
|
||||||
self._cr, self._uid, self, price_unit, quantity,
|
self._model, self._cr, self._uid, self, price_unit, quantity,
|
||||||
product=product, partner=partner, force_excluded=force_excluded)
|
product=product, partner=partner, force_excluded=force_excluded)
|
||||||
|
|
||||||
def compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None):
|
def compute(self, cr, uid, taxes, price_unit, quantity, product=None, partner=None):
|
||||||
|
|||||||
@@ -1206,7 +1206,7 @@ class account_invoice(models.Model):
|
|||||||
def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id,
|
def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id,
|
||||||
writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''):
|
writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''):
|
||||||
recs = self.browse(cr, uid, ids, context)
|
recs = self.browse(cr, uid, ids, context)
|
||||||
return recs.pay_and_reconcile(pay_amount, pay_account_id, period_id, pay_journal_id,
|
return account_invoice.pay_and_reconcile(recs, pay_amount, pay_account_id, period_id, pay_journal_id,
|
||||||
writeoff_acc_id, writeoff_period_id, writeoff_journal_id, name=name)
|
writeoff_acc_id, writeoff_period_id, writeoff_journal_id, name=name)
|
||||||
|
|
||||||
class account_invoice_line(models.Model):
|
class account_invoice_line(models.Model):
|
||||||
@@ -1614,7 +1614,7 @@ class account_invoice_tax(models.Model):
|
|||||||
def compute(self, cr, uid, invoice_id, context=None):
|
def compute(self, cr, uid, invoice_id, context=None):
|
||||||
recs = self.browse(cr, uid, [], context)
|
recs = self.browse(cr, uid, [], context)
|
||||||
invoice = recs.env['account.invoice'].browse(invoice_id)
|
invoice = recs.env['account.invoice'].browse(invoice_id)
|
||||||
return recs.compute(invoice)
|
return account_invoice_tax.compute(recs, invoice)
|
||||||
|
|
||||||
@api.model
|
@api.model
|
||||||
def move_line_get(self, invoice_id):
|
def move_line_get(self, invoice_id):
|
||||||
|
|||||||
@@ -821,4 +821,4 @@ class report_xml(osv.osv):
|
|||||||
if object_id:
|
if object_id:
|
||||||
model = self.pool.get('ir.model').browse(cr, uid, object_id, context=context).model
|
model = self.pool.get('ir.model').browse(cr, uid, object_id, context=context).model
|
||||||
args.append(('model', '=', model))
|
args.append(('model', '=', model))
|
||||||
return super(report_xml, self).search(cr, uid, args, offset, limit, order, context, count)
|
return super(report_xml, self).search(cr, uid, args, offset=offset, limit=limit, order=order, context=context, count=count)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ function connect () {
|
|||||||
WPA_PASS_FILE="/tmp/wpa_pass.txt"
|
WPA_PASS_FILE="/tmp/wpa_pass.txt"
|
||||||
PERSISTENT_WIFI_NETWORK_FILE="/home/pi/wifi_network.txt"
|
PERSISTENT_WIFI_NETWORK_FILE="/home/pi/wifi_network.txt"
|
||||||
CURRENT_WIFI_NETWORK_FILE="/tmp/current_wifi_network.txt" # used to repair connection when we lose it
|
CURRENT_WIFI_NETWORK_FILE="/tmp/current_wifi_network.txt" # used to repair connection when we lose it
|
||||||
|
LOST_WIFI_FILE="/tmp/lost_wifi.txt"
|
||||||
ESSID="${1}"
|
ESSID="${1}"
|
||||||
PASSWORD="${2}"
|
PASSWORD="${2}"
|
||||||
PERSIST="${3}"
|
PERSIST="${3}"
|
||||||
@@ -15,6 +16,7 @@ function connect () {
|
|||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
sudo pkill -f keep_wifi_alive.sh
|
sudo pkill -f keep_wifi_alive.sh
|
||||||
|
WIFI_WAS_LOST=$?
|
||||||
|
|
||||||
# make network choice persistent
|
# make network choice persistent
|
||||||
if [ -n "${ESSID}" ] ; then
|
if [ -n "${ESSID}" ] ; then
|
||||||
@@ -54,13 +56,24 @@ function connect () {
|
|||||||
|
|
||||||
# give dhcp some time
|
# give dhcp some time
|
||||||
timeout 30 sh -c 'until ifconfig wlan0 | grep "inet addr:" ; do sleep 0.1 ; done'
|
timeout 30 sh -c 'until ifconfig wlan0 | grep "inet addr:" ; do sleep 0.1 ; done'
|
||||||
|
TIMEOUT_RETURN=$?
|
||||||
|
|
||||||
if [ $? -eq 124 ] && [ -z "${NO_AP}" ] ; then
|
if [ ${TIMEOUT_RETURN} -eq 124 ] && [ -z "${NO_AP}" ] ; then
|
||||||
logger -t posbox_connect_to_wifi "Failed to connect, forcing Posbox AP"
|
logger -t posbox_connect_to_wifi "Failed to connect, forcing Posbox AP"
|
||||||
sudo /home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh "force" &
|
sudo /home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh "force" &
|
||||||
else
|
else
|
||||||
logger -t posbox_connect_to_wifi "Restarting odoo"
|
if [ ${TIMEOUT_RETURN} -ne 124 ] ; then
|
||||||
sudo service odoo restart
|
rm -f "${LOST_WIFI_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "${LOST_WIFI_FILE}" ] ; then
|
||||||
|
logger -t posbox_connect_to_wifi "Restarting odoo"
|
||||||
|
sudo service odoo restart
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ${WIFI_WAS_LOST} -eq 0 ] ; then
|
||||||
|
touch "${LOST_WIFI_FILE}"
|
||||||
|
fi
|
||||||
|
|
||||||
logger -t posbox_connect_to_wifi "Starting wifi keep alive script"
|
logger -t posbox_connect_to_wifi "Starting wifi keep alive script"
|
||||||
/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/keep_wifi_alive.sh &
|
/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/keep_wifi_alive.sh &
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ class Report(osv.Model):
|
|||||||
|
|
||||||
@api.v8
|
@api.v8
|
||||||
def get_html(self, records, report_name, data=None):
|
def get_html(self, records, report_name, data=None):
|
||||||
return self._model.get_html(self._cr, self._uid, records.ids, report_name,
|
return Report.get_html(self._model, self._cr, self._uid, records.ids,
|
||||||
data=data, context=self._context)
|
report_name, data=data, context=self._context)
|
||||||
|
|
||||||
@api.v7
|
@api.v7
|
||||||
def get_pdf(self, cr, uid, ids, report_name, html=None, data=None, context=None):
|
def get_pdf(self, cr, uid, ids, report_name, html=None, data=None, context=None):
|
||||||
@@ -275,8 +275,8 @@ class Report(osv.Model):
|
|||||||
|
|
||||||
@api.v8
|
@api.v8
|
||||||
def get_pdf(self, records, report_name, html=None, data=None):
|
def get_pdf(self, records, report_name, html=None, data=None):
|
||||||
return self._model.get_pdf(self._cr, self._uid, records.ids, report_name,
|
return Report.get_pdf(self._model, self._cr, self._uid, records.ids,
|
||||||
html=html, data=data, context=self._context)
|
report_name, html=html, data=data, context=self._context)
|
||||||
|
|
||||||
@api.v7
|
@api.v7
|
||||||
def get_action(self, cr, uid, ids, report_name, data=None, context=None):
|
def get_action(self, cr, uid, ids, report_name, data=None, context=None):
|
||||||
@@ -309,8 +309,8 @@ class Report(osv.Model):
|
|||||||
|
|
||||||
@api.v8
|
@api.v8
|
||||||
def get_action(self, records, report_name, data=None):
|
def get_action(self, records, report_name, data=None):
|
||||||
return self._model.get_action(self._cr, self._uid, records.ids, report_name,
|
return Report.get_action(self._model, self._cr, self._uid, records.ids,
|
||||||
data=data, context=self._context)
|
report_name, data=data, context=self._context)
|
||||||
|
|
||||||
#--------------------------------------------------------------------------
|
#--------------------------------------------------------------------------
|
||||||
# Report generation helpers
|
# Report generation helpers
|
||||||
@@ -356,8 +356,8 @@ class Report(osv.Model):
|
|||||||
|
|
||||||
@api.v8
|
@api.v8
|
||||||
def _check_attachment_use(self, records, report):
|
def _check_attachment_use(self, records, report):
|
||||||
return self._model._check_attachment_use(
|
return Report._check_attachment_use(
|
||||||
self._cr, self._uid, records.ids, report, context=self._context)
|
self._model, self._cr, self._uid, records.ids, report, context=self._context)
|
||||||
|
|
||||||
def _check_wkhtmltopdf(self):
|
def _check_wkhtmltopdf(self):
|
||||||
return wkhtmltopdf_state
|
return wkhtmltopdf_state
|
||||||
|
|||||||
@@ -1042,22 +1042,23 @@ class ir_model_data(osv.osv):
|
|||||||
else:
|
else:
|
||||||
if mode=='init' or (mode=='update' and xml_id):
|
if mode=='init' or (mode=='update' and xml_id):
|
||||||
inherit_xml_ids = []
|
inherit_xml_ids = []
|
||||||
for table, field_name in model_obj._inherits.items():
|
if xml_id:
|
||||||
xml_ids = self.pool['ir.model.data'].search(cr, uid, [
|
for table, field_name in model_obj._inherits.items():
|
||||||
('module', '=', module),
|
xml_ids = self.pool['ir.model.data'].search(cr, uid, [
|
||||||
('name', '=', xml_id + '_' + table.replace('.', '_')),
|
('module', '=', module),
|
||||||
], context=context)
|
('name', '=', xml_id + '_' + table.replace('.', '_')),
|
||||||
# XML ID found in the database, try to recover an existing record
|
], context=context)
|
||||||
if xml_ids:
|
# XML ID found in the database, try to recover an existing record
|
||||||
found_xml_id = self.pool['ir.model.data'].browse(cr, uid, xml_ids[0], context=context)
|
if xml_ids:
|
||||||
record = self.pool[found_xml_id.model].browse(cr, uid, [found_xml_id.res_id], context=context)[0]
|
found_xml_id = self.pool['ir.model.data'].browse(cr, uid, xml_ids[0], context=context)
|
||||||
# The record exists, store the id and don't recreate the XML ID
|
record = self.pool[found_xml_id.model].browse(cr, uid, [found_xml_id.res_id], context=context)[0]
|
||||||
if record.exists():
|
# The record exists, store the id and don't recreate the XML ID
|
||||||
inherit_xml_ids.append(found_xml_id.model)
|
if record.exists():
|
||||||
values[field_name] = found_xml_id.res_id
|
inherit_xml_ids.append(found_xml_id.model)
|
||||||
# Orphan XML ID, delete it
|
values[field_name] = found_xml_id.res_id
|
||||||
else:
|
# Orphan XML ID, delete it
|
||||||
found_xml_id.unlink()
|
else:
|
||||||
|
found_xml_id.unlink()
|
||||||
|
|
||||||
res_id = model_obj.create(cr, uid, values, context=context)
|
res_id = model_obj.create(cr, uid, values, context=context)
|
||||||
if xml_id:
|
if xml_id:
|
||||||
|
|||||||
@@ -608,6 +608,16 @@ def v7(method_v7):
|
|||||||
def foo(self):
|
def foo(self):
|
||||||
...
|
...
|
||||||
|
|
||||||
|
Special care must be taken if one method calls the other one, because
|
||||||
|
the method may be overridden! In that case, one should call the method
|
||||||
|
from the current class (say ``MyClass``), for instance::
|
||||||
|
|
||||||
|
@api.v7
|
||||||
|
def foo(self, cr, uid, ids, context=None):
|
||||||
|
# Beware: records.foo() may call an overriding of foo()
|
||||||
|
records = self.browse(cr, uid, ids, context)
|
||||||
|
return MyClass.foo(records)
|
||||||
|
|
||||||
Note that the wrapper method uses the docstring of the first method.
|
Note that the wrapper method uses the docstring of the first method.
|
||||||
"""
|
"""
|
||||||
# retrieve method_v8 from the caller's frame
|
# retrieve method_v8 from the caller's frame
|
||||||
|
|||||||
+5
-5
@@ -3885,7 +3885,7 @@ class BaseModel(object):
|
|||||||
self._check_selection_field_value(cr, user, field, vals[field], context=context)
|
self._check_selection_field_value(cr, user, field, vals[field], context=context)
|
||||||
if column._classic_write and not hasattr(column, '_fnct_inv'):
|
if column._classic_write and not hasattr(column, '_fnct_inv'):
|
||||||
if (not totranslate) or not column.translate:
|
if (not totranslate) or not column.translate:
|
||||||
updates.append((field, '%s', column._symbol_set[1](vals[field])))
|
updates.append((field, column._symbol_set[0], column._symbol_set[1](vals[field])))
|
||||||
direct.append(field)
|
direct.append(field)
|
||||||
else:
|
else:
|
||||||
upd_todo.append(field)
|
upd_todo.append(field)
|
||||||
@@ -4198,7 +4198,7 @@ class BaseModel(object):
|
|||||||
for field in vals:
|
for field in vals:
|
||||||
current_field = self._columns[field]
|
current_field = self._columns[field]
|
||||||
if current_field._classic_write:
|
if current_field._classic_write:
|
||||||
updates.append((field, '%s', current_field._symbol_set[1](vals[field])))
|
updates.append((field, current_field._symbol_set[0], current_field._symbol_set[1](vals[field])))
|
||||||
|
|
||||||
#for the function fields that receive a value, we set them directly in the database
|
#for the function fields that receive a value, we set them directly in the database
|
||||||
#(they may be required), but we also need to trigger the _fct_inv()
|
#(they may be required), but we also need to trigger the _fct_inv()
|
||||||
@@ -4424,7 +4424,7 @@ class BaseModel(object):
|
|||||||
value[v] = value[v][0]
|
value[v] = value[v][0]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
updates.append((v, '%s', column._symbol_set[1](value[v])))
|
updates.append((v, column._symbol_set[0], column._symbol_set[1](value[v])))
|
||||||
if updates:
|
if updates:
|
||||||
query = 'UPDATE "%s" SET %s WHERE id = %%s' % (
|
query = 'UPDATE "%s" SET %s WHERE id = %%s' % (
|
||||||
self._table, ','.join('"%s"=%s' % u[:2] for u in updates),
|
self._table, ','.join('"%s"=%s' % u[:2] for u in updates),
|
||||||
@@ -4448,8 +4448,8 @@ class BaseModel(object):
|
|||||||
value = value[0]
|
value = value[0]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
query = 'UPDATE "%s" SET "%s"=%%s WHERE id = %%s' % (
|
query = 'UPDATE "%s" SET "%s"=%s WHERE id = %%s' % (
|
||||||
self._table, f,
|
self._table, f, column._symbol_set[0],
|
||||||
)
|
)
|
||||||
cr.execute(query, (column._symbol_set[1](value), id))
|
cr.execute(query, (column._symbol_set[1](value), id))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user