[MERGE] forward port branch saas-16 up to 5d7ad2b16c

This commit is contained in:
Christophe Simonis
2017-11-30 18:43:08 +01:00
52 changed files with 358 additions and 96 deletions
+1 -1
View File
@@ -721,7 +721,7 @@ class AccountTaxGroup(models.Model):
class AccountTax(models.Model):
_name = 'account.tax'
_description = 'Tax'
_order = 'sequence'
_order = 'sequence,id'
@api.model
def _default_tax_group(self):
@@ -895,7 +895,7 @@ class AccountBankStatementLine(models.Model):
total = self.amount
for aml_rec in payment_aml_rec:
total -= aml_rec.debit - aml_rec.credit
aml_rec.write({'statement_line_id': self.id})
aml_rec.with_context(check_move_validity=False).write({'statement_line_id': self.id})
counterpart_moves = (counterpart_moves | aml_rec.move_id)
# Create move line(s). Either matching an existing journal entry (eg. invoice), in which
@@ -201,18 +201,19 @@ class account_journal(models.Model):
(number_draft, sum_draft) = self._count_results_and_sum_amounts(query_results_drafts, currency)
(number_late, sum_late) = self._count_results_and_sum_amounts(late_query_results, currency)
difference = currency.round(last_balance-account_sum) + 0.0
return {
'number_to_reconcile': number_to_reconcile,
'account_balance': formatLang(self.env, account_sum, currency_obj=self.currency_id or self.company_id.currency_id),
'last_balance': formatLang(self.env, last_balance, currency_obj=self.currency_id or self.company_id.currency_id),
'difference': (last_balance-account_sum) and formatLang(self.env, last_balance-account_sum, currency_obj=self.currency_id or self.company_id.currency_id) or False,
'account_balance': formatLang(self.env, currency.round(account_sum) + 0.0, currency_obj=currency),
'last_balance': formatLang(self.env, currency.round(last_balance) + 0.0, currency_obj=currency),
'difference': formatLang(self.env, difference, currency_obj=currency) if difference else False,
'number_draft': number_draft,
'number_waiting': number_waiting,
'number_late': number_late,
'sum_draft': formatLang(self.env, sum_draft or 0.0, currency_obj=self.currency_id or self.company_id.currency_id),
'sum_waiting': formatLang(self.env, sum_waiting or 0.0, currency_obj=self.currency_id or self.company_id.currency_id),
'sum_late': formatLang(self.env, sum_late or 0.0, currency_obj=self.currency_id or self.company_id.currency_id),
'currency_id': self.currency_id and self.currency_id.id or self.company_id.currency_id.id,
'sum_draft': formatLang(self.env, currency.round(sum_draft) + 0.0, currency_obj=currency),
'sum_waiting': formatLang(self.env, currency.round(sum_waiting) + 0.0, currency_obj=currency),
'sum_late': formatLang(self.env, currency.round(sum_late) + 0.0, currency_obj=currency),
'currency_id': currency.id,
'bank_statements_source': self.bank_statements_source,
'title': title,
}
+1 -2
View File
@@ -40,8 +40,7 @@ def migrate_tags_on_taxes(cr, registry):
('type_tax_use', '=', tax_template.type_tax_use),
('description', '=', tax_template.description)
])
if len(tax_id.ids) == 1:
tax_id.sudo().write({'tag_ids': [(6, 0, tax_template.tag_ids.ids)]})
tax_id.sudo().write({'tag_ids': [(6, 0, tax_template.tag_ids.ids)]})
def preserve_existing_tags_on_taxes(cr, registry, module):
''' This is a utility function used to preserve existing previous tags during upgrade of the module.'''
+11 -6
View File
@@ -297,10 +297,16 @@ class ResPartner(models.Model):
partner.total_invoiced = sum(price['total'] for price in price_totals if price['partner_id'] in child_ids)
@api.multi
def _journal_item_count(self):
def _compute_journal_item_count(self):
AccountMoveLine = self.env['account.move.line']
for partner in self:
partner.journal_item_count = self.env['account.move.line'].search_count([('partner_id', '=', partner.id)])
partner.contracts_count = self.env['account.analytic.account'].search_count([('partner_id', '=', partner.id)])
partner.journal_item_count = AccountMoveLine.search_count([('partner_id', '=', partner.id)])
@api.multi
def _compute_contracts_count(self):
AccountAnalyticAccount = self.env['account.analytic.account']
for partner in self:
partner.contracts_count = AccountAnalyticAccount.search_count([('partner_id', '=', partner.id)])
def get_followup_lines_domain(self, date, overdue_only=False, only_unblocked=False):
domain = [('reconciled', '=', False), ('account_id.deprecated', '=', False), ('account_id.internal_type', '=', 'receivable'), '|', ('debit', '!=', 0), ('credit', '!=', 0), ('company_id', '=', self.env.user.company_id.id)]
@@ -374,9 +380,8 @@ class ResPartner(models.Model):
groups='account.group_account_invoice')
currency_id = fields.Many2one('res.currency', compute='_get_company_currency', readonly=True,
string="Currency", help='Utility field to express amount currency')
contracts_count = fields.Integer(compute='_journal_item_count', string="Contracts", type='integer')
journal_item_count = fields.Integer(compute='_journal_item_count', string="Journal Items", type="integer")
contracts_count = fields.Integer(compute='_compute_contracts_count', string="Contracts", type='integer')
journal_item_count = fields.Integer(compute='_compute_journal_item_count', string="Journal Items", type="integer")
property_account_payable_id = fields.Many2one('account.account', company_dependent=True,
string="Account Payable", oldname="property_account_payable",
domain="[('internal_type', '=', 'payable'), ('deprecated', '=', False)]",
+13 -1
View File
@@ -71,7 +71,19 @@ class PaymentTransaction(models.Model):
_logger.warning('<%s> transaction STATE INCORRECT for invoice %s (ID %s, state %s)', self.acquirer_id.provider, self.account_invoice_id.number, self.account_invoice_id.id, self.account_invoice_id.state)
return 'pay_invoice_invalid_doc_state'
if not float_compare(self.amount, self.account_invoice_id.amount_total, 2) == 0:
_logger.warning('<%s> transaction AMOUNT MISMATCH for invoice %s (ID %s)', self.acquirer_id.provider, self.account_invoice_id.number, self.account_invoice_id.id)
_logger.warning(
'<%s> transaction AMOUNT MISMATCH for invoice %s (ID %s): expected %r, got %r',
self.acquirer_id.provider, self.account_invoice_id.number, self.account_invoice_id.id,
self.account_invoice_id.amount_total, self.amount,
)
self.account_invoice_id.message_post(
subject=_("Amount Mismatch (%s)") % self.acquirer_id.provider,
body=_("The invoice was not confirmed despite response from the acquirer (%s): invoice amount is %r but acquirer replied with %r.") % (
self.acquirer_id.provider,
self.account_invoice_id.amount_total,
self.amount,
)
)
return 'pay_invoice_tx_amount'
if self.state == 'authorized' and self.acquirer_id.capture_manually:
+1 -1
View File
@@ -42,7 +42,7 @@ class SaleOrderLine(models.Model):
registrations linked to this line. This method update existing registrations
and create new one for missing one. """
Registration = self.env['event.registration']
registrations = Registration.search([('sale_order_line_id', 'in', self.ids)])
registrations = Registration.search([('sale_order_line_id', 'in', self.ids), ('state', '!=', 'cancel')])
for so_line in self.filtered('event_id'):
existing_registrations = registrations.filtered(lambda self: self.sale_order_line_id.id == so_line.id)
if confirm:
+7
View File
@@ -591,3 +591,10 @@ class HrExpenseSheet(models.Model):
employee_ids = self.expense_line_ids.mapped('employee_id')
if len(employee_ids) > 1 or (len(employee_ids) == 1 and employee_ids != self.employee_id):
raise ValidationError(_('You cannot add expense lines of another employee.'))
@api.one
@api.constrains('expense_line_ids')
def _check_payment_mode(self):
payment_mode = set(self.expense_line_ids.mapped('payment_mode'))
if len(payment_mode) > 1:
raise ValidationError(_('You cannot report expenses with different payment modes.'))
+1 -1
View File
@@ -432,7 +432,7 @@
<field name="attachment_number" string=" "/>
<button name="action_get_attachment_view" string="View Attachments" type="object" icon="fa-paperclip"/>
<field name="tax_ids" widget="many2many_tags"/>
<field name="total_amount" sum="Total Amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="total_amount" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="is_refused" invisible="True"/>
<button name="%(hr_expense.hr_expense_refuse_wizard_action)d" states="reported, refused" string="Refuse" context="{'hr_expense_refuse_model':'hr.expense'}" type="action" groups="hr_expense.group_hr_expense_user, account.group_account_user" icon="fa-times" attrs="{'invisible': ['|', ('is_refused', '=', True),('state', 'in', ['done'])]}"/>
</tree>
+2 -1
View File
@@ -46,7 +46,8 @@ class ResPartnerBank(models.Model):
for record in self:
if record.acc_type == 'iban':
record.l10n_ch_postal = record._retrieve_l10n_ch_postal(record.sanitized_acc_number)
record.l10n_ch_postal = record.sanitized_acc_number
else:
record.l10n_ch_postal = record.sanitized_acc_number
def _retrieve_l10n_ch_postal(self, iban):
""" Reads a swiss postal account number from a an IBAN and returns it as
+3 -1
View File
@@ -1371,6 +1371,8 @@ class MailThread(models.AbstractModel):
mail module, and should not contain security or generic html cleaning.
Indeed those aspects should be covered by the html_sanitize method
located in tools. """
if not body:
return body, attachments
root = lxml.html.fromstring(body)
postprocessed = False
to_remove = []
@@ -1406,7 +1408,7 @@ class MailThread(models.AbstractModel):
# Content-Type: multipart/related;
# boundary="_004_3f1e4da175f349248b8d43cdeb9866f1AMSPR06MB343eurprd06pro_";
# type="text/html"
if not message.is_multipart() or message.get('content-type', '').startswith("text/"):
if message.get_content_maintype() == 'text':
encoding = message.get_content_charset()
body = message.get_payload(decode=True)
body = tools.ustr(body, encoding, errors='replace')
+4
View File
@@ -3,6 +3,7 @@
from odoo import _, api, exceptions, fields, models, modules
from odoo.tools import pycompat
from odoo.addons.base.res.res_users import is_selection_groups
class Users(models.Model):
@@ -62,11 +63,14 @@ class Users(models.Model):
@api.multi
def write(self, vals):
write_res = super(Users, self).write(vals)
sel_groups = [vals[k] for k in vals if is_selection_groups(k) and vals[k]]
if vals.get('groups_id'):
# form: {'group_ids': [(3, 10), (3, 3), (4, 10), (4, 3)]} or {'group_ids': [(6, 0, [ids]}
user_group_ids = [command[1] for command in vals['groups_id'] if command[0] == 4]
user_group_ids += [id for command in vals['groups_id'] if command[0] == 6 for id in command[2]]
self.env['mail.channel'].search([('group_ids', 'in', user_group_ids)])._subscribe_users()
elif sel_groups:
self.env['mail.channel'].search([('group_ids', 'in', sel_groups)])._subscribe_users()
return write_res
def _create_welcome_message(self):
+1 -1
View File
@@ -22,7 +22,7 @@ access_mail_alias_all,mail.alias.all,model_mail_alias,,1,0,0,0
access_mail_alias_user,mail.alias.user,model_mail_alias,base.group_user,1,1,1,1
access_mail_alias_system,mail.alias.system,model_mail_alias,base.group_system,1,1,1,1
access_mail_message_subtype_all,mail.message.subtype.all,model_mail_message_subtype,,1,0,0,0
access_mail_message_subtype_user,mail.message.subtype.user,model_mail_message_subtype,,1,1,1,1
access_mail_message_subtype_user,mail.message.subtype.user,model_mail_message_subtype,base.group_user,1,1,1,1
access_mail_tracking_value_all,mail.tracking.value.all,model_mail_tracking_value,,0,0,0,0
access_mail_tracking_value_portal,mail.tracking.value.portal,model_mail_tracking_value,base.group_portal,0,0,0,0
access_mail_tracking_value_user,mail.tracking.value.user,model_mail_tracking_value,base.group_user,0,0,0,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
22 access_mail_alias_user mail.alias.user model_mail_alias base.group_user 1 1 1 1
23 access_mail_alias_system mail.alias.system model_mail_alias base.group_system 1 1 1 1
24 access_mail_message_subtype_all mail.message.subtype.all model_mail_message_subtype 1 0 0 0
25 access_mail_message_subtype_user mail.message.subtype.user model_mail_message_subtype base.group_user 1 1 1 1
26 access_mail_tracking_value_all mail.tracking.value.all model_mail_tracking_value 0 0 0 0
27 access_mail_tracking_value_portal mail.tracking.value.portal model_mail_tracking_value base.group_portal 0 0 0 0
28 access_mail_tracking_value_user mail.tracking.value.user model_mail_tracking_value base.group_user 0 0 0 0
+17
View File
@@ -176,6 +176,19 @@ Content-Type: text/html;
--Apple-Mail=_9331E12B-8BD2-4EC7-B53E-01F3FBEC9227--
"""
MAIL_SINGLE_BINARY = """X-Original-To: raoul@grosbedon.fr
Delivered-To: raoul@grosbedon.fr
Received: by mail1.grosbedon.com (Postfix, from userid 10002)
id E8166BFACA; Fri, 23 Aug 2013 13:18:01 +0200 (CEST)
From: "Bruce Wayne" <bruce@wayneenterprises.com>
Content-Type: application/pdf;
Content-Disposition: filename=thetruth.pdf
Content-Transfer-Encoding: base64
Message-Id: <6BB1FAB2-2104-438E-9447-07AE2C8C4A92@sexample.com>
Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
SSBhbSB0aGUgQmF0TWFuCg=="""
MAIL_MULTIPART_IMAGE = """X-Original-To: raoul@example.com
Delivered-To: micheline@example.com
@@ -349,6 +362,10 @@ class TestMailgateway(TestMail):
res.get('body', ''),
'message_parse: second part of the html version should be in body after parsing multipart/mixed')
res = self.env['mail.thread'].message_parse(MAIL_SINGLE_BINARY)
self.assertEqual(res['body'], '')
self.assertEqual(res['attachments'][0][0], 'thetruth.pdf')
@mute_logger('odoo.addons.mail.models.mail_thread')
def test_message_process_cid(self):
new_groups = self.format_and_process(MAIL_MULTIPART_IMAGE, subject='My Frogs', to='groups@example.com')
@@ -15,13 +15,13 @@
<strong t-if="o.address_id != o.partner_invoice_id">Invoice address: </strong>
<div t-field="o.partner_invoice_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></p>
<p t-if="o.partner_invoice_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_invoice_id.vat"/></p>
</div>
<div t-if="o.address_id != o.partner_invoice_id">
<strong>Shipping address :</strong>
<div t-field="o.address_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone"], "no_marker": True, "phone_icons": True}'/>
<p t-if="o.partner_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.partner_id.vat"/></p>
<p t-if="o.address_id.vat"><t t-esc="o.company_id.country_id.vat_label or 'TIN'"/>: <span t-field="o.address_id.vat"/></p>
</div>
</div>
<div class="col-xs-5 col-xs-offset-1">
@@ -29,6 +29,34 @@ def strip_ns(xml, ns):
return it.root
def error_check(elem):
"""Check if the response sent by Authorize.net contains an error.
Errors can be a failure to try the transaction (in that case, the transasctionResponse
is empty, and the meaningful error message will be in message/code) or a failure to process
the transaction (in that case, the message/code content will be generic and the actual error
message is in transactionResponse/errors/error/errorText).
:param etree._Element elem: the root element of the response that will be parsed
:rtype: tuple (bool, str)
:return: tuple containnig a boolean indicating if the response should be considered
as an error and the most meaningful error message found in it.
"""
result_code = elem.find('messages/resultCode')
msg = 'No meaningful error message found, please check logs or the Authorize.net backend'
has_error = result_code is not None and result_code.text == 'Error'
if has_error:
# accumulate the most meangingful error
error = elem.find('transactionResponse/errors/error')
error = error if error is not None else elem.find('messages/message')
if error is not None:
code = error[0].text
text = error[1].text
msg = '%s: %s' % (code, text)
return (has_error, msg)
class AuthorizeAPI():
"""Authorize.net Gateway API integration.
@@ -38,6 +66,9 @@ class AuthorizeAPI():
- Customer Profile/Payment Profile creation
- Transaction authorization/capture/voiding
"""
AUTH_ERROR_STATUS = 3
def __init__(self, acquirer):
"""Initiate the environment with the acquirer data.
@@ -62,9 +93,6 @@ class AuthorizeAPI():
r = requests.post(self.url, data=data, headers={'Content-Type': 'text/xml'})
r.raise_for_status()
response = strip_ns(r.content, XMLNS)
if response.find('messages/resultCode').text == 'Error':
messages = [m.text for m in response.findall('messages/message/text')]
raise ValidationError(_('Authorize.net Error Message(s):\n %s') % '\n'.join(messages))
return response
def _base_tree(self, requestType):
@@ -216,6 +244,11 @@ class AuthorizeAPI():
etree.SubElement(order, "invoiceNumber").text = reference
response = self._authorize_request(root)
res = dict()
(has_error, error_msg) = error_check(response)
if has_error:
res['x_response_code'] = self.AUTH_ERROR_STATUS
res['x_response_reason_text'] = error_msg
return res
res['x_response_code'] = response.find('transactionResponse/responseCode').text
res['x_trans_id'] = response.find('transactionResponse/transId').text
res['x_type'] = 'auth_capture'
@@ -246,6 +279,11 @@ class AuthorizeAPI():
etree.SubElement(order, "invoiceNumber").text = reference
response = self._authorize_request(root)
res = dict()
(has_error, error_msg) = error_check(response)
if has_error:
res['x_response_code'] = self.AUTH_ERROR_STATUS
res['x_response_reason_text'] = error_msg
return res
res['x_response_code'] = response.find('transactionResponse/responseCode').text
res['x_trans_id'] = response.find('transactionResponse/transId').text
res['x_type'] = 'auth_only'
@@ -271,6 +309,11 @@ class AuthorizeAPI():
etree.SubElement(tx, "refTransId").text = transaction_id
response = self._authorize_request(root)
res = dict()
(has_error, error_msg) = error_check(response)
if has_error:
res['x_response_code'] = self.AUTH_ERROR_STATUS
res['x_response_reason_text'] = error_msg
return res
res['x_response_code'] = response.find('transactionResponse/responseCode').text
res['x_trans_id'] = response.find('transactionResponse/transId').text
res['x_type'] = 'prior_auth_capture'
@@ -291,6 +334,11 @@ class AuthorizeAPI():
etree.SubElement(tx, "refTransId").text = transaction_id
response = self._authorize_request(root)
res = dict()
(has_error, error_msg) = error_check(response)
if has_error:
res['x_response_code'] = self.AUTH_ERROR_STATUS
res['x_response_reason_text'] = error_msg
return res
res['x_response_code'] = response.find('transactionResponse/responseCode').text
res['x_trans_id'] = response.find('transactionResponse/transId').text
res['x_type'] = 'void'
@@ -212,7 +212,7 @@ class AuthorizeForm(AuthorizeCommon):
'acquirer_id': authorize.id,
'type': 'server2server',
'currency_id': self.currency_usd.id,
'reference': 'test_ref_%s' % odoo.fields.Date.today(),
'reference': 'test_ref_%s' % int(time.time()),
'payment_token_id': payment_token.id,
'partner_id': self.buyer_id,
@@ -254,3 +254,20 @@ class AuthorizeForm(AuthorizeCommon):
self.assertEqual(transaction.state, 'authorized')
transaction.action_void()
self.assertEqual(transaction.state, 'cancel')
# try charging an unexisting profile
ghost_payment_token = payment_token.copy()
ghost_payment_token.authorize_profile = '99999999999'
# create normal s2s transaction
transaction = self.env['payment.transaction'].create({
'amount': 500,
'acquirer_id': authorize.id,
'type': 'server2server',
'currency_id': self.currency_usd.id,
'reference': 'test_ref_%s' % int(time.time()),
'payment_token_id': ghost_payment_token.id,
'partner_id': self.buyer_id,
})
transaction.authorize_s2s_do_transaction()
self.assertEqual(transaction.state, 'error')
+1 -1
View File
@@ -553,7 +553,7 @@ exports.PosModel = Backbone.Model.extend({
.then(function(){ load_model(index + 1); },
function(err){ loaded.reject(err); });
}catch(err){
console.error(err.stack);
console.error(err.message, err.stack);
loaded.reject(err);
}
},function(err){
+14 -5
View File
@@ -73,12 +73,21 @@ var ScreenWidget = PosBaseWidget.extend({
// - if there's a user with a matching barcode, put it as the active 'cashier', go to cashier mode, and return true
// - else : do nothing and return false. You probably want to extend this to show and appropriate error popup...
barcode_cashier_action: function(code){
var self = this;
var users = this.pos.users;
for(var i = 0, len = users.length; i < len; i++){
if(users[i].barcode === code.code){
this.pos.set_cashier(users[i]);
this.chrome.widget.username.renderElement();
return true;
if (users[i].id !== this.pos.get_cashier().id && users[i].pos_security_pin) {
return this.gui.ask_password(users[i].pos_security_pin).then(function(){
self.pos.set_cashier(users[i]);
self.chrome.widget.username.renderElement();
return true;
});
} else {
this.pos.set_cashier(users[i]);
this.chrome.widget.username.renderElement();
return true;
}
}
}
this.barcode_error_action(code);
@@ -1087,10 +1096,10 @@ var ClientListScreenWidget = ScreenWidget.extend({
this.$('.searchbox input').on('keypress',function(event){
clearTimeout(search_timeout);
var query = this.value;
var searchbox = this;
search_timeout = setTimeout(function(){
self.perform_search(query,event.which === 13);
self.perform_search(searchbox.value, event.which === 13);
},70);
});
@@ -17,8 +17,7 @@ export DEBIAN_FRONTEND=noninteractive
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
apt-get update
apt-get -y dist-upgrade
apt-get update && apt-get -y upgrade
# Do not be too fast to upgrade to more recent firmware and kernel than 4.38
# Firmware 4.44 seems to prevent the LED mechanism from working
@@ -39,6 +38,8 @@ rm -rf /usr/share/doc
pip install pyusb==1.0.0b1
pip install qrcode
pip install evdev
pip install simplejson
pip install unittest2
# --upgrade because websocket_client in wheezy is bad:
# https://github.com/docker/compose/issues/1288
@@ -53,7 +54,6 @@ sudo -u postgres createuser -s pi
mkdir /var/log/odoo
chown pi:pi /var/log/odoo
chown pi:pi -R /home/pi/odoo/
chmod 770 -R /home/pi/odoo/
# logrotate is very picky when it comes to file permissions
chown -R root:root /etc/logrotate.d/
@@ -1,5 +1,5 @@
#!/bin/sh
wget 'https://downloads.raspberrypi.org/raspbian_lite_latest' -O raspbian.img.zip
wget 'http://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-07-05/2017-07-05-raspbian-jessie-lite.zip' -O raspbian.img.zip
unzip raspbian.img.zip
wget 'https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.4.13-jessie' -O kernel-qemu
+2 -1
View File
@@ -252,7 +252,8 @@
<div class="clearfix" />
<div t-attf-class="form-group #{error.get('company_name') and 'has-error' or ''} col-lg-6">
<label class="control-label label-optional" for="company_name">Company Name</label>
<input type="text" name="company_name" class="form-control" t-att-value="company_name or partner.company_name"/>
<p t-if="partner.commercial_partner_id.is_company" class="form-control" t-esc="partner.commercial_company_name"/>
<input t-else="" type="text" name="company_name" class="form-control" t-att-value="company_name or partner.company_name"/>
</div>
<div t-if="has_check_vat" t-attf-class="form-group #{error.get('vat') and 'has-error' or ''} col-lg-6">
<label class="control-label label-optional" for="vat">VAT Number</label>
@@ -1,14 +1,17 @@
odoo.define('pos_discount.pos_discount', function (require) {
"use strict";
var core = require('web.core');
var screens = require('point_of_sale.screens');
var _t = core._t;
var DiscountButton = screens.ActionButtonWidget.extend({
template: 'DiscountButton',
button_click: function(){
var self = this;
this.gui.show_popup('number',{
'title': 'Discount Percentage',
'title': _t('Discount Percentage'),
'value': this.pos.config.discount_pc,
'confirm': function(val) {
val = Math.round(Math.max(0,Math.min(100,val)));
@@ -51,6 +51,13 @@
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record model="ir.rule" id="purchase_order_report_comp_rule">
<field name="name">Purchase Order Report multi-company</field>
<field name="model_id" ref="model_purchase_report"/>
<field name="global" eval="True"/>
<field name="domain_force">['|',('company_id','=',False),('company_id','child_of',[user.company_id.id])]</field>
</record>
<record id="portal_purchase_order_user_rule" model="ir.rule">
<field name="name">Portal Purchase Orders</field>
<field name="model_id" ref="purchase.model_purchase_order"/>
+13 -1
View File
@@ -44,7 +44,19 @@ class PaymentTransaction(models.Model):
_logger.warning('<%s> transaction STATE INCORRECT for order %s (ID %s, state %s)', self.acquirer_id.provider, self.sale_order_id.name, self.sale_order_id.id, self.sale_order_id.state)
return 'pay_sale_invalid_doc_state'
if not float_compare(self.amount, self.sale_order_id.amount_total, 2) == 0:
_logger.warning('<%s> transaction AMOUNT MISMATCH for order %s (ID %s)', self.acquirer_id.provider, self.sale_order_id.name, self.sale_order_id.id)
_logger.warning(
'<%s> transaction AMOUNT MISMATCH for order %s (ID %s): expected %r, got %r',
self.acquirer_id.provider, self.sale_order_id.name, self.sale_order_id.id,
self.sale_order_id.amount_total, self.amount,
)
self.sale_order_id.message_post(
subject=_("Amount Mismatch (%s)") % self.acquirer_id.provider,
body=_("The sale order was not confirmed despite response from the acquirer (%s): SO amount is %r but acquirer replied with %r.") % (
self.acquirer_id.provider,
self.sale_order_id.amount_total,
self.amount,
)
)
return 'pay_sale_tx_amount'
if self.state == 'authorized' and self.acquirer_id.capture_manually:
@@ -37,3 +37,4 @@ class StockImmediateTransfer(models.TransientModel):
pick_to_do.action_done()
if pick_to_backorder:
return pick_to_backorder.action_generate_backorder_wizard()
return True
+21 -10
View File
@@ -10,7 +10,7 @@
* only when the deferred is resolved, and its value is equal to the resolved value.
* The module can be rejected (unloaded). This will be logged in the console as info.
*
* logs:
* logs:
* Missing dependencies:
* These modules do not appear in the page. It is possible that the
* JavaScript file is not in the page or that the module name is wrong
@@ -185,16 +185,27 @@
failed = odoo.__DEBUG__.get_failed_jobs();
var unloaded = _.filter(debug_jobs, function (job) { return job.missing; });
var log = [(_.isEmpty(failed) ? (_.isEmpty(unloaded) ? 'info' : 'warning' ) : 'error') + ':', 'Some modules could not be started'];
if (missing.length) log.push('\nMissing dependencies: ', missing);
if (!_.isEmpty(failed)) log.push('\nFailed modules: ', _.pluck(failed, 'name'));
if (!_.isEmpty(rejected)) log.push('\nRejected modules: ', rejected);
if (!_.isEmpty(rejected_linked))log.push('\nRejected linked modules:', rejected_linked);
if (!_.isEmpty(unloaded)) log.push('\nNon loaded modules: ', _.pluck(unloaded, 'name'));
if (odoo.debug && !_.isEmpty(debug_jobs)) log.push('\nDebug: ', debug_jobs);
if (odoo.debug || !_.isEmpty(failed) || !_.isEmpty(unloaded)) {
console[_.isEmpty(failed) || _.isEmpty(unloaded) ? 'info' : 'error'].apply(console, log);
var log = console[_.isEmpty(failed) || _.isEmpty(unloaded) ? 'info' : 'error'].bind(console);
log((_.isEmpty(failed) ? (_.isEmpty(unloaded) ? 'info' : 'warning') : 'error') + ': Some modules could not be started');
if (missing.length) {
log('Missing dependencies: ', missing);
}
if (!_.isEmpty(failed)) {
log('Failed modules: ', _.pluck(failed, 'name'));
}
if (!_.isEmpty(rejected)) {
log('Rejected modules: ', rejected);
}
if (!_.isEmpty(rejected_linked)) {
log('Rejected linked modules: ', rejected_linked);
}
if (!_.isEmpty(unloaded)) {
log('Non loaded modules: ', _.pluck(unloaded, 'name'));
}
if (odoo.debug && !_.isEmpty(debug_jobs)) {
log('Debug: ', debug_jobs);
}
}
}
odoo.__DEBUG__.js_modules = {
+2 -1
View File
@@ -70,7 +70,8 @@
/*Total table*/
.row > .col-xs-4 {
width: 43%;
margin-top: -20px;
position: relative;
top: -20px;
> table {
tr:last-child td {
border-top: 1px solid @gray-lighter !important;
@@ -309,6 +309,8 @@ var FieldTextHtml = AbstractField.extend({
old_initialize_content: function () {
this.$el.closest('.modal-body').css('max-height', 'none');
this.$iframe = this.$el.find('iframe');
// deactivate any button to avoid saving a not ready iframe
$('.o_cp_buttons, .o_statusbar_buttons').find('button').addClass('o_disabled').attr('disabled', true);
this.document = null;
this.$body = $();
this.$content = $();
@@ -324,6 +326,8 @@ var FieldTextHtml = AbstractField.extend({
this.render();
this.add_button();
this.loaded = true;
// reactivate all the buttons when the field's content (the iframe) is loaded
$('.o_cp_buttons, .o_statusbar_buttons').find('button').removeClass('o_disabled').attr('disabled', false);
setTimeout(self.resize, 0);
},
on_editor_loaded: function (EditorBar) {
@@ -469,7 +469,7 @@ var fontIconsDialog = Widget.extend({
e.stopPropagation();
this.$('#fa-icon').val(e.target.getAttribute('data-id'));
$(".font-icons-icon").removeClass("o_selected");
this.$(".font-icons-icon").removeClass("o_selected");
$(e.target).addClass("o_selected");
},
'dblclick .font-icons-icon': function () {
@@ -595,7 +595,7 @@ var fontIconsDialog = Widget.extend({
continue;
case '': continue;
default:
$(".font-icons-icon").removeClass("o_selected").filter("[data-alias*=',"+cls+",']").addClass("o_selected");
this.$(".font-icons-icon").removeClass("o_selected").filter("[data-alias*=',"+cls+",']").addClass("o_selected");
if (this.alias.indexOf(cls) !== -1) {
this.$('#fa-icon').val(cls);
}
+2 -2
View File
@@ -221,7 +221,7 @@
<record id="website.library_image_02" model="ir.attachment">
<field name="public" eval="True"/>
<field name="name">Website Library Image 02</field>
<field name="datas_fname">deliver.png</field>
<field name="datas_fname">deliver.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="type">url</field>
<field name="url">/website/static/src/img/library/deliver.jpg</field>
@@ -266,7 +266,7 @@
<record id="website.library_image_07" model="ir.attachment">
<field name="public" eval="True"/>
<field name="name">Website Library Image 07</field>
<field name="datas_fname">mobile_device.png</field>
<field name="datas_fname">mobile_device.jpg</field>
<field name="res_model">ir.ui.view</field>
<field name="type">url</field>
<field name="url">/website/static/src/img/library/mobile_device.jpg</field>
+1 -1
View File
@@ -21,7 +21,7 @@ class Partner(models.Model):
return False
params = {
'center': '%s, %s %s, %s' % (self.street or '', self.city or '', self.zip or '', self.country_id and self.country_id.name_get()[0][1] or ''),
'size': "%sx%s" % (height, width),
'size': "%sx%s" % (width, height),
'zoom': zoom,
'sensor': 'false',
'key': google_maps_api_key,
@@ -590,7 +590,11 @@ registry.mediaVideo = Animation.extend({
* @override
*/
start: function () {
if (!this.$target.has('> iframe').length) {
// TODO: this code should be refactored to make more sense and be better
// integrated with Odoo (this refactoring should be done in master).
this.$target.find('iframe').remove();
if (!this.$target.has('.media_iframe_video_size').length) {
var editor = '<div class="css_editableMode_display">&nbsp;</div>';
var size = '<div class="media_iframe_video_size">&nbsp;</div>';
this.$target.html(editor+size);
@@ -102,6 +102,7 @@
<t t-set="head">
<link t-att-href="'/blog/%s/feed' % (blog.id)" type="application/atom+xml" rel="alternate" title="Atom Feed"/>
</t>
<div class="oe_structure"/>
<div class="container">
<t t-call="website.pager" >
<t t-set="classname">pull-right</t>
+1 -1
View File
@@ -153,7 +153,7 @@ class WebsiteEventController(http.Controller):
# page not found
values['path'] = re.sub(r"^website_event\.", '', page)
values['from_template'] = 'website_event.default_page' # .strip('website_event.')
page = 'website.page_404'
page = 'website.%s' % (request.website.is_publisher() and 'page_404' or '404')
return request.render(page, values)
@@ -542,7 +542,7 @@
<h4 class="modal-title" id="myModalLabel"><strong>Attendees</strong></h4>
</div>
<div class="modal-body">
<div class="">
<div class="container">
<t t-set="counter_type" t-value="1"/>
<t t-set="counter" t-value="0"/>
<t t-foreach="tickets" t-as="ticket">
+2 -3
View File
@@ -383,8 +383,8 @@ class WebsiteSale(http.Controller):
def cart_update(self, product_id, add_qty=1, set_qty=0, **kw):
request.website.sale_get_order(force_create=1)._cart_update(
product_id=int(product_id),
add_qty=float(add_qty),
set_qty=float(set_qty),
add_qty=add_qty,
set_qty=set_qty,
attributes=self._filter_attributes(**kw),
)
return request.redirect("/shop/cart")
@@ -398,7 +398,6 @@ class WebsiteSale(http.Controller):
if order.state != 'draft':
request.website.sale_reset()
return {}
value = order._cart_update(product_id=product_id, line_id=line_id, add_qty=add_qty, set_qty=set_qty)
if not order.cart_quantity:
+11
View File
@@ -139,6 +139,17 @@ class SaleOrder(models.Model):
""" Add or set product quantity, add_qty can be negative """
self.ensure_one()
SaleOrderLineSudo = self.env['sale.order.line'].sudo()
try:
if add_qty:
add_qty = float(add_qty)
except ValueError:
add_qty = 1
try:
if set_qty:
set_qty = float(set_qty)
except ValueError:
set_qty = 0
quantity = 0
order_line = False
if self.state != 'draft':
@@ -133,6 +133,9 @@ odoo.define('website_sale.website_sale', function (require) {
return;
}
var value = parseInt($input.val() || 0, 10);
if (isNaN(value)) {
value = 1;
}
var $dom = $(this).closest('tr');
//var default_price = parseFloat($dom.find('.text-danger > span.oe_currency_value').text());
var $dom_optional = $dom.nextUntil(':not(.optional_product.info)');
@@ -151,7 +154,11 @@ odoo.define('website_sale.website_sale', function (require) {
'set_qty': value
}).then(function (data) {
$input.data('update_change', false);
if (value !== parseInt($input.val() || 0, 10)) {
var check_value = parseInt($input.val() || 0, 10);
if (isNaN(check_value)) {
check_value = 1;
}
if (value !== check_value) {
$input.trigger('change');
return;
}
@@ -16,8 +16,13 @@ $(document).ready(function () {
return ajax.jsonRpc('/shop/payment/get_status/' + order_id, 'call', {
}).then(function (result) {
_poll_nbr += 1;
if(result.recall && _poll_nbr <= 5){
setTimeout(function () { payment_transaction_poll_status(); }, 1000);
if(result.recall) {
if (_poll_nbr < 20){
setTimeout(function () { payment_transaction_poll_status(); }, Math.ceil(_poll_nbr / 3) * 1000);
}
else {
result.message = "<i class='fa fa-warning' />";
}
}
$('div.oe_website_sale_tx_status').html(result.message);
});
@@ -34,8 +34,8 @@ class WebsiteSaleOptions(WebsiteSale):
if add_qty or set_qty:
value = order._cart_update(
product_id=int(product_id),
add_qty=int(add_qty),
set_qty=int(set_qty),
add_qty=add_qty,
set_qty=set_qty,
attributes=attributes,
optional_product_ids=optional_product_ids
)
+20
View File
@@ -0,0 +1,20 @@
Russia, 2017-11-25
IT-Projects LLC agrees to the terms of the Odoo Corporate Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Ivan Yelizariev https://github.com/yelizariev
List of contributors:
Ivan Yelizariev yelizariev@it-projects.info https://github.com/yelizariev
Ildar Nasyrov nasyrov@it-projects.info https://github.com/iledarn
Ilmir Karamov karamov@it-projects.info https://github.com/ilmir-k
Dinar Gabbasov gabbasov@it-projects.info https://github.com/GabbasovDinar
Artyom Losev losev@it-projects.info https://github.com/ArtyomLosev
Alexandr Kolushov kolushov@it-projects.info https://github.com/KolushovAlexandr
+11
View File
@@ -0,0 +1,11 @@
South Africa, 2017-11-25
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Andre de Kock adekock11@gmail.com https://github.com/adekock11
+11
View File
@@ -0,0 +1,11 @@
USA, 16 Nov 2017
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Edward Gow elgow@users.noreply.github.com https://github.com/elgow
+11
View File
@@ -0,0 +1,11 @@
USA, 2017-11-27
I hereby agree to the terms of the Odoo Individual Contributor License
Agreement v1.0.
I declare that I am authorized and able to make this agreement and sign this
declaration.
Signed,
Michael Leff leff.michael@gmail.com https://github.com/flyingL123
+10
View File
@@ -680,6 +680,16 @@ class IrTranslation(models.Model):
action['context'] = {
'search_default_name': "%s,%s" % (fld.model_name, fld.name),
}
else:
rec = record
try:
while fld.related:
rec, fld = fld.traverse_related(rec)
if rec:
action['context'] = {'search_default_name': "%s,%s" % (fld.model_name, fld.name),}
except AccessError:
pass
return action
@api.model
@@ -70,6 +70,7 @@
<field name="arch" type="xml">
<tree string="Translations" editable="top" create="false">
<field name="lang" readonly="1"/>
<field name="name" readonly="1"/>
<field name="source"/>
<field name="value"/>
<field name="state"/>
@@ -424,6 +424,7 @@
<field name="name">Denmark</field>
<field name="code">dk</field>
<field file="base/static/img/country_flags/dk.png" name="image" type="base64" />
<field eval="'%(street)s\n%(street2)s\n%(zip)s %(city)s\n%(country_name)s'" name="address_format" />
<field name="currency_id" ref="DKK" />
<field eval="45" name="phone_code" />
<field name="vat_label">VAT</field>
@@ -338,6 +338,7 @@
<field name="name">ZAR</field>
<field name="symbol">R</field>
<field name="rounding">0.01</field>
<field name="position">before</field>
<field name="active" eval="False"/>
<field name="currency_unit_label">Rand</field>
<field name="currency_subunit_label">Cents</field>
+27 -16
View File
@@ -382,9 +382,13 @@ class test_o2m(CreatorCase):
def test_multiple_records_name(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value']),
[[
u'4', u','.join(self.names)
]])
[
[u'4', u'export.one2many.child:4'],
[u'', u'export.one2many.child:42'],
[u'', u'export.one2many.child:36'],
[u'', u'export.one2many.child:4'],
[u'', u'export.one2many.child:13'],
])
def test_multiple_records_id(self):
export = self.export(self.commands, fields=['const', 'value/.id'])
@@ -402,19 +406,23 @@ class test_o2m(CreatorCase):
def test_multiple_records_with_name_before(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value', 'value/value']),
[[ # exports sub-fields of very first o2m
u'4', u','.join(self.names), u'4'
]])
[
[u'4', u'export.one2many.child:4', u'4'],
['', u'export.one2many.child:42', u'42'],
['', u'export.one2many.child:36', u'36'],
['', u'export.one2many.child:4', u'4'],
['', u'export.one2many.child:13', u'13'],
])
def test_multiple_records_with_name_after(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value/value', 'value']),
[ # completely ignores name_get request
[u'4', u'4', ''],
['', u'42', ''],
['', u'36', ''],
['', u'4', ''],
['', u'13', ''],
[
[u'4', u'4', u'export.one2many.child:4'],
['', u'42', u'export.one2many.child:42'],
['', u'36', u'export.one2many.child:36'],
['', u'4', u'export.one2many.child:4'],
['', u'13', u'export.one2many.child:13'],
])
def test_multiple_subfields_neighbour(self):
@@ -585,10 +593,13 @@ class test_m2m(CreatorCase):
def test_multiple_records_name(self):
self.assertEqual(
self.export(self.commands, fields=['const', 'value']),
[[ # FIXME: hardcoded comma, import uses config.csv_internal_sep
# resolution: remove configurable csv_internal_sep
u'4', u','.join(self.names)
]])
[
[u'4', u'export.many2many.other:4'],
['', u'export.many2many.other:42'],
['', u'export.many2many.other:36'],
['', u'export.many2many.other:4'],
['', u'export.many2many.other:13'],
])
# essentially same as o2m, so boring
+6 -10
View File
@@ -689,22 +689,18 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
current[i] = ','.join(xml_ids) or False
continue
# recursively export the fields that follow name
fields2 = [(p[1:] if p and p[0] == name else []) for p in fields]
# recursively export the fields that follow name; use
# 'display_name' where no subfield is exported
fields2 = [(p[1:] or ['display_name'] if p and p[0] == name else [])
for p in fields]
lines2 = value._export_rows(fields2)
if lines2:
# merge first line with record's main line
for j, val in enumerate(lines2[0]):
if val or isinstance(val, bool):
current[j] = val
# check value of current field
if not current[i] and not isinstance(current[i], bool):
# assign xml_ids, and forget about remaining lines
xml_ids = [item[1] for item in value.name_get()]
current[i] = ','.join(xml_ids)
else:
# append the other lines at the end
lines += lines2[1:]
# append the other lines at the end
lines += lines2[1:]
else:
current[i] = False
+1 -1
View File
@@ -16,7 +16,7 @@ ofxparse==0.16
passlib==1.6.5
Pillow==3.4.1
psutil==4.3.1
psycopg2==2.7.3
psycopg2==2.7.3.1
pydot==1.2.3
pyldap==2.4.28
pyparsing==2.1.10