[MERGE] forward port branch saas-11.3 up to 27a084eb81

This commit is contained in:
Christophe Simonis
2019-01-04 14:54:08 +01:00
47 changed files with 691 additions and 89 deletions
+1
View File
@@ -1779,6 +1779,7 @@ class AccountInvoiceLine(models.Model):
else:
price_unit = self.product_id.lst_price
self.price_unit = self.product_id.uom_id._compute_price(price_unit, self.uom_id)
self._set_currency()
if self.product_id.uom_id.category_id.id != self.uom_id.category_id.id:
warning = {
@@ -397,8 +397,8 @@ var LineRenderer = Widget.extend(FieldManagerMixin, {
_.each(props, function (line) {
line.display_triangle = (line.already_paid === false &&
((state.balance.amount_currency < 0 || line.partial_reconcile) && partialDebitProp && partialDebitProp === line) ||
((state.balance.amount_currency > 0 || line.partial_reconcile) && partialCreditProp && partialCreditProp === line));
(((state.balance.amount_currency < 0 || line.partial_reconcile) && partialDebitProp && partialDebitProp === line) ||
((state.balance.amount_currency > 0 || line.partial_reconcile) && partialCreditProp && partialCreditProp === line)));
var $line = $(qweb.render("reconciliation.line.mv_line", {'line': line, 'state': state}));
if (!isNaN(line.id)) {
$('<span class="line_info_button fa fa-info-circle"/>')
@@ -423,6 +423,7 @@ var mv_lines = {
'[6,"",0,5]': [
{'account_type': "liquidity", 'amount_currency_str': "", 'currency_id': false, 'date_maturity': "2017-01-23", 'date': "2017-01-23", 'total_amount_str': "$ 376.00", 'partner_id': 7, 'account_name': "Bank", 'name': "BNK1/2017/0002: SUPP.OUT/2017/0002", 'partner_name': "ASUSTeK", 'total_amount_currency_str': "", 'id': 392, 'credit': 376.0, 'journal_id': "Bank", 'amount_str': "$ 376.00", 'debit': 0.0, 'account_code': "101401", 'ref': "BILL/2017/0003", 'already_paid': true},
{'account_type': "liquidity", 'amount_currency_str': "", 'currency_id': false, 'date_maturity': "2017-01-23", 'date': "2017-01-23", 'total_amount_str': "$ 100.00", 'partner_id': 8, 'account_name': "Bank", 'name': "BNK1/2017/0003: CUST.IN/2017/0001", 'partner_name': "Agrolait", 'total_amount_currency_str': "", 'id': 394, 'credit': 0.0, 'journal_id': "Bank", 'amount_str': "$ 100.00", 'debit': 100.0, 'account_code': "101401", 'ref': "", 'already_paid': true},
{'account_type': "payable", 'amount_currency_str': "", 'currency_id': false, 'date_maturity': "2017-02-28", 'date': "2017-01-01", 'total_amount_str': "$ 10,000.00", 'partner_id': 12, 'account_name': "Account Payable", 'name': "BILL/2017/0001", 'partner_name': "Camptocamp", 'total_amount_currency_str': "", 'id': 114, 'credit': 10000.0, 'journal_id': [2, "Vendor Bills"], 'amount_str': "$ 10,000.00", 'debit': 0.0, 'account_code': "111100", 'ref': "", 'already_paid': false},
{'account_type': "liquidity", 'amount_currency_str': "", 'currency_id': false, 'date_maturity': "2017-01-23", 'date': "2017-01-23", 'total_amount_str': "$ 525.50", 'partner_id': 8, 'account_name': "Bank", 'name': "BNK1/2017/0004: CUST.IN/2017/0002", 'partner_name': "Agrolait", 'total_amount_currency_str': "", 'id': 396, 'credit': 0.0, 'journal_id': "Bank", 'amount_str': "$ 525.50", 'debit': 525.5, 'account_code': "101401", 'ref': "INV/2017/0003", 'already_paid': true},
{'account_type': "receivable", 'amount_currency_str': "", 'currency_id': false, 'date_maturity': "2017-02-07", 'date': "2017-01-08", 'total_amount_str': "$ 650.00", 'partner_id': 8, 'account_name': "101200 Account Receivable", 'name': "INV/2017/0002", 'partner_name': "Agrolait", 'total_amount_currency_str': "", 'id': 109, 'credit': 0.0, 'journal_id': [1, "Customer Invoices"], 'amount_str': "$ 650.00", 'debit': 650.0, 'account_code': "101200", 'ref': "", 'already_paid': false},
{'account_type': "receivable", 'amount_currency_str': "", 'currency_id': false, 'date_maturity': "2017-02-22", 'date': "2017-01-23", 'total_amount_str': "$ 525.00", 'partner_id': 8, 'account_name': "101200 Account Receivable", 'name': "INV/2017/0004", 'partner_name': "Agrolait", 'total_amount_currency_str': "", 'id': 399, 'credit': 0.0, 'journal_id': [1, "Customer Invoices"], 'amount_str': "$ 525.00", 'debit': 525.0, 'account_code': "101200", 'ref': "", 'already_paid': false},
@@ -662,7 +663,7 @@ QUnit.module('account', {
});
QUnit.test('Reconciliation basic data', function (assert) {
assert.expect(17);
assert.expect(16);
var clientAction = new ReconciliationClientAction.StatementAction(null, this.params.options);
testUtils.addMockEnvironment(clientAction, {
@@ -689,19 +690,19 @@ QUnit.module('account', {
clientAction.widgets[1].$('.accounting_view thead td:first').trigger('click');
assert.strictEqual(clientAction.widgets[1].$('.mv_line').length, 5, "should display 5 account move lines");
assert.strictEqual(clientAction.widgets[1].$('.mv_line .cell_right:contains(".")').length, 4, "should display only the credit account move lines (hide the debit)");
assert.strictEqual(clientAction.widgets[1].$('.mv_line .cell_right:contains(".")').length, 3, "should display only the credit account move lines (hide the debit)");
assert.strictEqual(clientAction.widgets[1].$('.mv_line.already_reconciled').length, 3, "should display 3 already reconciled account move lines");
assert.strictEqual(clientAction.widgets[1].$('.mv_line').text().replace(/[\n\r\s]+/g, ' '),
" 101401 2017-01-23 ASUSTeK: BNK1/2017/0002: SUPP.OUT/2017/0002 : BILL/2017/0003 $ 376.00 101401 2017-01-23 Agrolait: BNK1/2017/0003: CUST.IN/2017/0001 $ 100.00 101401 2017-01-23 Agrolait: BNK1/2017/0004: CUST.IN/2017/0002 : INV/2017/0003 $ 525.50 101200 2017-02-07 Agrolait: INV/2017/0002 $ 650.00 101200 2017-02-22 Agrolait: INV/2017/0004 $ 525.00 ",
" 101401 2017-01-23 ASUSTeK: BNK1/2017/0002: SUPP.OUT/2017/0002 : BILL/2017/0003 $ 376.00 101401 2017-01-23 Agrolait: BNK1/2017/0003: CUST.IN/2017/0001 $ 100.00 111100 2017-02-28 Camptocamp: BILL/2017/0001 $ 10,000.00 101401 2017-01-23 Agrolait: BNK1/2017/0004: CUST.IN/2017/0002 : INV/2017/0003 $ 525.50 101200 2017-02-07 Agrolait: INV/2017/0002 $ 650.00 ",
"should display 4 account move lines who contains the account_code, due_date, label and the credit");
assert.strictEqual(clientAction.widgets[1].$('.mv_line .cell_left:contains(".")').length, 1, "should display only 1 debit account move lines");
assert.strictEqual(clientAction.widgets[1].$('.mv_line .cell_left:contains(".")').length, 2, "should display only 2 debit account move lines");
// load more
assert.ok(clientAction.widgets[1].$('.match div.load-more a:visible').length, "should display the 'load more' button");
assert.equal(clientAction.widgets[1].$('.match div.load-more span').text(), 3, "should display 3 items remaining");
assert.equal(clientAction.widgets[1].$('.match div.load-more span').text(), 4, "should display 4 items remaining");
clientAction.widgets[1].$('.match div.load-more a').trigger('click');
assert.strictEqual(clientAction.widgets[1].$('.mv_line').length, 8, "should load 3 more records"),
assert.notOk(clientAction.widgets[1].$('.match div.load-more a:visible').length, "should not display the 'load more' button anymore");
// assert.notOk(clientAction.widgets[1].$('.match div.load-more a:visible').length, "should not display the 'load more' button anymore");
assert.ok(clientAction.widgets[0].$('caption button.btn-secondary:visible').length, "should display the 'validate' button");
assert.ok(clientAction.widgets[1].$('caption .text-danger:visible').length, "should display the 'Select a partner or choose a counterpart' message");
@@ -859,8 +860,14 @@ QUnit.module('account', {
[6],
[{
partner_id: lines.length == 1 ? lines[0].partner_id : false,
counterpart_aml_dicts:[],
payment_aml_ids: [392],
counterpart_aml_dicts:[{
"analytic_tag_ids": [[6, null, []]],
"counterpart_aml_id": 114,
"credit": 0,
"debit": 32.57999999999993,
"name": "BILL/2017/0001"
}],
payment_aml_ids: [],
new_aml_dicts: [],
}]
], "should call process_bank_statement_line with partial reconcile values");
@@ -889,7 +896,7 @@ QUnit.module('account', {
assert.notOk( widget.$('.cell_left .line_info_button').length, "should not display the partial reconciliation alert");
widget.$('.accounting_view thead td:first').trigger('click');
widget.$('.match .cell_account_code:first').trigger('click');
widget.$('.match .mv_line[data-line-id=114] .cell_account_code').trigger('click');
assert.equal( widget.$('.accounting_view tbody .cell_left .line_info_button').length, 1, "should display the partial reconciliation alert");
// The partner has been set automatically, remove it.
@@ -1717,7 +1724,7 @@ QUnit.module('account', {
.trigger('click');
$reconcileForm.find('.create_label input').val('dummy text').trigger('input');
assert.verifySteps(["Account", "Tax", "Journal"], "Journal rpc done");
// Verify the two (gift + tax) lines were added to the list
var $newLines = widget.$('tr.mv_line[data-line-id^=createLine]');
var idx = ($($($newLines[0]).find("td")[3]).text().trim() === "dummy text") ? 0 : 1;
+1
View File
@@ -8,6 +8,7 @@ from . import test_account_validate_account_move
from . import test_account_invoice_rounding
from . import test_bank_statement_reconciliation
from . import test_fiscal_position
from . import test_invoice_onchange
from . import test_reconciliation_widget
from . import test_payment
from . import test_product_id_change
@@ -0,0 +1,33 @@
from odoo.addons.account.tests.account_test_classes import AccountingTestCase
from odoo.tests import tagged
from odoo.tests.common import Form
@tagged('post_install', '-at_install')
class TestInvoiceOnchange(AccountingTestCase):
def setUp(self):
super(TestInvoiceOnchange, self).setUp()
self.invoice_line_onchange = self.env['account.invoice.line']._onchange_spec()
self.half_currency = self.env['res.currency'].create({
'name': 'HALF', 'symbol': '$HALF',
'rate_ids': [(0, 0, {'name': '1980-01-01', 'rate': 2})],
})
self.apples_product = self.env['product.product'].create(dict(
self.env['product.product'].default_get(self.env['product.product']._fields),
lst_price=10, name='apples',
))
def test_invoice_currency_onchange(self):
self_ctx = self.env['account.invoice'].with_context(type='out_invoice')
with Form(self_ctx, view='account.invoice_form') as invoice_form:
invoice_form.partner_id = self.env.user.partner_id
with invoice_form.invoice_line_ids.new() as invoice_line_form:
invoice_line_form.product_id = self.apples_product
# Check onchange keep price_unit if currency not changed
self.assertEqual(invoice_line_form.price_unit, 10)
invoice_form.currency_id = self.half_currency
with invoice_form.invoice_line_ids.new() as invoice_line_form:
invoice_line_form.product_id = self.apples_product
# Check onchange gives converted price with custom currency
self.assertEqual(invoice_line_form.price_unit, 20)
@@ -51,7 +51,7 @@ class AccountPayment(models.Model):
@api.onchange('amount','currency_id')
def _onchange_amount(self):
res = super(AccountPayment, self)._onchange_amount()
self.check_amount_in_words = self.currency_id.amount_to_text(self.amount)
self.check_amount_in_words = self.currency_id.amount_to_text(self.amount) if self.currency_id else ''
return res
def _check_communication(self, payment_method_id, communication):
@@ -4,5 +4,8 @@
<record id="base.nl" model="res.country">
<field eval="'%(street_name)s %(street_number)s/%(street_number2)s'" name="street_format" />
</record>
<record id="base.mx" model="res.country">
<field eval="'%(street_name)s %(street_number)s/%(street_number2)s'" name="street_format" />
</record>
</data>
</odoo>
@@ -12,6 +12,7 @@ class TestStreetFields(TransactionCase):
self.env.ref('base.be').write({'street_format': '%(street_name)s, %(street_number)s/%(street_number2)s'})
self.env.ref('base.us').write({'street_format': '%(street_number)s/%(street_number2)s %(street_name)s'})
self.env.ref('base.ch').write({'street_format': 'header %(street_name)s, %(street_number)s - %(street_number2)s trailer'})
self.env.ref('base.mx').write({'street_format': '%(street_name)s %(street_number)s/%(street_number2)s'})
def create_and_assert(self, partner_name, country_id, street, street_name, street_number, street_number2):
partner = self.Partner.create({'name': partner_name + '-1', 'street': street, 'country_id': country_id})
@@ -39,6 +40,7 @@ class TestStreetFields(TransactionCase):
self.create_and_assert('Test00', self.env.ref('base.us').id, '40/2b Chaussee de Namur', 'Chaussee de Namur', '40', '2b')
self.create_and_assert('Test01', self.env.ref('base.us').id, '40 Chaussee de Namur', 'Chaussee de Namur', '40', '')
self.create_and_assert('Test02', self.env.ref('base.us').id, 'Chaussee de Namur', 'de Namur', 'Chaussee', '')
self.create_and_assert('Test03', self.env.ref('base.mx').id, 'Av. Miguel Hidalgo y Costilla 601', 'Av.', 'Miguel Hidalgo y Costilla 601', '')
def test_01_header_trailer(self):
self.create_and_assert('Test10', self.env.ref('base.ch').id, 'header Chaussee de Namur, 40 - 2b trailer', 'Chaussee de Namur', '40', '2b')
@@ -19,13 +19,15 @@
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='street']" position="replace">
<field name="street" invisible="1"/>
<field name="street_name" placeholder="Street Name..." attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
<div class="o_row">
<label for="street_number" class="oe_edit_only"/>
<div>
<field name="street" class="oe_read_only"/>
</div>
<field name="street_name" placeholder="Street Name..." attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}" class="oe_edit_only"/>
<div class="oe_edit_only o_row">
<label for="street_number"/>
<span> </span>
<field name="street_number" attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
<label for="street_number2" class="oe_edit_only"/>
<label for="street_number2"/>
<field name="street_number2" attrs="{'readonly': [('type', '=', 'contact'),('parent_id', '!=', False)]}"/>
</div>
</xpath>
+2 -2
View File
@@ -179,9 +179,9 @@ class HrPayslip(models.Model):
for day, hours, leave in day_leave_intervals:
holiday = leave.holiday_id
current_leave_struct = leaves.setdefault(holiday.holiday_status_id, {
'name': holiday.holiday_status_id.name,
'name': holiday.holiday_status_id.name or _('Global Leaves'),
'sequence': 5,
'code': holiday.holiday_status_id.name,
'code': holiday.holiday_status_id.name or 'GLOBAL',
'number_of_days': 0.0,
'number_of_hours': 0.0,
'contract_id': contract.id,
+1 -1
View File
@@ -67,7 +67,7 @@ def jsonrpc(url, method='call', params=None, timeout=15):
e.data = response['error']['data']
raise e
return response.get('result')
except (ValueError, requests.exceptions.ConnectionError, requests.exceptions.MissingSchema, requests.exceptions.Timeout) as e:
except (ValueError, requests.exceptions.ConnectionError, requests.exceptions.MissingSchema, requests.exceptions.Timeout, requests.exceptions.HTTPError) as e:
raise exceptions.AccessError('The url that this service requested returned an error. Please contact the author the app. The url it tried to contact was ' + url)
#----------------------------------------------------------
+9
View File
@@ -9,6 +9,9 @@
<record id="tax_group_6" model="account.tax.group">
<field name="name">BTW 6%</field>
</record>
<record id="tax_group_9" model="account.tax.group">
<field name="name">BTW 9%</field>
</record>
<record id="tax_group_21" model="account.tax.group">
<field name="name">BTW 21%</field>
</record>
@@ -18,6 +21,9 @@
<record id="tax_group_6_eu" model="account.tax.group">
<field name="name">BTW 6% EU</field>
</record>
<record id="tax_group_9_eu" model="account.tax.group">
<field name="name">BTW 9% EU</field>
</record>
<record id="tax_group_21_eu" model="account.tax.group">
<field name="name">BTW 21% EU</field>
</record>
@@ -27,6 +33,9 @@
<record id="tax_group_6_niet_eu" model="account.tax.group">
<field name="name">BTW 6% Niet EU</field>
</record>
<record id="tax_group_9_niet_eu" model="account.tax.group">
<field name="name">BTW 9% Niet EU</field>
</record>
<record id="tax_group_21_niet_eu" model="account.tax.group">
<field name="name">BTW 21% Niet EU</field>
</record>
@@ -16,6 +16,11 @@
<field name="tax_src_id" ref="btw_6"/>
<field name="tax_dest_id" ref="btw_X1"/>
</record>
<record id="position_tax_extracom_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_9"/>
<field name="tax_dest_id" ref="btw_X1"/>
</record>
<record id="position_tax_extracom_21" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_21"/>
@@ -36,6 +41,11 @@
<field name="tax_src_id" ref="btw_6_d"/>
<field name="tax_dest_id" ref="btw_X3"/>
</record>
<record id="position_tax_extracom_d_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_9_d"/>
<field name="tax_dest_id" ref="btw_X3"/>
</record>
<record id="position_tax_extracom_d_21" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_21_d"/>
@@ -52,6 +62,11 @@
<field name="tax_src_id" ref="btw_6_buy"/>
<field name="tax_dest_id" ref="btw_E1"/>
</record>
<record id="position_tax_extracom_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_9_buy"/>
<field name="tax_dest_id" ref="btw_E1"/>
</record>
<record id="position_tax_extracom_7" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_21_buy"/>
@@ -67,6 +82,11 @@
<field name="tax_src_id" ref="btw_6_buy_d"/>
<field name="tax_dest_id" ref="btw_E1"/>
</record>
<record id="position_tax_extracom_d_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_9_buy_d"/>
<field name="tax_dest_id" ref="btw_E1"/>
</record>
<record id="position_tax_extracom_d_7" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_non_eu"/>
<field name="tax_src_id" ref="btw_21_buy_d"/>
@@ -89,6 +109,11 @@
<field name="tax_src_id" ref="btw_6"/>
<field name="tax_dest_id" ref="btw_X0_diensten"/>
</record>
<record id="position_tax_intracom_2_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_9"/>
<field name="tax_dest_id" ref="btw_X0"/>
</record>
<record id="position_tax_intracom_3" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_21"/>
@@ -109,6 +134,11 @@
<field name="tax_src_id" ref="btw_6_d"/>
<field name="tax_dest_id" ref="btw_X2"/>
</record>
<record id="position_tax_intracom_d_2_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_9_d"/>
<field name="tax_dest_id" ref="btw_X2"/>
</record>
<record id="position_tax_intracom_d_3" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_21_d"/>
@@ -124,6 +154,11 @@
<field name="tax_src_id" ref="btw_6_buy"/>
<field name="tax_dest_id" ref="btw_I_6"/>
</record>
<record id="position_tax_intracom_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_9_buy"/>
<field name="tax_dest_id" ref="btw_I_9"/>
</record>
<record id="position_tax_intracom_7" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_21_buy"/>
@@ -139,6 +174,11 @@
<field name="tax_src_id" ref="btw_6_buy_d"/>
<field name="tax_dest_id" ref="btw_I_6"/>
</record>
<record id="position_tax_intracom_d_9" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_9_buy_d"/>
<field name="tax_dest_id" ref="btw_I_9"/>
</record>
<record id="position_tax_intracom_d_7" model="account.fiscal.position.tax.template">
<field name="position_id" ref="fiscal_position_template_eu"/>
<field name="tax_src_id" ref="btw_21_buy_d"/>
+237 -18
View File
@@ -20,7 +20,7 @@
<record id="btw_6" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Verkopen/omzet laag</field>
<field name="name">Verkopen/omzet laag 6%</field>
<field name="description">6% BTW</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -30,6 +30,19 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_05'),ref('tag_nl_22')])]"/>
<field name="tax_group_id" ref="tax_group_6"/>
</record>
<record id="btw_9" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Verkopen/omzet laag 9%</field>
<field name="description">9% BTW</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_payable_l"/>
<field name="account_id" ref="vat_payable_l"/>
<field name="type_tax_use">sale</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_05'),ref('tag_nl_22')])]"/>
<field name="tax_group_id" ref="tax_group_9"/>
</record>
<record id="btw_21" model="account.tax.template">
<field name="sequence">5</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
@@ -73,7 +86,7 @@
<record id="btw_6_d" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Verkopen/omzet laag diensten</field>
<field name="name">Verkopen/omzet laag diensten 6%</field>
<field name="description">6% BTW diensten</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -83,6 +96,19 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_05'),ref('tag_nl_22')])]"/>
<field name="tax_group_id" ref="tax_group_6"/>
</record>
<record id="btw_9_d" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Verkopen/omzet laag diensten 9%</field>
<field name="description">9% BTW diensten</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_payable_l_d"/>
<field name="account_id" ref="vat_payable_l_d"/>
<field name="type_tax_use">sale</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_05'),ref('tag_nl_22')])]"/>
<field name="tax_group_id" ref="tax_group_9"/>
</record>
<record id="btw_21_d" model="account.tax.template">
<field name="sequence">6</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
@@ -113,7 +139,7 @@
<record id="btw_6_buy" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen laag (inkopen)</field>
<field name="name">BTW te vorderen laag (inkopen) 6%</field>
<field name="description">6% BTW</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -123,10 +149,24 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6"/>
</record>
<record id="btw_9_buy" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen laag (inkopen) 9%</field>
<field name="description">9% BTW</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_refund_l"/>
<field name="account_id" ref="vat_refund_l"/>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9"/>
</record>
<record id="btw_6_buy_incl" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen laag (inkopen incl. BTW)</field>
<field name="name">BTW te vorderen laag (inkopen incl. BTW) 6%</field>
<field name="description">6% BTW Incl.</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -137,6 +177,20 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6"/>
</record>
<record id="btw_9_buy_incl" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen laag (inkopen incl. BTW) 9%</field>
<field name="description">9% BTW Incl.</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="price_include">True</field>
<field name="refund_account_id" ref="vat_refund_l"/>
<field name="account_id" ref="vat_refund_l"/>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9"/>
</record>
<record id="btw_21_buy" model="account.tax.template">
<field name="sequence">5</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
@@ -181,7 +235,7 @@
<record id="btw_6_buy_d" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen laag (inkopen) diensten</field>
<field name="name">BTW te vorderen laag (inkopen) diensten 6%</field>
<field name="description">6% BTW diensten</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -191,6 +245,19 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6"/>
</record>
<record id="btw_9_buy_d" model="account.tax.template">
<field name="sequence">10</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen laag (inkopen) diensten 9%</field>
<field name="description">9% BTW diensten</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_refund_l_d"/>
<field name="account_id" ref="vat_refund_l_d"/>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9"/>
</record>
<record id="btw_21_buy_d" model="account.tax.template">
<field name="sequence">6</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
@@ -231,7 +298,7 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_08')])]"/>
<field name="tax_group_id" ref="tax_group_0"/>
</record>
<record id="btw_ink_0_1" model="account.tax.template">
<record id="btw_ink_0_1" model="account.tax.template">
<field name="sequence">98</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">BTW te vorderen verlegd (inkopen1)</field>
@@ -276,7 +343,7 @@
<record id="btw_I_6_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">21</field>
<field name="name">Inkopen import binnen EU laag(1)</field>
<field name="name">Inkopen import binnen EU laag(1) 6%</field>
<field name="description">Inkopen import binnen EU laag(1)</field>
<field eval="-6" name="amount"/>
<field name="amount_type">percent</field>
@@ -286,10 +353,23 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_30')])]"/>
<field name="tax_group_id" ref="tax_group_6_eu"/>
</record>
<record id="btw_I_9_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">21</field>
<field name="name">Inkopen import binnen EU laag(1) 9%</field>
<field name="description">Inkopen import binnen EU laag(1)</field>
<field eval="-9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_payable_l_eu"/>
<field name="account_id" ref="vat_payable_l_eu"/>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_30')])]"/>
<field name="tax_group_id" ref="tax_group_9_eu"/>
</record>
<record id="btw_I_6_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">22</field>
<field name="name">Inkopen import binnen EU laag(2)</field>
<field name="name">Inkopen import binnen EU laag(2) 6%</field>
<field name="description">Inkopen import binnen EU laag(2)</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -299,10 +379,23 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6_eu"/>
</record>
<record id="btw_I_9_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">22</field>
<field name="name">Inkopen import binnen EU laag(2) 9%</field>
<field name="description">Inkopen import binnen EU laag(2)</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_refund_l_eu"/>
<field name="account_id" ref="vat_refund_l_eu"/>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9_eu"/>
</record>
<record id="btw_I_6" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU laag</field>
<field name="name">Inkopen import binnen EU laag 6%</field>
<field name="description">6% BTW import binnen EU</field>
<field eval="6" name="amount"/>
<field name="amount_type">group</field>
@@ -311,6 +404,18 @@
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_I_6_1'), ref('btw_I_6_2')])]"/>
<field name="tax_group_id" ref="tax_group_6_eu"/>
</record>
<record id="btw_I_9" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU laag 9%</field>
<field name="description">9% BTW import binnen EU</field>
<field eval="9" name="amount"/>
<field name="amount_type">group</field>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_17')])]"/>
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_I_9_1'), ref('btw_I_9_2')])]"/>
<field name="tax_group_id" ref="tax_group_9_eu"/>
</record>
<record id="btw_I_21_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">21</field>
@@ -431,7 +536,7 @@
<record id="btw_I_6_d_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">21</field>
<field name="name">Inkopen import binnen EU laag(1) diensten</field>
<field name="name">Inkopen import binnen EU laag(1) diensten 6%</field>
<field name="description">Inkopen import binnen EU laag(1) diensten</field>
<field eval="-6" name="amount"/>
<field name="amount_type">percent</field>
@@ -441,10 +546,23 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_30')])]"/>
<field name="tax_group_id" ref="tax_group_6_eu"/>
</record>
<record id="btw_I_9_d_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">21</field>
<field name="name">Inkopen import binnen EU laag(1) diensten 9%</field>
<field name="description">Inkopen import binnen EU laag(1) diensten</field>
<field eval="-9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_payable_l_d_eu"/>
<field name="account_id" ref="vat_payable_l_d_eu"/>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_30')])]"/>
<field name="tax_group_id" ref="tax_group_9_eu"/>
</record>
<record id="btw_I_6_d_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">22</field>
<field name="name">Inkopen import binnen EU laag(2) diensten</field>
<field name="name">Inkopen import binnen EU laag(2) diensten 6%</field>
<field name="description">Inkopen import binnen EU laag(2) diensten</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -454,10 +572,23 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6_eu"/>
</record>
<record id="btw_I_9_d_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">22</field>
<field name="name">Inkopen import binnen EU laag(2) diensten 9%</field>
<field name="description">Inkopen import binnen EU laag(2) diensten</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_refund_l_d_eu"/>
<field name="account_id" ref="vat_refund_l_d_eu"/>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9_eu"/>
</record>
<record id="btw_I_6_d" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU laag diensten</field>
<field name="name">Inkopen import binnen EU laag diensten 6%</field>
<field name="description">6% BTW import binnen EU diensten</field>
<field eval="6" name="amount"/>
<field name="amount_type">group</field>
@@ -466,6 +597,18 @@
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_I_6_d_1'), ref('btw_I_6_d_2')])]"/>
<field name="tax_group_id" ref="tax_group_6_eu"/>
</record>
<record id="btw_I_9_d" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import binnen EU laag diensten 9%</field>
<field name="description">9% BTW import binnen EU diensten</field>
<field eval="9" name="amount"/>
<field name="amount_type">group</field>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_17')])]"/>
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_I_9_d_1'), ref('btw_I_9_d_2')])]"/>
<field name="tax_group_id" ref="tax_group_9_eu"/>
</record>
<record id="btw_I_21_d_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="sequence">21</field>
@@ -547,7 +690,7 @@
<!-- BTW inkoop -->
<record id="btw_E1_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(1)</field>
<field name="name">Inkopen import buiten EU laag(1) 6%</field>
<field name="description">Inkopen import buiten EU laag(1)</field>
<field eval="-6" name="amount"/>
<field name="amount_type">percent</field>
@@ -558,9 +701,22 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_29')])]"/>
<field name="tax_group_id" ref="tax_group_6_niet_eu"/>
</record>
<record id="btw_E1_1_9" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(1) 9%</field>
<field name="description">Inkopen import buiten EU laag(1)</field>
<field eval="-9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_payable_l_non_eu"/>
<field name="account_id" ref="vat_payable_l_non_eu"/>
<field name="sequence">21</field>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_29')])]"/>
<field name="tax_group_id" ref="tax_group_9_niet_eu"/>
</record>
<record id="btw_E1_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(2)</field>
<field name="name">Inkopen import buiten EU laag(2) 6%</field>
<field name="description">Inkopen import buiten EU laag(2)</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -571,10 +727,23 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6_niet_eu"/>
</record>
<record id="btw_E1_2_9" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(2) 9%</field>
<field name="description">Inkopen import buiten EU laag(2)</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_refund_l_non_eu"/>
<field name="account_id" ref="vat_refund_l_non_eu"/>
<field name="sequence">22</field>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9_niet_eu"/>
</record>
<record id="btw_E1" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag</field>
<field name="name">Inkopen import buiten EU laag 6%</field>
<field name="description">BTW import buiten EU laag inkopen</field>
<field eval="6" name="amount"/>
<field name="amount_type">group</field>
@@ -583,6 +752,18 @@
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_E1_1'), ref('btw_E1_2')])]"/>
<field name="tax_group_id" ref="tax_group_6_niet_eu"/>
</record>
<record id="btw_E1_9" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag 9%</field>
<field name="description">BTW import buiten EU laag inkopen</field>
<field eval="9" name="amount"/>
<field name="amount_type">group</field>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_16')])]"/>
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_E1_1_9'), ref('btw_E1_2_9')])]"/>
<field name="tax_group_id" ref="tax_group_9_niet_eu"/>
</record>
<record id="btw_E2_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU hoog(1)</field>
@@ -689,7 +870,7 @@
<!-- BTW inkoop diensten -->
<record id="btw_E1_d_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(1) diensten</field>
<field name="name">Inkopen import buiten EU laag(1) diensten 6%</field>
<field name="description">Inkopen import buiten EU laag(1) diensten</field>
<field eval="-6" name="amount"/>
<field name="amount_type">percent</field>
@@ -700,9 +881,22 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_29')])]"/>
<field name="tax_group_id" ref="tax_group_6_niet_eu"/>
</record>
<record id="btw_E1_d_1_9" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(1) diensten 9%</field>
<field name="description">Inkopen import buiten EU laag(1) diensten</field>
<field eval="-9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_payable_l_d_non_eu"/>
<field name="account_id" ref="vat_payable_l_d_non_eu"/>
<field name="sequence">21</field>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_29')])]"/>
<field name="tax_group_id" ref="tax_group_9_niet_eu"/>
</record>
<record id="btw_E1_d_2" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(2) diensten</field>
<field name="name">Inkopen import buiten EU laag(2) diensten 6%</field>
<field name="description">Inkopen import buiten EU laag(2) diensten</field>
<field eval="6" name="amount"/>
<field name="amount_type">percent</field>
@@ -713,10 +907,23 @@
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_6_niet_eu"/>
</record>
<record id="btw_E1_d_2_9" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag(2) diensten 9%</field>
<field name="description">Inkopen import buiten EU laag(2) diensten</field>
<field eval="9" name="amount"/>
<field name="amount_type">percent</field>
<field name="refund_account_id" ref="vat_refund_l_d_non_eu"/>
<field name="account_id" ref="vat_refund_l_d_non_eu"/>
<field name="sequence">22</field>
<field name="type_tax_use">none</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_33')])]"/>
<field name="tax_group_id" ref="tax_group_9_niet_eu"/>
</record>
<record id="btw_E1_d" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag diensten</field>
<field name="name">Inkopen import buiten EU laag diensten 6%</field>
<field name="description">BTW import buiten EU laag inkopen diensten</field>
<field eval="6" name="amount"/>
<field name="amount_type">group</field>
@@ -725,6 +932,18 @@
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_E1_d_1'), ref('btw_E1_d_2')])]"/>
<field name="tax_group_id" ref="tax_group_6_niet_eu"/>
</record>
<record id="btw_E1_d_9" model="account.tax.template">
<field name="sequence">20</field>
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU laag diensten 9%</field>
<field name="description">BTW import buiten EU laag inkopen diensten</field>
<field eval="9" name="amount"/>
<field name="amount_type">group</field>
<field name="type_tax_use">purchase</field>
<field name="tag_ids" eval="[(6,0,[ref('tag_nl_16')])]"/>
<field name="children_tax_ids" eval="[(6, 0, [ref('btw_E1_d_1_9'), ref('btw_E1_d_2_9')])]"/>
<field name="tax_group_id" ref="tax_group_9_niet_eu"/>
</record>
<record id="btw_E2_d_1" model="account.tax.template">
<field name="chart_template_id" ref="l10nnl_chart_template"/>
<field name="name">Inkopen import buiten EU hoog(1) diensten</field>
+3
View File
@@ -9,6 +9,9 @@
<record id="tax_group_10" model="account.tax.group">
<field name="name">MVA 10%</field>
</record>
<record id="tax_group_12" model="account.tax.group">
<field name="name">MVA 12%</field>
</record>
<record id="tax_group_15" model="account.tax.group">
<field name="name">MVA 15%</field>
</record>
+26 -3
View File
@@ -103,7 +103,19 @@
<field name="account_id" ref="chart2704"/>
<field name="refund_account_id" ref="chart2704"/>
<field name="tag_ids" eval="[(6,0,[ref('tag_no_06'),ref('tag_no_15')])]"/>
<field name="tax_group_id" ref="tax_group_10"/>
<field name="tax_group_id" ref="tax_group_10"/>
</record>
<record id="tax3b" model="account.tax.template">
<field name="chart_template_id" ref="no_chart_template"/>
<field name="name">Utgående 12% mva</field>
<field name="description">Utgående 12% mva</field>
<field name="amount">12</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_id" ref="chart2704"/>
<field name="refund_account_id" ref="chart2704"/>
<field name="tag_ids" eval="[(6,0,[ref('tag_no_06'),ref('tag_no_15')])]"/>
<field name="tax_group_id" ref="tax_group_12"/>
</record>
<record id="tax4" model="account.tax.template">
<field name="chart_template_id" ref="no_chart_template"/>
@@ -139,9 +151,20 @@
<field name="account_id" ref="chart2714"/>
<field name="refund_account_id" ref="chart2714"/>
<field name="tag_ids" eval="[(6,0,[ref('tag_no_09'),ref('tag_no_12')])]"/>
<field name="tax_group_id" ref="tax_group_10"/>
<field name="tax_group_id" ref="tax_group_10"/>
</record>
<record id="tax6b" model="account.tax.template">
<field name="chart_template_id" ref="no_chart_template"/>
<field name="name">Inngående 12% mva</field>
<field name="description">Inngående 12% mva</field>
<field name="amount">12</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="chart2714"/>
<field name="refund_account_id" ref="chart2714"/>
<field name="tag_ids" eval="[(6,0,[ref('tag_no_09'),ref('tag_no_12')])]"/>
<field name="tax_group_id" ref="tax_group_12"/>
</record>
<record id="tax7" model="account.tax.template">
<field name="chart_template_id" ref="no_chart_template"/>
<field name="name">Inngående 0% mva</field>
+22 -3
View File
@@ -412,17 +412,36 @@ class ProductProduct(models.Model):
self.check_access_rule("read")
result = []
# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
# Use `load=False` to not call `name_get` for the `product_tmpl_id`
self.sudo().read(['name', 'default_code', 'product_tmpl_id', 'attribute_value_ids'], load=False)
product_template_ids = self.sudo().mapped('product_tmpl_id').ids
if partner_ids:
supplier_info = self.env['product.supplierinfo'].sudo().search([
('product_tmpl_id', 'in', product_template_ids),
('name', 'in', partner_ids),
])
# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
# Use `load=False` to not call `name_get` for the `product_tmpl_id` and `product_id`
supplier_info.sudo().read(['product_tmpl_id', 'product_id', 'product_name', 'product_code'], load=False)
supplier_info_by_template = {}
for r in supplier_info:
supplier_info_by_template.setdefault(r.product_tmpl_id, []).append(r)
for product in self.sudo():
# display only the attributes with multiple possible values on the template
variable_attributes = product.product_tmpl_id._get_valid_product_template_attribute_lines().filtered(lambda l: len(l.value_ids) > 1).mapped('attribute_id')
variable_attributes = product.attribute_value_ids.filtered(lambda v: len(v.attribute_id.value_ids) > 1).mapped('attribute_id')
variant = product.attribute_value_ids._variant_name(variable_attributes)
name = variant and "%s (%s)" % (product.name, variant) or product.name
sellers = []
if partner_ids:
sellers = [x for x in product.seller_ids if (x.name.id in partner_ids) and (x.product_id == product)]
product_supplier_info = supplier_info_by_template.get(product.product_tmpl_id, [])
sellers = [x for x in product_supplier_info if x.product_id and x.product_id == product]
if not sellers:
sellers = [x for x in product.seller_ids if (x.name.id in partner_ids) and not x.product_id]
sellers = [x for x in product_supplier_info if not x.product_id]
if sellers:
for s in sellers:
seller_variant = s.product_name and (
@@ -360,6 +360,8 @@ class ProductTemplate(models.Model):
@api.multi
def name_get(self):
# Prefetch the fields used by the `name_get`, so `browse` doesn't fetch other fields
self.read(['name', 'default_code'])
return [(template.id, '%s%s' % (template.default_code and '[%s] ' % template.default_code or '', template.name))
for template in self]
+3 -3
View File
@@ -79,10 +79,10 @@ class PurchaseReport(models.Model):
extract(epoch from age(s.date_approve,s.date_order))/(24*60*60)::decimal(16,2) as delay,
extract(epoch from age(l.date_planned,s.date_order))/(24*60*60)::decimal(16,2) as delay_pass,
count(*) as nbr_lines,
sum(l.price_unit / COALESCE(cr.rate, 1.0) * l.product_qty)::decimal(16,2) as price_total,
avg(100.0 * (l.price_unit / COALESCE(cr.rate,1.0) * l.product_qty) / NULLIF(ip.value_float*l.product_qty/u.factor*u2.factor, 0.0))::decimal(16,2) as negociation,
sum(l.price_unit / COALESCE(NULLIF(cr.rate, 0), 1.0) * l.product_qty)::decimal(16,2) as price_total,
avg(100.0 * (l.price_unit / COALESCE(NULLIF(cr.rate, 0),1.0) * l.product_qty) / NULLIF(ip.value_float*l.product_qty/u.factor*u2.factor, 0.0))::decimal(16,2) as negociation,
sum(ip.value_float*l.product_qty/u.factor*u2.factor)::decimal(16,2) as price_standard,
(sum(l.product_qty * l.price_unit / COALESCE(cr.rate, 1.0))/NULLIF(sum(l.product_qty/u.factor*u2.factor),0.0))::decimal(16,2) as price_average,
(sum(l.product_qty * l.price_unit / COALESCE(NULLIF(cr.rate, 0), 1.0))/NULLIF(sum(l.product_qty/u.factor*u2.factor),0.0))::decimal(16,2) as price_average,
partner.country_id as country_id,
partner.commercial_partner_id as commercial_partner_id,
analytic_account.id as account_analytic_id,
+8 -1
View File
@@ -285,7 +285,14 @@ class SaleOrderLine(models.Model):
@api.onchange('product_uom_qty')
def _onchange_product_uom_qty(self):
if self.state == 'sale' and self.product_id.type in ['product', 'consu'] and self.product_uom_qty < self._origin.product_uom_qty:
# When modifying a one2many, _origin doesn't guarantee that its values will be the ones
# in database. Hence, we need to explicitly read them from there.
if self._origin:
product_uom_qty_origin = self._origin.read(["product_uom_qty"])[0]["product_uom_qty"]
else:
product_uom_qty_origin = 0
if self.state == 'sale' and self.product_id.type in ['product', 'consu'] and self.product_uom_qty < product_uom_qty_origin:
# Do not display this warning if the new quantity is below the delivered
# one; the `write` will raise an `UserError` anyway.
if self.product_uom_qty < self.qty_delivered:
+1 -1
View File
@@ -425,7 +425,7 @@ class InventoryLine(models.Model):
"""
for line in self:
if line.product_id.type != 'product':
raise UserError(_("You can only adjust storable products."))
raise UserError(_("You can only adjust storable products.") + '\n\n%s -> %s' % (line.product_id.display_name, line.product_id.type))
def _get_move_values(self, qty, location_id, location_dest_id, out):
self.ensure_one()
@@ -10,7 +10,7 @@
<template id="report_location_barcode">
<t t-call="web.html_container">
<div t-foreach="[docs[x:x+4] for x in xrange(0, len(docs), 4)]" t-as="page_docs" class="page article page_stock_location_barcodes">
<div t-foreach="[docs[x:x+4] for x in range(0, len(docs), 4)]" t-as="page_docs" class="page article page_stock_location_barcodes">
<t t-foreach="page_docs" t-as="o">
<t t-if="o.barcode"><t t-set="content" t-value="o.barcode"/></t>
<t t-if="not o.barcode"><t t-set="content" t-value="o.name"/></t>
@@ -8,7 +8,7 @@ class StockPickingToBatch(models.TransientModel):
_name = 'stock.picking.to.batch'
_description = 'Batch Picking Lines'
batch_id = fields.Many2one('stock.picking.batch', string='Batch Picking', required=True, oldname="wave_id")
batch_id = fields.Many2one('stock.picking.batch', string='Batch Picking', oldname="wave_id")
@api.multi
def attach_pickings(self):
@@ -8,7 +8,7 @@
<field name="arch" type="xml">
<form string="Add pickings to batch">
<separator string="Select a batch"/>
<field name="batch_id" class="oe_inline" options="{'no_create_edit': True, 'no_open': True}"/>
<field name="batch_id" class="oe_inline" required="1" options="{'no_create_edit': True, 'no_open': True}"/>
<footer>
<button name="attach_pickings" type="object" string="Add to Batch" class="btn-primary"/>
<button string="Cancel" class="btn-secondary" special="cancel"/>
@@ -4172,11 +4172,24 @@ var BasicModel = AbstractModel.extend({
}
return def.then(function () {
var resIDs = [];
// generate the current count and res_ids list by applying the changes
var currentCount = list.count;
var currentResIDs = list.res_ids;
var effectiveLimit = (list.limit || 0) - (list.tempLimitIncrement || 0);
var upperBound = effectiveLimit ? Math.min(list.offset + effectiveLimit, currentCount) : currentCount;
// if new records have been added to the list, their virtual ids have
// been pushed at the end of res_ids (or at the beginning, depending
// on the editable property), ignoring completely the current page
// where the records have actually been created ; for that reason,
// we use orderedResIDs which is a freezed order with the virtual ids
// at the correct position where they were actually inserted ; however,
// when we use orderedResIDs, we must filter out ids that are not in
// res_ids, which correspond to records that have been removed from
// the relation (this information being taken into account in res_ids
// but not in orderedResIDs)
if (list.orderedResIDs) {
currentResIDs = list.orderedResIDs.filter(function (resID) {
return list.res_ids.indexOf(resID) >= 0;
});
}
var currentCount = currentResIDs.length;
var upperBound = list.limit ? Math.min(list.offset + list.limit, currentCount) : currentCount;
var fieldNames = list.getFieldNames();
for (var i = list.offset; i < upperBound; i++) {
var resId = currentResIDs[i];
@@ -148,6 +148,21 @@ var BasicView = AbstractView.extend({
if (_.difference(fieldViewTypes, recordViewTypes).length) {
fieldNames.push(name);
}
if (record.data[name].viewType === 'default') {
// Use case: x2many (tags) in x2many list views
// When opening the x2many record form view, the
// x2many will be reloaded but it may not have
// the same fields (ex: tags in list and list in
// form) so we need to merge the fieldsInfo to
// avoid losing the initial fields (display_name)
var defaultFieldInfo = record.data[name].fieldsInfo.default;
_.each(fieldViews, function (fieldView) {
_.each(fieldView.fieldsInfo, function (x2mFieldInfo) {
_.defaults(x2mFieldInfo, defaultFieldInfo);
});
});
}
}
}
// Many2one: context is not the same between the different views
@@ -244,18 +244,18 @@ return AbstractModel.extend({
this.setDate(this.data.target_date.clone().add(-1, this.data.scale));
},
/**
* @todo: this should not work. it ignores the domain/context
*
* @override
* @param {any} _handle ignored
* @param {Object} params
* @param {Object} [params.context]
* @param {Array} [params.domain]
* @returns {Deferred}
*/
reload: function (_handle, params) {
reload: function (handle, params) {
if (params.domain) {
this.data.domain = params.domain;
}
if (params.context) {
this.data.context = params.context;
}
return this._loadCalendar();
},
/**
@@ -11,7 +11,7 @@ var _t = core._t;
var AttachDocument = Widget.extend({
template: 'AttachDocument',
events: {
'click span.o_attach_document': '_onClickAttachDocument',
'click': '_onClickAttachDocument',
'change input.o_input_file': '_onFileChanged',
},
/**
@@ -76,6 +76,9 @@ var AttachDocument = Widget.extend({
* @param {Event} ev
*/
_onClickAttachDocument: function (ev) {
if ($(ev.target).is('input.o_input_file')) {
return;
}
var fieldNames = this.getParent().canBeSaved(this.state.id);
if (fieldNames.length) {
return this._notifyInvalidFields(fieldNames);
@@ -4072,6 +4072,50 @@ QUnit.module('relational_fields', {
form.destroy();
});
QUnit.test('delete a record while adding another one in a multipage', function (assert) {
// in a many2one with at least 2 pages, add a new line. Delete the line above it.
// (the onchange makes it so that the virtualID is inserted in the middle of the currentResIDs.)
// it should load the next line to display it on the page.
assert.expect(2);
this.data.partner.records[0].turtles = [2, 3];
this.data.partner.onchanges.turtles = function (obj) {
obj.turtles = [[5]].concat(obj.turtles);
};
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch:'<form string="Partners">' +
'<sheet>' +
'<group>' +
'<field name="turtles">' +
'<tree editable="bottom" limit="1" decoration-muted="turtle_bar == False">' +
'<field name="turtle_foo"/>' +
'<field name="turtle_bar"/>' +
'</tree>' +
'</field>' +
'</group>' +
'</sheet>' +
'</form>',
res_id: 1,
});
form.$buttons.find('.o_form_button_edit').click();
// add a line (virtual record)
form.$('.o_field_x2many_list_row_add a').click();
form.$('.o_input').val('pi').trigger('input');
// delete the line above it
form.$('.o_list_record_remove').first().click();
// the next line should be displayed below the newly added one
assert.strictEqual(form.$('.o_data_row').length, 2, "should have 2 records");
assert.strictEqual(form.$('.o_data_row .o_data_cell:first-child').text(), 'pikawa',
"should display the correct records on page 1");
form.destroy();
});
QUnit.test('onchange returning a command 6 for an x2many', function (assert) {
assert.expect(2);
@@ -6375,7 +6419,7 @@ QUnit.module('relational_fields', {
'</form>',
res_id: 1,
mockRPC: function (route, args) {
assert.step(args.method + ' ' + args.model)
assert.step(args.method + ' ' + args.model);
return this._super(route, args);
},
viewOptions: {
@@ -12791,6 +12835,53 @@ QUnit.module('relational_fields', {
form.destroy();
});
QUnit.test('widget many2many_tags in one2many with display_name', function (assert) {
assert.expect(4);
this.data.turtle.records[0].partner_ids = [2];
var form = createView({
View: FormView,
model: 'partner',
data: this.data,
arch: '<form string="Partners">' +
'<sheet>' +
'<field name="turtles">' +
'<tree>' +
'<field name="partner_ids" widget="many2many_tags"/>' + // will use display_name
'</tree>' +
'<form>' +
'<sheet>' +
'<field name="partner_ids"/>' +
'</sheet>' +
'</form>' +
'</field>' +
'</sheet>' +
'</form>',
archs: {
'partner,false,list': '<tree><field name="foo"/></tree>',
},
res_id: 1,
});
assert.strictEqual(form.$('.o_field_one2many[name="turtles"] .o_list_view .o_field_many2manytags[name="partner_ids"]').text().replace(/\s/g, ''),
"secondrecordaaa", "the tags should be correctly rendered");
// open the x2m form view
form.$('.o_field_one2many[name="turtles"] .o_list_view td.o_data_cell:first').click();
assert.strictEqual($('.modal .o_form_view .o_field_many2many[name="partner_ids"] .o_list_view .o_data_cell').text(),
"blipMy little Foo Value", "the list view should be correctly rendered with foo");
$('.modal button.o_form_button_cancel').click();
assert.strictEqual(form.$('.o_field_one2many[name="turtles"] .o_list_view .o_field_many2manytags[name="partner_ids"]').text().replace(/\s/g, ''),
"secondrecordaaa", "the tags should still be correctly rendered");
form.$buttons.find('.o_form_button_edit').click();
assert.strictEqual(form.$('.o_field_one2many[name="turtles"] .o_list_view .o_field_many2manytags[name="partner_ids"]').text().replace(/\s/g, ''),
"secondrecordaaa", "the tags should still be correctly rendered");
form.destroy();
});
QUnit.test('widget many2many_tags: tags title attribute', function (assert) {
assert.expect(1);
this.data.turtle.records[0].partner_ids = [2];
@@ -34,7 +34,7 @@
},
commentEdition : function(){
var positionComment = ($('#comments').position()).top-50;
$(".o_website_chatter_form textarea").val('"' + selected_text + '" ').focus();
$(".o_portal_chatter_composer_form textarea").val('"' + selected_text + '" ').focus();
$('html, body').stop().animate({
'scrollTop': positionComment
}, 500, 'swing', function () {
+2 -2
View File
@@ -337,7 +337,7 @@ class WebsiteSale(ProductConfiguratorController):
}
return request.render("website_sale.product", values)
@http.route(['/shop/change_pricelist/<model("product.pricelist"):pl_id>'], type='http', auth="public", website=True)
@http.route(['/shop/change_pricelist/<model("product.pricelist"):pl_id>'], type='http', auth="public", website=True, sitemap=False)
def pricelist_change(self, pl_id, **post):
if (pl_id.selectable or pl_id == request.env.user.partner_id.property_product_pricelist) \
and request.website.is_pricelist_available(pl_id.id):
@@ -345,7 +345,7 @@ class WebsiteSale(ProductConfiguratorController):
request.website.sale_get_order(force_pricelist=pl_id.id)
return request.redirect(request.httprequest.referrer or '/shop')
@http.route(['/shop/pricelist'], type='http', auth="public", website=True)
@http.route(['/shop/pricelist'], type='http', auth="public", website=True, sitemap=False)
def pricelist(self, promo, **post):
redirect = post.get('r', '/shop/cart')
pricelist = request.env['product.pricelist'].sudo().search([('code', '=', promo)], limit=1)
@@ -80,7 +80,7 @@
right: 0;
bottom: 0;
overflow: hidden;
padding: 0 15px 24px 10px;
padding: 0 15px 0 10px;
min-height: 56px;
border-top: 1px solid rgba(255,255,255,0.2);
background: rgba(255, 255, 255, 0.75);
@@ -88,8 +88,6 @@
}
.product_price {
padding: 5px 0;
position: absolute;
bottom: 0;
}
+1 -1
View File
@@ -1116,7 +1116,7 @@
</form>
<div t-attf-class="card #{selected and 'border_primary' or 'js_change_shipping'}">
<div class='card-body' style='min-height: 130px;'>
<a t-if="not actual_partner or (ship.id in actual_partner.ids + actual_partner.child_ids.ids)" href="#" class="btn btn-link float-right p-0 js_edit_address no-decoration" role="button" title="Edit this address" aria-label="Edit this address"><i class='fa fa-edit'/></a>
<a t-if="not actual_partner or (ship.id in actual_partner.child_ids.ids)" href="#" class="btn btn-link float-right p-0 js_edit_address no-decoration" role="button" title="Edit this address" aria-label="Edit this address"><i class='fa fa-edit'/></a>
<t t-esc="contact" t-options="dict(widget='contact', fields=['name', 'address'], no_marker=True)"/>
</div>
<div class='card-footer' t-if='not readonly'>
+15
View File
@@ -0,0 +1,15 @@
Switzerland, 20.12.2018
Martronic SA 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,
Fabien Moret info@martronic.ch https://github.com/Martronic-SA
List of contributors:
Fabien Moret info@martronic.ch https://github.com/Martronic-SA
@@ -0,0 +1,25 @@
The United States of America, 2018-12-04
Open Source Integrators 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,
Greg Mader gmader@opensourceintegrators.com https://github.com/gmader
List of contributors:
Greg Mader gmader@opensourceintegrators.com https://github.com/gmader
Antonio Yamuta ayamuta@opensourceintegrators.com https://github.com/agyamuta
Balaji Kannan bkannan@opensourceintegrators.com https://github.com/b-kannan
Bhavesh Odedra bodedra@opensourceintegrators.com https://github.com/bodedra
Mayank Gosai mgosai@opensourceintegrators.com https://github.com/mgosai
Maxime Chambreuil mchambreuil@opensourceintegrators.com https://github.com/max3903
Michael Allen mallen@opensourceintegrators.com https://github.com/osimallen
Sandeep Magukiya smangukiya@opensourceintegrators.com https://github.com/smangukiya
Steven Campbell scampbell@opensourceintegrators.com https://github.com/osi-scampbell
Sudarshan Kadalazhi skadalazhi@opensourceintegrators.com https://github.com/sudarshan1607
Wolfgang Hall shall@opensourceintegrators.com https://github.com/wolfhall
+1
View File
@@ -20,3 +20,4 @@ Jairo Llopis jairo.llopis@tecnativa.com https://github.com/yajo
Vicent Cubells vicent.cubells@tecnativa.com https://github.com/cubells
Luis Montalba luis.montalba@tecnativa.com https://github.com/luismontalba
David Vidal david.vidal@tecnativa.com https://github.com/chienandalu
Cristina Martín cristina.martin@tecnativa.com https://github.com/cristinamartinrod
+11
View File
@@ -0,0 +1,11 @@
India, 2018-11-28
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,
Anand Kansagra kansagraanand@hotmail.com https://github.com/anandkansagra
+9
View File
@@ -0,0 +1,9 @@
India, 2018-12-20
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,
Darshan Patel darshan.barcelona@gmail.com https://github.com/darshan-odoo
+11
View File
@@ -0,0 +1,11 @@
China, 2018-11-20
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,
doun doun@163.com https://github.com/doun
+11
View File
@@ -0,0 +1,11 @@
Spain, 2018-09-19
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,
Enric Tobella etobella@creublanca.es https://github.com/etobella
+8 -8
View File
@@ -12,8 +12,8 @@ Graph a method
Odoo embeds a profiler of code. This embeded profiler output can be used to
generate a graph of calls triggered by the method, number of queries, percentage
of time taken in the method itself as well as time taken in method and it's
sub-called methods.
of time taken in the method itself as well as the time that the method took and
its sub-called methods.
.. code:: python
@@ -23,7 +23,7 @@ sub-called methods.
@api.multi
def mymethod(...)
This produce a file called /temp/prof.profile
This produces a file called /temp/prof.profile
A tool called *gprof2dot* will produce a graph with this result:
@@ -37,7 +37,7 @@ A tool called *xdot* will display the resulting graph:
xdot /temp/prof.xdot
The profiler can be also used without saving data in a file.
The profiler can be also used without saving data in a file:
.. code:: python
@@ -78,7 +78,7 @@ completely reviewed.
Dump stack
==========
Sending the SIGQUIT signal to an odoo process (only available on POSIX) makes
Sending the SIGQUIT signal to an Odoo process (only available on POSIX) makes
this process output the current stack trace to log, with info level. When an
odoo process seems stucked, sending this signal to the process permit to know
what the process is doing, and letting the process continue his job.
@@ -86,8 +86,8 @@ what the process is doing, and letting the process continue his job.
Tracing code execution
======================
Instead of sending the SIGQUIT signal to an odoo process often enough, to check
where processes is performing worse than expected, we can use pyflame tool to
Instead of sending the SIGQUIT signal to an Odoo process often enough, to check
where the processes are performing worse than expected, we can use the pyflame tool to
do it for us.
Install pyflame and flamegraph
@@ -118,7 +118,7 @@ Once done, we'll display them as an execution graph.
where <PID> is the process ID of the odoo process you want to graph. This will
wait until the dead of the process, with a maximum of one hour, and and get 5
traces a second. With the output of pyflame, we can produce an svg graph with
traces a second. With the output of pyflame, we can produce an SVG graph with
the flamegraph tool:
.. code:: bash
+1 -1
View File
@@ -201,7 +201,7 @@
<record id="VND" model="res.currency">
<field name="name">VND</field>
<field name="symbol">₫</field>
<field name="rounding">0.01</field>
<field name="rounding">1.00</field>
<field name="active" eval="False"/>
<field name="currency_unit_label">Dong</field>
<field name="currency_subunit_label">Xu</field>
+9 -7
View File
@@ -678,6 +678,7 @@ class Partner(models.Model):
where_query = self._where_calc(args)
self._apply_ir_rules(where_query, 'read')
from_clause, where_clause, where_clause_params = where_query.get_sql()
from_str = from_clause if from_clause else 'res_partner'
where_str = where_clause and (" WHERE %s AND " % where_clause) or ' WHERE '
# search on the name of the contacts and of its company
@@ -689,8 +690,8 @@ class Partner(models.Model):
unaccent = get_unaccent_wrapper(self.env.cr)
query = """SELECT id
FROM res_partner
query = """SELECT res_partner.id
FROM {from_str}
{where} ({email} {operator} {percent}
OR {display_name} {operator} {percent}
OR {reference} {operator} {percent}
@@ -698,13 +699,14 @@ class Partner(models.Model):
-- don't panic, trust postgres bitmap
ORDER BY {display_name} {operator} {percent} desc,
{display_name}
""".format(where=where_str,
""".format(from_str=from_str,
where=where_str,
operator=operator,
email=unaccent('email'),
display_name=unaccent('display_name'),
reference=unaccent('ref'),
email=unaccent('res_partner.email'),
display_name=unaccent('res_partner.display_name'),
reference=unaccent('res_partner.ref'),
percent=unaccent('%s'),
vat=unaccent('vat'),)
vat=unaccent('res_partner.vat'),)
where_clause_params += [search_name]*3 # for email / display_name, reference
where_clause_params += [re.sub('[^a-zA-Z0-9]+', '', search_name)] # for vat
+1
View File
@@ -32,6 +32,7 @@ from . import test_user_has_group
from . import test_view_validation
from . import test_views
from . import test_xmlrpc
from . import test_res_partner
from . import test_res_partner_bank
from . import test_reports
from . import test_tests_tags
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo.tests.common import TransactionCase
class TestPartner(TransactionCase):
def test_name_search(self):
""" Check name_search on partner, especially with domain based on auto_join
user_ids field. Check specific SQL of name_search correctly handle joined tables. """
test_partner = self.env['res.partner'].create({'name': 'Vlad the Impaler'})
test_user = self.env['res.users'].create({'name': 'Vlad the Impaler', 'login': 'vlad', 'email': 'vlad.the.impaler@example.com'})
ns_res = self.env['res.partner'].name_search('Vlad', operator='ilike')
self.assertEqual(set(i[0] for i in ns_res), set((test_partner | test_user.partner_id).ids))
ns_res = self.env['res.partner'].name_search('Vlad', args=[('user_ids.email', 'ilike', 'vlad')])
self.assertEqual(set(i[0] for i in ns_res), set(test_user.partner_id.ids))
+7 -1
View File
@@ -192,6 +192,12 @@ PREFETCH_MAX = 1000
LOG_ACCESS_COLUMNS = ['create_uid', 'create_date', 'write_uid', 'write_date']
MAGIC_COLUMNS = ['id'] + LOG_ACCESS_COLUMNS
# valid SQL aggregation functions
VALID_AGGREGATE_FUNCTIONS = {
'array_agg', 'count', 'count_distinct',
'bool_and', 'bool_or', 'max', 'min', 'avg', 'sum',
}
@pycompat.implements_to_string
class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
@@ -2118,7 +2124,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
field = self._fields[fname]
if not (field.base_field.store and field.base_field.column_type):
raise UserError(_("Cannot aggregate field %r.") % fname)
if not func.isidentifier():
if func not in VALID_AGGREGATE_FUNCTIONS:
raise UserError(_("Invalid aggregation function %r.") % func)
else:
# we have 'name', retrieve the aggregator on the field
+1 -1
View File
@@ -138,7 +138,7 @@ def check(f):
pass
raise ValidationError(msg)
else:
raise ValidationError(inst[0])
raise ValidationError(inst.args[0])
return wrapper