[MERGE] forward port branch 10.0 up to 18456b9

This commit is contained in:
Christophe Simonis
2016-12-09 15:58:39 +01:00
60 changed files with 6478 additions and 2446 deletions
+1 -2
View File
@@ -63,8 +63,7 @@ class AuthSignupHome(Home):
qcontext['error'] = _("Could not reset your password")
_logger.exception('error when resetting password')
except Exception, e:
qcontext['error'] = e.message
qcontext['error'] = e.message or e.name
return request.render('auth_signup.reset_password', qcontext)
@@ -4,6 +4,16 @@ odoo.define('barcodes.BarcodeEvents', function(require) {
var core = require('web.core');
var mixins = core.mixins;
// For IE >= 9, use this, new CustomEvent(), instead of new Event()
function CustomEvent ( event, params ) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt = document.createEvent( 'CustomEvent' );
evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );
return evt;
}
CustomEvent.prototype = window.Event.prototype;
var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, {
timeout: null,
key_pressed: {},
@@ -63,10 +73,16 @@ var BarcodeEvents = core.Class.extend(mixins.PropertiesMixin, {
// bug for the longest time that causes keyCode and
// charCode to not be set for events created this way:
// https://bugs.webkit.org/show_bug.cgi?id=16735
new_event = new Event("keypress", {
var params = {
'bubbles': old_event.bubbles,
'cancelable': old_event.cancelable,
});
};
try {
new_event = new Event("keypress", params);
} catch(error) {
// For IE >= 9, use new CustomEvent(), instead of new Event()
new_event = new CustomEvent("keypress", params);
}
new_event.viewArg = old_event.viewArg;
new_event.ctrl = old_event.ctrl;
@@ -15,6 +15,7 @@ def geo_find(addr):
result = json.load(urllib.urlopen(url))
except Exception as e:
raise UserError(_('Cannot contact geolocation servers. Please make sure that your Internet connection is up and running (%s).') % e)
if result['status'] != 'OK':
return None
@@ -52,6 +53,13 @@ class ResPartner(models.Model):
city=partner.city,
state=partner.state_id.name,
country=partner.country_id.name))
if result is None:
result = geo_find(geo_query_address(
city=partner.city,
state=partner.state_id.name,
country=partner.country_id.name
))
if result:
partner.write({
'partner_latitude': result[0],
+1 -1
View File
@@ -669,7 +669,7 @@ Andrew</p>]]></field>
<field name="country_id" ref="base.uk"/>
<field name="city">Birmingham</field>
<field name="zip">B46 3AG</field>
<field name="street">81 Academy Avenue</field>
<field name="street">Cannon Hill Park</field>
<field name="tag_ids" eval="[(6, 0, [categ_oppor7])]"/>
<field name="priority">2</field>
<field name="next_activity_id" ref="crm_activity_data_meeting"/>
+1 -1
View File
@@ -313,7 +313,7 @@ class Lead(FormatAddress, models.Model):
vals.update(self._onchange_stage_id_values(vals.get('stage_id')))
if vals.get('probability') >= 100 or not vals.get('active', True):
vals['date_closed'] = fields.Datetime.now()
elif vals.get('probability') < 100:
elif 'probability' in vals and vals['probability'] < 100:
vals['date_closed'] = False
return super(Lead, self).write(vals)
+1 -1
View File
@@ -504,7 +504,7 @@ class Holidays(models.Model):
leaves += self.with_context(mail_notify_force_send=False).create(values)
# TODO is it necessary to interleave the calls?
leaves.action_approve()
if leaves[0].double_validation:
if leaves and leaves[0].double_validation:
leaves.action_validate()
return True
+1 -1
View File
@@ -185,7 +185,7 @@ class HrPayslip(models.Model):
\n* If the payslip is confirmed then status is set to \'Done\'.
\n* When user cancel payslip the status is \'Rejected\'.""")
line_ids = fields.One2many('hr.payslip.line', 'slip_id', string='Payslip Lines', readonly=True,
states={'draft': [('readonly', False)]}, domain=[('appears_on_payslip', '=', True)])
states={'draft': [('readonly', False)]})
company_id = fields.Many2one('res.company', string='Company', readonly=True, copy=False,
default=lambda self: self.env['res.company']._company_default_get(),
states={'draft': [('readonly', False)]})
@@ -94,7 +94,7 @@ class PayslipDetailsReport(models.AbstractModel):
'doc_model': 'hr.payslip',
'docs': payslips,
'data': data,
'get_details_by_rule_category': self.get_details_by_rule_category(payslips.mapped('details_by_salary_rule_category')),
'get_lines_by_contribution_register': self.get_lines_by_contribution_register(payslips.mapped('line_ids')),
'get_details_by_rule_category': self.get_details_by_rule_category(payslips.mapped('details_by_salary_rule_category').filtered(lambda r: r.appears_on_payslip)),
'get_lines_by_contribution_register': self.get_lines_by_contribution_register(payslips.mapped('line_ids').filtered(lambda r: r.appears_on_payslip)),
}
return self.env['report'].render('hr_payroll.report_payslipdetails', docargs)
+2 -1
View File
@@ -5,7 +5,7 @@
{
'name': 'France - Accounting',
'version': '1.1',
'version': '1.2',
'category': 'Localization',
'description': """
This is the module to manage the accounting chart for France in Odoo.
@@ -36,6 +36,7 @@ configuration of their taxes and fiscal positions manually.
'views/l10n_fr_view.xml',
'data/account_tax_data.xml',
'data/account_fiscal_position_template_data.xml',
'data/account_reconcile_model_template.xml',
'data/account_chart_template_data.yml',
],
}
@@ -1034,6 +1034,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_22" model="account.account.template">
<field name="name">Immobilisations mises en concession</field>
<field name="code">22</field>
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_2312" model="account.account.template">
<field name="name">Terrains</field>
<field name="code">2312</field>
@@ -1105,6 +1112,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_25" model="account.account.template">
<field name="name">Parts dans des entreprises liées et créances sur des entreprises liées</field>
<field name="code">25</field>
<field name="user_type_id" ref="account.data_account_type_current_assets"/>
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_2611" model="account.account.template">
<field name="name">Actions</field>
<field name="code">2611</field>
@@ -1736,6 +1750,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_36" model="account.account.template">
<field name="name">Stocks provenant d'immobilisations</field>
<field name="code">36</field>
<field name="user_type_id" ref="account.data_account_type_current_assets" />
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_371" model="account.account.template">
<field name="name">Marchandises (ou groupe) A</field>
<field name="code">371</field>
@@ -1750,6 +1771,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_38" model="account.account.template">
<field name="name">Stocks en voie d'acheminement</field>
<field name="code">38</field>
<field name="user_type_id" ref="account.data_account_type_current_assets" />
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_3911" model="account.account.template">
<field name="name">Matières (ou groupe) A</field>
<field name="code">3911</field>
@@ -3013,6 +3041,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_52" model="account.account.template">
<field name="name">Instruments de trésorerie</field>
<field name="code">52</field>
<field name="user_type_id" ref="account.data_account_type_liquidity"/>
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_5311" model="account.account.template">
<field name="name">Caisse en monnaie nationale</field>
<field name="code">5311</field>
@@ -3041,6 +3076,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_54" model="account.account.template">
<field name="name">Régies d'avances et accréditifs</field>
<field name="code">54</field>
<field name="user_type_id" ref="account.data_account_type_liquidity"/>
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_5903" model="account.account.template">
<field name="name">Actions</field>
<field name="code">5903</field>
@@ -4692,6 +4734,13 @@
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_74" model="account.account.template">
<field name="name">Subventions d'exploitation</field>
<field name="code">74</field>
<field name="user_type_id" ref="account.data_account_type_revenue"/>
<field name="chart_template_id" ref="l10n_fr_pcg_chart_template"/>
</record>
<record id="pcg_7511" model="account.account.template">
<field name="name">Redevances pour concessions, brevets, licences, marques, procédés, logiciels </field>
<field name="code">7511</field>
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
@author: Alexis de Lattre <alexis.delattre@akretion.com>
-->
<odoo>
<record id="bank_charges_reconcile_model" model="account.reconcile.model.template">
<field name="name">Frais bancaires</field>
<field name="account_id" ref="pcg_6278"/>
<field name="amount_type">percentage</field>
<field name="amount">100</field>
</record>
</odoo>
@@ -177,10 +177,6 @@
"chart_hu_877",877,"Egyéb árfolyamveszteségek, opciós díjak","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_878",878,"Vásárolt köv. kapcs. ráfordítások","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_879",879,"Egyéb pénzügyi ráfordítások","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_881",881,"Társaságban bevitt eszk. nytsz. értéke","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_887",887,"Saját üzletrész nyilvántartási értéke","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_888",888,"Tartozásátv. szerz. szerinti összege","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_889",889,"Egyéb vagyoncsökk. rendkívüli ráfordítás","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_891",891,"Társasági adó","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_892",892,"Társas vállalkozás különadója","account.data_account_type_expenses","FALSE",hungarian_chart_template
"chart_hu_895",895,"Egyszerüsített vállalkozói adó","account.data_account_type_expenses","FALSE",hungarian_chart_template
@@ -206,4 +202,3 @@
"chart_hu_977",977,"Egyéb árfolyamnyereségek, opciós bev.","account.data_account_type_other_income","FALSE",hungarian_chart_template
"chart_hu_978",978,"Vás. követelésekkel kapcs. bevételek","account.data_account_type_revenue","FALSE",hungarian_chart_template
"chart_hu_979",979,"Egyéb pénzügyi mûveletek bevételei","account.data_account_type_revenue","FALSE",hungarian_chart_template
"chart_hu_981",981,"Rendkívüli bevételek","account.data_account_type_revenue","FALSE",hungarian_chart_template
Can't render this file because it contains an unexpected character in line 155 and column 92.
+2
View File
@@ -1,2 +1,4 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
+6 -1
View File
@@ -30,8 +30,13 @@ With this module you will have:
.. SAT: http://www.sat.gob.mx/
""",
"depends": ["account", "base_vat"],
"depends": [
"account",
"base_vat",
"account_tax_cash_basis",
],
"data": [
"data/account_tag_data.xml",
"data/l10n_mx_chart_data.xml",
"data/account_tax_data.xml",
"data/account_chart_template_data.yml",
@@ -1,3 +1,3 @@
-
!python {model: account.chart.template, id: vauxoo_mx_chart_template}: |
self[0].try_loading_for_current_company()
!python {model: account.chart.template, id: mx_coa}: |
self[0].try_loading_for_current_company()
File diff suppressed because it is too large Load Diff
+80 -112
View File
@@ -6,10 +6,6 @@
<field name="name">IVA(0%) VENTAS</field>
<field name="applicability">taxes</field>
</record>
<record id="tax_tag_02" model="account.account.tag">
<field name="name">IVA(11%) VENTAS</field>
<field name="applicability">taxes</field>
</record>
<record id="tax_tag_03" model="account.account.tag">
<field name="name">IVA(16%) VENTAS</field>
<field name="applicability">taxes</field>
@@ -42,157 +38,129 @@
<field name="name">IVA(0%) COMPRAS</field>
<field name="applicability">taxes</field>
</record>
<record id="tax_tag_11" model="account.account.tag">
<field name="name">IVA(11%) COMPRAS</field>
<field name="applicability">taxes</field>
</record>
<record id="tax_tag_12" model="account.account.tag">
<field name="name">IVA(16%) COMPRAS</field>
<field name="applicability">taxes</field>
</record>
<record id="tax9" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax9" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">IVA(0%) VENTAS</field>
<field name="description">ITAX_010-IN</field>
<field name="amount">0</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_id" ref="cuenta2202113000"/>
<field name="refund_account_id" ref="cuenta2202113000"/>
<field name="amount">0</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_id" ref="cuenta209_01"/>
<field name="refund_account_id" ref="cuenta209_01"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_01')])]"/>
</record>
</record>
<record id="tax11" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<field name="name">IVA(11%) VENTAS</field>
<field name="description">ITAX_110-IN</field>
<field name="amount">11</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_id" ref="cuenta2202113000"/>
<field name="refund_account_id" ref="cuenta2202113000"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_02')])]"/>
</record>
<record id="tax12" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax12" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">IVA(16%) VENTAS</field>
<field name="description">ITAX_160-IN</field>
<field name="amount">16</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_id" ref="cuenta2202113000"/>
<field name="refund_account_id" ref="cuenta2202113000"/>
<field name="amount">16</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">sale</field>
<field name="account_id" ref="cuenta209_01"/>
<field name="refund_account_id" ref="cuenta209_01"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_03')])]"/>
</record>
</record>
<record id="tax1" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax1" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">RET IVA FLETES 4%</field>
<field name="description">ITAXR_04-OUT</field>
<field name="amount">-4</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta2201112000"/>
<field name="refund_account_id" ref="cuenta2201112000"/>
<field name="amount">-4</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta216_10"/>
<field name="refund_account_id" ref="cuenta216_10"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_04')])]"/>
</record>
</record>
<record id="tax2" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax2" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">RET IVA ARRENDAMIENTO 10%</field>
<field name="description">ITAXR_10-OUT</field>
<field name="amount">-10</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta2201117000"/>
<field name="refund_account_id" ref="cuenta2201117000"/>
<field name="amount">-10</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta216_10"/>
<field name="refund_account_id" ref="cuenta216_10"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_05')])]"/>
</record>
</record>
<record id="tax3" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax3" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">RET ISR ARRENDAMIENTO 10%</field>
<field name="description">ITAXA_10-OUT</field>
<field name="amount">-10</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta2201116000"/>
<field name="refund_account_id" ref="cuenta2201116000"/>
<field name="amount">-10</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta216_03"/>
<field name="refund_account_id" ref="cuenta216_03"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_06')])]"/>
</record>
</record>
<record id="tax5" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax5" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">RET ISR HONORARIOS 10%</field>
<field name="description">ITAXH_10-OUT</field>
<field name="amount">-10</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta2201115000"/>
<field name="refund_account_id" ref="cuenta2201115000"/>
<field name="amount">-10</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta216_04"/>
<field name="refund_account_id" ref="cuenta216_04"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_07')])]"/>
</record>
</record>
<record id="tax7" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax7" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">RETENCION IVA ARRENDAMIENTO 10.67%</field>
<field name="description">ITAX_1067-OUT</field>
<field name="amount">-10.67</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta2201116000"/>
<field name="refund_account_id" ref="cuenta2201116000"/>
<field name="amount">-10.67</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta216_10"/>
<field name="refund_account_id" ref="cuenta216_10"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_08')])]"/>
</record>
</record>
<record id="tax8" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax8" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">RETENCION IVA HONORARIOS 10.67%</field>
<field name="description">ITAX_167-OUT</field>
<field name="amount">-10.67</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta2201118000"/>
<field name="refund_account_id" ref="cuenta2201118000"/>
<field name="amount">-10.67</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta216_10"/>
<field name="refund_account_id" ref="cuenta216_10"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_09')])]"/>
</record>
</record>
<record id="tax13" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax13" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">IVA(0%) COMPRAS</field>
<field name="description">ITAX_010-OUT</field>
<field name="amount">0</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta1151004000"/>
<field name="refund_account_id" ref="cuenta1151004000"/>
<field name="amount">0</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta119_01"/>
<field name="refund_account_id" ref="cuenta119_01"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_10')])]"/>
</record>
</record>
<record id="tax10" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<field name="name">IVA(11%) COMPRAS</field>
<field name="description">ITAX_110-OUT</field>
<field name="amount">11</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta1151004000"/>
<field name="refund_account_id" ref="cuenta1151004000"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_11')])]"/>
</record>
<record id="tax14" model="account.tax.template">
<field name="chart_template_id" ref="vauxoo_mx_chart_template"/>
<record id="tax14" model="account.tax.template">
<field name="chart_template_id" ref="mx_coa"/>
<field name="name">IVA(16%) COMPRAS</field>
<field name="description">ITAX_160-OUT</field>
<field name="amount">16</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta1151004000"/>
<field name="refund_account_id" ref="cuenta1151004000"/>
<field name="amount">16</field>
<field name="amount_type">percent</field>
<field name="type_tax_use">purchase</field>
<field name="account_id" ref="cuenta119_01"/>
<field name="refund_account_id" ref="cuenta119_01"/>
<field name="tag_ids" eval="[(6,0,[ref('tax_tag_12')])]"/>
</record>
</record>
</data>
</odoo>
File diff suppressed because it is too large Load Diff
+6
View File
@@ -0,0 +1,6 @@
# coding: utf-8
# Copyright 2016 Vauxoo (https://www.vauxoo.com) <info@vauxoo.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import chart_template
from . import account
+59
View File
@@ -0,0 +1,59 @@
# coding: utf-8
# Copyright 2016 Vauxoo (https://www.vauxoo.com) <info@vauxoo.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
import re
from odoo import models, api, fields, _
class AccountJournal(models.Model):
_inherit = 'account.journal'
@api.model
def _prepare_liquidity_account(self, name, company, currency_id, type):
'''
When preparing the values to use when creating the default debit and credit accounts of a
liquidity journal, set the correct tags for the mexican localization.
'''
res = super(AccountJournal, self)._prepare_liquidity_account(name, company, currency_id, type)
if company.country_id.id == self.env.ref('base.mx').id:
mx_tags = self.env['account.account'].mx_search_tags(res.get('code', ''))
if mx_tags:
res.update({
'tag_ids': [(6, 0, [tag.id for tag in mx_tags])]
})
return res
class AccountAccount(models.Model):
_inherit = 'account.account'
@api.model
def mx_search_tags(self, code):
account_tag = self.env['account.account.tag']
#search if the code is compliant with the regexp we have for tags auto-assignation
re_res = re.search(
'^(?P<first>[1-8][0-9][0-9])[,.]'
'(?P<second>[0-9][0-9])[,.]'
'(?P<third>[0-9]{2,3})$', code)
if not re_res:
return account_tag
#get the elements of that code divided with separation declared in the regexp
account = re_res.groups()
return account_tag.search([
('name', '=like', "%s.%s%%" % (account[0], account[1])),
('color', '=', 4)], limit=1)
@api.onchange('code')
def _onchange_code(self):
if self.company_id.country_id.id == self.env.ref('base.mx').id and self.code:
tags = self.mx_search_tags(self.code)
self.tag_ids = tags
class AccountAccountTag(models.Model):
_inherit = 'account.account.tag'
nature = fields.Selection([
('D', _('Debitable Account')), ('A', _('Creditable Account'))],
help='Used in Mexican report of electronic accounting (account nature).')
+81
View File
@@ -0,0 +1,81 @@
# coding: utf-8
# Copyright 2016 Vauxoo (https://www.vauxoo.com) <info@vauxoo.com>
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from odoo import models, api, _
class AccountChartTemplate(models.Model):
_inherit = "account.chart.template"
@api.multi
def _load_template(
self, company, code_digits=None, transfer_account_id=None,
account_ref=None, taxes_ref=None):
"""
Set the 'use_cash_basis' and 'cash_basis_account' fields on account.account. This hack is needed due to the fact
that the tax template does not have the fields 'use_cash_basis' and 'cash_basis_account'.
This hunk should be removed in master, as the account_tax_cash_basis module has been merged already in account
module
"""
self.ensure_one()
accounts, taxes = super(AccountChartTemplate, self)._load_template(
company, code_digits=code_digits,
transfer_account_id=transfer_account_id, account_ref=account_ref,
taxes_ref=taxes_ref)
if not self == self.env.ref('l10n_mx.mx_coa'):
return accounts, taxes
account_tax_obj = self.env['account.tax']
account_obj = self.env['account.account']
taxes_acc = {
'ITAX_010-IN': account_obj.search([('code', '=', '208.01.01')]),
'ITAX_160-IN': account_obj.search([('code', '=', '208.01.01')]),
'ITAXR_04-OUT': account_obj.search([('code', '=', '216.13.01')]),
'ITAXR_10-OUT': account_obj.search([('code', '=', '216.13.01')]),
'ITAX_1067-OUT': account_obj.search([('code', '=', '216.13.01')]),
'ITAX_167-OUT': account_obj.search([('code', '=', '216.13.01')]),
'ITAX_010-OUT': account_obj.search([('code', '=', '208.01.01')]),
'ITAX_160-OUT': account_obj.search([('code', '=', '208.01.01')])}
for tax in self.tax_template_ids:
if tax.description not in taxes_acc:
continue
account_tax_obj.browse(taxes.get(tax.id)).write({
'use_cash_basis': True,
'cash_basis_account': taxes_acc.get(tax.description).id,
})
return accounts, taxes
@api.model
def generate_journals(self, acc_template_ref, company, journals_dict=None):
"""Set the tax_cash_basis_journal_id on the company"""
res = super(AccountChartTemplate, self).generate_journals(
acc_template_ref, company, journals_dict=journals_dict)
if not self == self.env.ref('l10n_mx.mx_coa'):
return res
journal_basis = self.env['account.journal'].search([
('type', '=', 'general'),
('code', '=', 'CBMX')], limit=1)
company.write({'tax_cash_basis_journal_id': journal_basis.id})
return res
@api.multi
def _prepare_all_journals(self, acc_template_ref, company, journals_dict=None):
"""Create the tax_cash_basis_journal_id"""
res = super(AccountChartTemplate, self)._prepare_all_journals(
acc_template_ref, company, journals_dict=journals_dict)
if not self == self.env.ref('l10n_mx.mx_coa'):
return res
res.append({
'type': 'general',
'name': _('Effectively Paid'),
'code': 'CBMX',
'company_id': company.id,
'default_credit_account_id': acc_template_ref.get(
self.income_currency_exchange_account_id.id),
'default_debit_account_id': acc_template_ref.get(
self.expense_currency_exchange_account_id.id),
'show_on_dashboard': True,
})
return res
+1
View File
@@ -5,6 +5,7 @@
{
"name": "Slovenian - Accounting",
"versiom": "1.1",
"author": "Mentis d.o.o.",
"website": "http://www.mentis.si",
'category': 'Localization',
+12 -12
View File
@@ -1,15 +1,15 @@
"id","name","applicability"
"DDV_I_0","Izstopni DDV 0%","taxes"
"DDV_I_8_5","Izstopni DDV 8.5%","taxes"
"DDV_I_20","Izstopni DDV 20%","taxes"
"DDV_I_9_5","Izstopni DDV 9.5%","taxes"
"DDV_I_22","Izstopni DDV 22%","taxes"
"DDV_V_0","Vstopni DDV 0%","taxes"
"DDV_V_8_5","Vstopni DDV 8.5%","taxes"
"DDV_V_20","Vstopni DDV 20%","taxes"
"DDV_V_8_5_NE","Vstopni DDV 8.5% - neodbitni","taxes"
"DDV_V_20_NE","Vstopni DDV 20% - neodbitni","taxes"
"DDV_V_8_5_SO","Vstopni DDV 8.5% - SO","taxes"
"DDV_I_8_5_SO","Izstopni DDV 8.5% - SO","taxes"
"DDV_V_8_5_sam","Vstopni DDV 8.5% - samoobdavčitev","taxes"
"DDV_V_20_SO","Vstopni DDV 20% - SO","taxes"
"DDV_I_20_SO","Izstopni DDV 20% - SO","taxes"
"DDV_V_20_sam","Vstopni DDV 20% - samoobdavčitev","taxes"
"DDV_V_9_5","Vstopni DDV 9.5%","taxes"
"DDV_V_22","Vstopni DDV 22%","taxes"
"DDV_V_9_5_NE","Vstopni DDV 9.5% - neodbitni","taxes"
"DDV_V_22_NE","Vstopni DDV 22% - neodbitni","taxes"
"DDV_V_9_5_SO","Vstopni DDV 9.5% - SO","taxes"
"DDV_I_9_5_SO","Izstopni DDV 9.5% - SO","taxes"
"DDV_V_9_5_sam","Vstopni DDV 9.5% - samoobdavčitev","taxes"
"DDV_V_22_SO","Vstopni DDV 22% - SO","taxes"
"DDV_I_22_SO","Izstopni DDV 22% - SO","taxes"
"DDV_V_22_sam","Vstopni DDV 22% - samoobdavčitev","taxes"
1 id name applicability
2 DDV_I_0 Izstopni DDV 0% taxes
3 DDV_I_8_5 DDV_I_9_5 Izstopni DDV 8.5% Izstopni DDV 9.5% taxes
4 DDV_I_20 DDV_I_22 Izstopni DDV 20% Izstopni DDV 22% taxes
5 DDV_V_0 Vstopni DDV 0% taxes
6 DDV_V_8_5 DDV_V_9_5 Vstopni DDV 8.5% Vstopni DDV 9.5% taxes
7 DDV_V_20 DDV_V_22 Vstopni DDV 20% Vstopni DDV 22% taxes
8 DDV_V_8_5_NE DDV_V_9_5_NE Vstopni DDV 8.5% - neodbitni Vstopni DDV 9.5% - neodbitni taxes
9 DDV_V_20_NE DDV_V_22_NE Vstopni DDV 20% - neodbitni Vstopni DDV 22% - neodbitni taxes
10 DDV_V_8_5_SO DDV_V_9_5_SO Vstopni DDV 8.5% - SO Vstopni DDV 9.5% - SO taxes
11 DDV_I_8_5_SO DDV_I_9_5_SO Izstopni DDV 8.5% - SO Izstopni DDV 9.5% - SO taxes
12 DDV_V_8_5_sam DDV_V_9_5_sam Vstopni DDV 8.5% - samoobdavčitev Vstopni DDV 9.5% - samoobdavčitev taxes
13 DDV_V_20_SO DDV_V_22_SO Vstopni DDV 20% - SO Vstopni DDV 22% - SO taxes
14 DDV_I_20_SO DDV_I_22_SO Izstopni DDV 20% - SO Izstopni DDV 22% - SO taxes
15 DDV_V_20_sam DDV_V_22_sam Vstopni DDV 20% - samoobdavčitev Vstopni DDV 22% - samoobdavčitev taxes
@@ -96,14 +96,14 @@ code,id,user_type_id/id,name,reconcile,chart_template_id/id
155000,gd_acc_155000,account.data_account_type_current_assets,"DRUGE KRATKOROČNE TERJATVE, POVEZANE S FINANČNIMI PRIHODKI",False,gd_chart
159000,gd_acc_159000,account.data_account_type_current_assets,"OSLABITEV VREDNOSTI KRATKOROČNIH TERJATEV, POVEZANIH S FINANČNIMI PRIHODKI",False,gd_chart
160001,gd_acc_160001,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA NEODBITNI DDV",False,gd_chart
160002,gd_acc_160002,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5%",False,gd_chart
160003,gd_acc_160003,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 20%",False,gd_chart
160004,gd_acc_160004,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% V EU",False,gd_chart
160005,gd_acc_160005,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% V EU",False,gd_chart
160006,gd_acc_160006,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% IZVEN EU",False,gd_chart
160007,gd_acc_160007,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% IZVEN EU",False,gd_chart
160008,gd_acc_160008,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% UVOZ",False,gd_chart
160009,gd_acc_160009,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% UVOZ",False,gd_chart
160002,gd_acc_160002,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5%",False,gd_chart
160003,gd_acc_160003,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 22%",False,gd_chart
160004,gd_acc_160004,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% V EU",False,gd_chart
160005,gd_acc_160005,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% V EU",False,gd_chart
160006,gd_acc_160006,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% IZVEN EU",False,gd_chart
160007,gd_acc_160007,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% IZVEN EU",False,gd_chart
160008,gd_acc_160008,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% UVOZ",False,gd_chart
160009,gd_acc_160009,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% UVOZ",False,gd_chart
161000,gd_acc_161000,account.data_account_type_current_assets,"KRATKOROČNE TERJATVE ZA DAVEK OD DOHODKOV PRAVNIH OSEB, VKLJUČNO Z DAVKOM, PLAČANIM V TUJINI",False,gd_chart
162000,gd_acc_162000,account.data_account_type_current_assets,"DRUGE KRATKOROČNE TERJATVE DO DRŽAVNIH IN DRUGIH INŠTITUCIJ",False,gd_chart
165000,gd_acc_165000,account.data_account_type_current_assets,"OSTALE KRATKOROČNE TERJATVE",False,gd_chart
@@ -152,12 +152,12 @@ code,id,user_type_id/id,name,reconcile,chart_template_id/id
255000,gd_acc_255000,account.data_account_type_current_liabilities,"KRATKOROČNE OBVEZNOSTI ZA DRUGE PREJEMKE IZ DELOVNEGA RAZMERJA",False,gd_chart
256000,gd_acc_256000,account.data_account_type_current_liabilities,"KRATKOROČNE OBVEZNOSTI ZA PRISPEVKE IZ DRUGIH PREJEMKOV IZ DELOVNEGA RAZMERJA, KI SE NE OBRAČUNAVAJO SKUPAJ S PLAČAMI",False,gd_chart
257000,gd_acc_257000,account.data_account_type_current_liabilities,"KRATKOROČNE OBVEZNOSTI ZA DAVEK IZ DRUGIH PREJEMKOV IZ DELOVNEGA RAZMERJA, KI SE NE OBRAČUNAVAJO SKUPAJ S PLAČAMI",False,gd_chart
260001,gd_acc_260001,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 8,5%",False,gd_chart
260002,gd_acc_260002,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 20%",False,gd_chart
260003,gd_acc_260003,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 8,5% V EU",False,gd_chart
260004,gd_acc_260004,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 20% V EU",False,gd_chart
260005,gd_acc_260005,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 8,5% IZVEN EU",False,gd_chart
260006,gd_acc_260006,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 20% IZVEN EU",False,gd_chart
260001,gd_acc_260001,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 9,5%",False,gd_chart
260002,gd_acc_260002,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 22%",False,gd_chart
260003,gd_acc_260003,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 9,5% V EU",False,gd_chart
260004,gd_acc_260004,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 22% V EU",False,gd_chart
260005,gd_acc_260005,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 9,5% IZVEN EU",False,gd_chart
260006,gd_acc_260006,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA ZARAČUNANI DDV 22% IZVEN EU",False,gd_chart
261000,gd_acc_261000,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA DDV, CARINO IN DRUGE DAJATVE OD UVOŽENEGA BLAGA",False,gd_chart
262000,gd_acc_262000,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA PRISPEVKE IZPLAČEVALCA",False,gd_chart
263000,gd_acc_263000,account.data_account_type_current_liabilities,"OBVEZNOSTI ZA DAVEK OD IZPLAČANIH PLAČ",False,gd_chart
1 code id user_type_id/id name reconcile chart_template_id/id
96 155000 gd_acc_155000 account.data_account_type_current_assets DRUGE KRATKOROČNE TERJATVE, POVEZANE S FINANČNIMI PRIHODKI False gd_chart
97 159000 gd_acc_159000 account.data_account_type_current_assets OSLABITEV VREDNOSTI KRATKOROČNIH TERJATEV, POVEZANIH S FINANČNIMI PRIHODKI False gd_chart
98 160001 gd_acc_160001 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA NEODBITNI DDV False gd_chart
99 160002 gd_acc_160002 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% False gd_chart
100 160003 gd_acc_160003 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% False gd_chart
101 160004 gd_acc_160004 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% V EU KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% V EU False gd_chart
102 160005 gd_acc_160005 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% V EU KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% V EU False gd_chart
103 160006 gd_acc_160006 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% IZVEN EU KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% IZVEN EU False gd_chart
104 160007 gd_acc_160007 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% IZVEN EU KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% IZVEN EU False gd_chart
105 160008 gd_acc_160008 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 8,5% UVOZ KRATKOROČNE TERJATVE ZA ODBITNI DDV 9,5% UVOZ False gd_chart
106 160009 gd_acc_160009 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA ODBITNI DDV 20% UVOZ KRATKOROČNE TERJATVE ZA ODBITNI DDV 22% UVOZ False gd_chart
107 161000 gd_acc_161000 account.data_account_type_current_assets KRATKOROČNE TERJATVE ZA DAVEK OD DOHODKOV PRAVNIH OSEB, VKLJUČNO Z DAVKOM, PLAČANIM V TUJINI False gd_chart
108 162000 gd_acc_162000 account.data_account_type_current_assets DRUGE KRATKOROČNE TERJATVE DO DRŽAVNIH IN DRUGIH INŠTITUCIJ False gd_chart
109 165000 gd_acc_165000 account.data_account_type_current_assets OSTALE KRATKOROČNE TERJATVE False gd_chart
152 255000 gd_acc_255000 account.data_account_type_current_liabilities KRATKOROČNE OBVEZNOSTI ZA DRUGE PREJEMKE IZ DELOVNEGA RAZMERJA False gd_chart
153 256000 gd_acc_256000 account.data_account_type_current_liabilities KRATKOROČNE OBVEZNOSTI ZA PRISPEVKE IZ DRUGIH PREJEMKOV IZ DELOVNEGA RAZMERJA, KI SE NE OBRAČUNAVAJO SKUPAJ S PLAČAMI False gd_chart
154 257000 gd_acc_257000 account.data_account_type_current_liabilities KRATKOROČNE OBVEZNOSTI ZA DAVEK IZ DRUGIH PREJEMKOV IZ DELOVNEGA RAZMERJA, KI SE NE OBRAČUNAVAJO SKUPAJ S PLAČAMI False gd_chart
155 260001 gd_acc_260001 account.data_account_type_current_liabilities OBVEZNOSTI ZA ZARAČUNANI DDV 8,5% OBVEZNOSTI ZA ZARAČUNANI DDV 9,5% False gd_chart
156 260002 gd_acc_260002 account.data_account_type_current_liabilities OBVEZNOSTI ZA ZARAČUNANI DDV 20% OBVEZNOSTI ZA ZARAČUNANI DDV 22% False gd_chart
157 260003 gd_acc_260003 account.data_account_type_current_liabilities OBVEZNOSTI ZA ZARAČUNANI DDV 8,5% V EU OBVEZNOSTI ZA ZARAČUNANI DDV 9,5% V EU False gd_chart
158 260004 gd_acc_260004 account.data_account_type_current_liabilities OBVEZNOSTI ZA ZARAČUNANI DDV 20% V EU OBVEZNOSTI ZA ZARAČUNANI DDV 22% V EU False gd_chart
159 260005 gd_acc_260005 account.data_account_type_current_liabilities OBVEZNOSTI ZA ZARAČUNANI DDV 8,5% IZVEN EU OBVEZNOSTI ZA ZARAČUNANI DDV 9,5% IZVEN EU False gd_chart
160 260006 gd_acc_260006 account.data_account_type_current_liabilities OBVEZNOSTI ZA ZARAČUNANI DDV 20% IZVEN EU OBVEZNOSTI ZA ZARAČUNANI DDV 22% IZVEN EU False gd_chart
161 261000 gd_acc_261000 account.data_account_type_current_liabilities OBVEZNOSTI ZA DDV, CARINO IN DRUGE DAJATVE OD UVOŽENEGA BLAGA False gd_chart
162 262000 gd_acc_262000 account.data_account_type_current_liabilities OBVEZNOSTI ZA PRISPEVKE IZPLAČEVALCA False gd_chart
163 263000 gd_acc_263000 account.data_account_type_current_liabilities OBVEZNOSTI ZA DAVEK OD IZPLAČANIH PLAČ False gd_chart
+12 -12
View File
@@ -1,15 +1,15 @@
"id","chart_template_id/id","name","description","amount_type","amount","type_tax_use","price_include","refund_account_id/id","account_id/id","include_base_amount","sequence","children_tax_ids/id","tag_ids/id"
"gd_taxr_1","gd_chart","Izstopni DDV 0%","DDV-I-0","percent","0","sale","True",,,,,,"DDV_I_0"
"gd_taxr_2","gd_chart","Izstopni DDV 8.5%","DDV-I-8.5","percent","8.5","sale","True","gd_acc_260001","gd_acc_260001","False",,,"DDV_I_8_5"
"gd_taxr_3","gd_chart","Izstopni DDV 20%","DDV-I-20","percent","20","sale","True","gd_acc_260002","gd_acc_260002","False",,,"DDV_I_20"
"gd_taxr_2","gd_chart","Izstopni DDV 9.5%","DDV-I-9.5","percent","9.5","sale","True","gd_acc_260001","gd_acc_260001","False",,,"DDV_I_9_5"
"gd_taxr_3","gd_chart","Izstopni DDV 22%","DDV-I-22","percent","22","sale","True","gd_acc_260002","gd_acc_260002","False",,,"DDV_I_22"
"gd_taxp_1","gd_chart","Vstopni DDV 0%","DDV-V-0","percent","0","purchase","True",,,,,,"DDV_V_0"
"gd_taxp_2","gd_chart","Vstopni DDV 8.5%","DDV-V-8.5","percent","8.5","purchase","True","gd_acc_160002","gd_acc_160002","False",,,"DDV_V_8_5"
"gd_taxp_3","gd_chart","Vstopni DDV 20%","DDV-V-20","percent","20","purchase","True","gd_acc_160003","gd_acc_160003","False",,,"DDV_V_20"
"gd_taxp_nr_1","gd_chart","Vstopni DDV 8.5% - neodbitni","DDV-V-8.5-NE","percent","8.5","purchase","True","gd_acc_160001","gd_acc_160001","False",,,"DDV_V_8_5_NE"
"gd_taxp_nr_2","gd_chart","Vstopni DDV 20% - neodbitni","DDV-V-20-NE","percent","20","purchase","True","gd_acc_160001","gd_acc_160001","False",,,"DDV_V_20_NE"
"gd_taxp_st_1_1","gd_chart","Vstopni DDV 8.5% - SO","SO-DDV-V-8.5","percent","8.5","none","False","gd_acc_160002","gd_acc_160002","False",,,"DDV_V_8_5_SO"
"gd_taxp_st_1_2","gd_chart","Izstopni DDV 8.5% - SO","SO-DDV-I-8.5","percent","-8.5","none","False","gd_acc_260001","gd_acc_260001","False",,,"DDV_I_8_5_SO"
"gd_taxp_st_1","gd_chart","Vstopni DDV 8.5% - samoobdavčitev","DDV-V-8.5-SO","group","0","purchase","False",,,"False",,"gd_taxp_st_1_1,gd_taxp_st_1_2","DDV_V_8_5_sam"
"gd_taxp_st_2_1","gd_chart","Vstopni DDV 20% - SO","SO-DDV-V-20","percent","20","none","False","gd_acc_160003","gd_acc_160003","False",,,"DDV_V_20_SO"
"gd_taxp_st_2_2","gd_chart","Izstopni DDV 20% - SO","SO-DDV-I-20","percent","-20","none","False","gd_acc_260002","gd_acc_260002","False",,,"DDV_I_20_SO"
"gd_taxp_st_2","gd_chart","Vstopni DDV 20% - samoobdavčitev","DDV-V-20-SO","group","0","purchase","False",,,"False",,"gd_taxp_st_2_1,gd_taxp_st_2_2","DDV_V_20_sam"
"gd_taxp_2","gd_chart","Vstopni DDV 9.5%","DDV-V-9.5","percent","9.5","purchase","True","gd_acc_160002","gd_acc_160002","False",,,"DDV_V_9_5"
"gd_taxp_3","gd_chart","Vstopni DDV 22%","DDV-V-22","percent","22","purchase","True","gd_acc_160003","gd_acc_160003","False",,,"DDV_V_22"
"gd_taxp_nr_1","gd_chart","Vstopni DDV 9.5% - neodbitni","DDV-V-9.5-NE","percent","9.5","purchase","True","gd_acc_160001","gd_acc_160001","False",,,"DDV_V_9_5_NE"
"gd_taxp_nr_2","gd_chart","Vstopni DDV 22% - neodbitni","DDV-V-22-NE","percent","22","purchase","True","gd_acc_160001","gd_acc_160001","False",,,"DDV_V_22_NE"
"gd_taxp_st_1_1","gd_chart","Vstopni DDV 9.5% - SO","SO-DDV-V-9.5","percent","9.5","none","False","gd_acc_160002","gd_acc_160002","False",,,"DDV_V_9_5_SO"
"gd_taxp_st_1_2","gd_chart","Izstopni DDV 9.5% - SO","SO-DDV-I-9.5","percent","-9.5","none","False","gd_acc_260001","gd_acc_260001","False",,,"DDV_I_9_5_SO"
"gd_taxp_st_1","gd_chart","Vstopni DDV 9.5% - samoobdavčitev","DDV-V-9.5-SO","group","0","purchase","False",,,"False",,"gd_taxp_st_1_1,gd_taxp_st_1_2","DDV_V_9_5_sam"
"gd_taxp_st_2_1","gd_chart","Vstopni DDV 22% - SO","SO-DDV-V-22","percent","22","none","False","gd_acc_160003","gd_acc_160003","False",,,"DDV_V_22_SO"
"gd_taxp_st_2_2","gd_chart","Izstopni DDV 22% - SO","SO-DDV-I-22","percent","-22","none","False","gd_acc_260002","gd_acc_260002","False",,,"DDV_I_22_SO"
"gd_taxp_st_2","gd_chart","Vstopni DDV 22% - samoobdavčitev","DDV-V-22-SO","group","0","purchase","False",,,"False",,"gd_taxp_st_2_1,gd_taxp_st_2_2","DDV_V_22_sam"
1 id chart_template_id/id name description amount_type amount type_tax_use price_include refund_account_id/id account_id/id include_base_amount sequence children_tax_ids/id tag_ids/id
2 gd_taxr_1 gd_chart Izstopni DDV 0% DDV-I-0 percent 0 sale True DDV_I_0
3 gd_taxr_2 gd_chart Izstopni DDV 8.5% Izstopni DDV 9.5% DDV-I-8.5 DDV-I-9.5 percent 8.5 9.5 sale True gd_acc_260001 gd_acc_260001 False DDV_I_8_5 DDV_I_9_5
4 gd_taxr_3 gd_chart Izstopni DDV 20% Izstopni DDV 22% DDV-I-20 DDV-I-22 percent 20 22 sale True gd_acc_260002 gd_acc_260002 False DDV_I_20 DDV_I_22
5 gd_taxp_1 gd_chart Vstopni DDV 0% DDV-V-0 percent 0 purchase True DDV_V_0
6 gd_taxp_2 gd_chart Vstopni DDV 8.5% Vstopni DDV 9.5% DDV-V-8.5 DDV-V-9.5 percent 8.5 9.5 purchase True gd_acc_160002 gd_acc_160002 False DDV_V_8_5 DDV_V_9_5
7 gd_taxp_3 gd_chart Vstopni DDV 20% Vstopni DDV 22% DDV-V-20 DDV-V-22 percent 20 22 purchase True gd_acc_160003 gd_acc_160003 False DDV_V_20 DDV_V_22
8 gd_taxp_nr_1 gd_chart Vstopni DDV 8.5% - neodbitni Vstopni DDV 9.5% - neodbitni DDV-V-8.5-NE DDV-V-9.5-NE percent 8.5 9.5 purchase True gd_acc_160001 gd_acc_160001 False DDV_V_8_5_NE DDV_V_9_5_NE
9 gd_taxp_nr_2 gd_chart Vstopni DDV 20% - neodbitni Vstopni DDV 22% - neodbitni DDV-V-20-NE DDV-V-22-NE percent 20 22 purchase True gd_acc_160001 gd_acc_160001 False DDV_V_20_NE DDV_V_22_NE
10 gd_taxp_st_1_1 gd_chart Vstopni DDV 8.5% - SO Vstopni DDV 9.5% - SO SO-DDV-V-8.5 SO-DDV-V-9.5 percent 8.5 9.5 none False gd_acc_160002 gd_acc_160002 False DDV_V_8_5_SO DDV_V_9_5_SO
11 gd_taxp_st_1_2 gd_chart Izstopni DDV 8.5% - SO Izstopni DDV 9.5% - SO SO-DDV-I-8.5 SO-DDV-I-9.5 percent -8.5 -9.5 none False gd_acc_260001 gd_acc_260001 False DDV_I_8_5_SO DDV_I_9_5_SO
12 gd_taxp_st_1 gd_chart Vstopni DDV 8.5% - samoobdavčitev Vstopni DDV 9.5% - samoobdavčitev DDV-V-8.5-SO DDV-V-9.5-SO group 0 purchase False False gd_taxp_st_1_1,gd_taxp_st_1_2 DDV_V_8_5_sam DDV_V_9_5_sam
13 gd_taxp_st_2_1 gd_chart Vstopni DDV 20% - SO Vstopni DDV 22% - SO SO-DDV-V-20 SO-DDV-V-22 percent 20 22 none False gd_acc_160003 gd_acc_160003 False DDV_V_20_SO DDV_V_22_SO
14 gd_taxp_st_2_2 gd_chart Izstopni DDV 20% - SO Izstopni DDV 22% - SO SO-DDV-I-20 SO-DDV-I-22 percent -20 -22 none False gd_acc_260002 gd_acc_260002 False DDV_I_20_SO DDV_I_22_SO
15 gd_taxp_st_2 gd_chart Vstopni DDV 20% - samoobdavčitev Vstopni DDV 22% - samoobdavčitev DDV-V-20-SO DDV-V-22-SO group 0 purchase False False gd_taxp_st_2_1,gd_taxp_st_2_2 DDV_V_20_sam DDV_V_22_sam
+4
View File
@@ -2043,6 +2043,10 @@ class MailThread(models.AbstractModel):
"""
if not partner_ids:
return
if self.env.context.get('mail_auto_subscribe_no_notify'):
return
for record in self:
record.message_post_with_view(
'mail.message_user_assigned',
+5 -2
View File
@@ -356,7 +356,10 @@ class MrpWorkorder(models.Model):
raise UserError(_("You need to define at least one productivity loss in the category 'Performance'. Create one from the Manufacturing app, menu: Configuration / Productivity Losses."))
for workorder in self:
if workorder.production_id.state != 'progress':
workorder.production_id.state = 'progress'
workorder.production_id.write({
'state': 'progress',
'date_start': datetime.now(),
})
timeline.create({
'workorder_id': workorder.id,
'workcenter_id': workorder.workcenter_id.id,
@@ -449,4 +452,4 @@ class MrpWorkorder(models.Model):
self.ensure_one()
action = self.env.ref('stock.action_stock_scrap').read()[0]
action['domain'] = [('workorder_id', '=', self.id)]
return action
return action
+1 -1
View File
@@ -281,7 +281,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">mrp.production</field>
<field name="view_type">form</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph,gantt</field>
<field name="view_mode">tree,kanban,form,calendar,pivot,graph</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_mrp_production_filter"/>
<field name="context">{'search_default_todo': True}</field>
+6 -1
View File
@@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from datetime import datetime
from odoo import api, fields, models, _
from odoo.addons import decimal_precision as dp
from odoo.exceptions import UserError
@@ -87,7 +89,10 @@ class MrpProductProduce(models.TransientModel):
move.quantity_done_store += quantity * move.unit_factor
self.check_finished_move_lots()
if self.production_id.state == 'confirmed':
self.production_id.state = 'progress'
self.production_id.write({
'state': 'progress',
'date_start': datetime.now(),
})
return {'type': 'ir.actions.act_window_close'}
@api.multi
+5 -4
View File
@@ -268,20 +268,21 @@ class TxAuthorize(models.Model):
status_code = int(tree.get('x_response_code', '0'))
if status_code == self._authorize_valid_tx_status:
if tree.get('x_type').lower() in ['auth_capture', 'prior_auth_capture']:
if self.callback_eval and self.state != 'authorized':
safe_eval(self.callback_eval, {'self': self})
init_state = self.state
self.write({
'state': 'done',
'acquirer_reference': tree.get('x_trans_id'),
'date_validate': fields.Datetime.now(),
})
if tree.get('x_type').lower() == 'auth_only':
if self.callback_eval:
if self.callback_eval and init_state != 'authorized':
safe_eval(self.callback_eval, {'self': self})
if tree.get('x_type').lower() == 'auth_only':
self.write({
'state': 'authorized',
'acquirer_reference': tree.get('x_trans_id'),
})
if self.callback_eval:
safe_eval(self.callback_eval, {'self': self})
if tree.get('x_type').lower() == 'void':
self.write({
'state': 'cancel',
+1 -1
View File
@@ -56,7 +56,7 @@ class PaypalController(http.Controller):
tx = None
if reference:
tx = request.env['payment.transaction'].search([('reference', '=', reference)])
paypal_urls = tx.acquirer_id._get_paypal_urls(tx.acquirer_id.environment or 'prod')
paypal_urls = request.env['payment.acquirer']._get_paypal_urls(tx and tx.acquirer_id.environment or 'prod')
pdt_request = bool(new_post.get('amt')) # check for spefific pdt param
if pdt_request:
# this means we are in PDT instead of DPN like before
+11 -8
View File
@@ -507,6 +507,12 @@ msgid "Unable to find Wkhtmltopdf on this \n"
"wkhtmltopdf.org</a>"
msgstr ""
#. module: report
#: code:addons/report/models/report.py:164
#, python-format
msgid "Unable to find Wkhtmltopdf on this system. The PDF can not be created."
msgstr ""
#. module: report
#: model:ir.ui.view,arch_db:report.external_layout_footer
msgid "Website:"
@@ -542,17 +548,14 @@ msgid "base.config.settings"
msgstr ""
#. module: report
#: model:ir.model,name:report.model_ir_actions_report_xml
msgid "ir.actions.report.xml"
#. openerp-web
#: code:addons/report/static/src/js/qwebactionmanager.js:96
#, python-format
msgid "Your installation of Wkhtmltopdf seems to be broken. The \n"
"report will be shown in html.<br><br><a href=\"http://wkhtmltopdf.org/\" target=\"_blank\">wkhtmltopdf.org</a>"
msgstr ""
#. module: report
#: model:ir.model,name:report.model_ir_qweb_field_barcode
msgid "ir.qweb.field.barcode"
msgstr ""
#. module: report
#: model:ir.model,name:report.model_report_abstract_report
msgid "report.abstract_report"
msgstr ""
+22 -9
View File
@@ -59,16 +59,21 @@ except (OSError, IOError):
else:
_logger.info('Will use the Wkhtmltopdf binary at %s' % _get_wkhtmltopdf_bin())
out, err = process.communicate()
version = re.search('([0-9.]+)', out or "0").group(0)
if LooseVersion(version) < LooseVersion('0.12.0'):
_logger.info('Upgrade Wkhtmltopdf to (at least) 0.12.0')
wkhtmltopdf_state = 'upgrade'
else:
wkhtmltopdf_state = 'ok'
match = re.search('([0-9.]+)', out)
if match:
version = match.group(0)
if LooseVersion(version) < LooseVersion('0.12.0'):
_logger.info('Upgrade Wkhtmltopdf to (at least) 0.12.0')
wkhtmltopdf_state = 'upgrade'
else:
wkhtmltopdf_state = 'ok'
if config['workers'] == 1:
_logger.info('You need to start Odoo with at least two workers to print a pdf version of the reports.')
wkhtmltopdf_state = 'workers'
if config['workers'] == 1:
_logger.info('You need to start Odoo with at least two workers to print a pdf version of the reports.')
wkhtmltopdf_state = 'workers'
else:
_logger.info('Wkhtmltopdf seems to be broken.')
wkhtmltopdf_state = 'broken'
class Report(models.Model):
@@ -141,6 +146,14 @@ class Report(models.Model):
def get_pdf(self, docids, report_name, html=None, data=None):
"""This method generates and returns pdf version of a report.
"""
if self._check_wkhtmltopdf() == 'install':
# wkhtmltopdf is not installed
# the call should be catched before (cf /report/check_wkhtmltopdf) but
# if get_pdf is called manually (email template), the check could be
# bypassed
raise UserError(_("Unable to find Wkhtmltopdf on this system. The PDF can not be created."))
# As the assets are generated during the same transaction as the rendering of the
# templates calling them, there is a scenario where the assets are unreachable: when
# you make a request to read the assets while the transaction creating them is not done.
@@ -18,6 +18,7 @@ var WKHTMLTOPDF_MESSAGES = {
'install': _lt('Unable to find Wkhtmltopdf on this \nsystem. The report will be shown in html.<br><br><a href="http://wkhtmltopdf.org/" target="_blank">\nwkhtmltopdf.org</a>'),
'workers': _lt('You need to start OpenERP with at least two \nworkers to print a pdf version of the reports.'),
'upgrade': _lt('You should upgrade your version of\nWkhtmltopdf to at least 0.12.0 in order to get a correct display of headers and footers as well as\nsupport for table-breaking between pages.<br><br><a href="http://wkhtmltopdf.org/" \ntarget="_blank">wkhtmltopdf.org</a>'),
'broken': _lt('Your installation of Wkhtmltopdf seems to be broken. The report will be shown in html.<br><br><a href="http://wkhtmltopdf.org/" target="_blank">wkhtmltopdf.org</a>')
};
var trigger_download = function (session, response, c, action, options) {
-1
View File
@@ -680,7 +680,6 @@ class QuantPackage(models.Model):
# TDE FIXME: why superuser ?
package.mapped('quant_ids').sudo().write({'package_id': package.parent_id.id})
package.mapped('children_ids').write({'parent_id': package.parent_id.id})
self.unlink()
return self.env['ir.actions.act_window'].for_xml_id('stock', 'action_package_view')
def action_view_picking(self):
+1 -1
View File
@@ -754,7 +754,7 @@ class Orderpoint(models.Model):
('qty_multiple_check', 'CHECK( qty_multiple >= 0 )', 'Qty Multiple must be greater than or equal to zero.'),
]
@api.constrains('product_id', 'product_uom')
@api.constrains('product_id')
def _check_product_uom(self):
''' Check if the UoM has the same category as the product standard UoM '''
if any(orderpoint.product_id.uom_id.category_id != orderpoint.product_uom.category_id for orderpoint in self):
+1 -1
View File
@@ -12,7 +12,7 @@
<span><strong>Customer Address:</strong></span>
</div>
<div t-if="o.partner_id" name="partner_header">
<div t-field="o.partner_id"
<div t-field="o.move_lines[0].partner_id"
t-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": True}'/>
</div>
</div>
@@ -89,5 +89,6 @@ class AccountInvoiceLine(models.Model):
def get_invoice_line_account(self, type, product, fpos, company):
if company.anglo_saxon_accounting and type in ('in_invoice', 'in_refund') and product and product.type == 'product':
accounts = product.product_tmpl_id.get_product_accounts(fiscal_pos=fpos)
return accounts['stock_input']
if accounts['stock_input']:
return accounts['stock_input']
return super(AccountInvoiceLine, self).get_invoice_line_account(type, product, fpos, company)
@@ -99,7 +99,9 @@ return Widget.extend({
}));
} else {
var chart = this['display_' + this.mode]();
chart.tooltip.chartContainer(this.$el[0]);
if (chart) {
chart.tooltip.chartContainer(this.$el[0]);
}
}
},
display_bar: function () {
+1 -1
View File
@@ -340,7 +340,7 @@ var FieldTextHtml = widget.extend({
$("body").toggleClass("o_form_FieldTextHtml_fullscreen");
var full = $("body").hasClass("o_form_FieldTextHtml_fullscreen");
self.$iframe.parents().toggleClass('o_form_fullscreen_ancestor', full);
self.resize();
$(window).trigger("resize"); // induce a resize() call and let other backend elements know (the navbar extra items management relies on this)
});
this.$body.on('click', '[data-action="cancel"]', function (event) {
@@ -43,9 +43,8 @@
<p>Thanks,</p>
<pre>
${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature | safe or ''}
</pre>
${ctx['partner_id'].user_id and ctx['partner_id'].user_id.signature or '' | safe}
% if not ctx['partner_id'].user_id:
PS: It looks like you do not have an account manager assigned to you, please contact us.
% endif
@@ -93,6 +93,14 @@ class CrmLead(models.Model):
city=lead.city,
state=lead.state_id.name,
country=lead.country_id.name))
if result is None:
result = geo_find(geo_query_address(
city=lead.city,
state=lead.state_id.name,
country=lead.country_id.name
))
if result:
lead.write({
'partner_latitude': result[0],
@@ -2,9 +2,7 @@ odoo.define('crm.partner_assign', function (require) {
'use strict';
var Model = require('web.Model');
var time = require('web.time');
var website = require('website.website');
/*
* This file is intended to add interactivity to survey forms rendered by
* the website engine.
@@ -20,11 +18,16 @@ if(!interested_form.length && !desinterested_form.length && !opp_stage_buttons.l
}
$('.interested_partner_assign_confirm').on('click',function(e){
var $btn = $(this);
if ($('.interested_partner_assign_form .comment_interested').val() && $('.interested_partner_assign_form .contacted_interested').prop('checked')){
$btn.prop('disabled', true);
new Model('crm.lead')
.call("partner_interested",[[parseInt($('.interested_partner_assign_form .assign_lead_id').val())], $('.interested_partner_assign_form .comment_interested').val()])
.then(function(){
window.location.href = '/my/leads';
})
.always(function() {
$btn.prop('disabled', false);
});
}else{
$('.interested_partner_assign_form .error_partner_assign_interested').css('display', 'block');
@@ -33,7 +36,9 @@ $('.interested_partner_assign_confirm').on('click',function(e){
});
$('.desinterested_partner_assign_confirm').on('click',function(e){
$('.desinterested_partner_assign_confirm').on('click',function(){
var $btn = this;
$btn.prop('disabled', true);
new Model('crm.lead')
.call("partner_desinterested",
[[parseInt($('.desinterested_partner_assign_form .assign_lead_id').val())],
@@ -43,27 +48,36 @@ $('.desinterested_partner_assign_confirm').on('click',function(e){
])
.then(function(){
window.location.href = '/my/leads';
}).always(function() {
$btn.prop('disabled', false);
});
return false;
});
opp_stage_buttons.on('click',function(e){
var $btn = this;
$btn.prop('disabled', true);
new Model('crm.lead')
.call("write", [[parseInt(e.currentTarget.getAttribute('opp'))],{
stage_id: parseInt(e.currentTarget.getAttribute('data')),
},], {context: {website_partner_assign:1}})
.fail(function() {
$btn.prop('disabled', false);
})
.done(function () {
window.location.reload();
});
});
$('.edit_contact_form .country_id').on('change', function(e){
$('.edit_contact_form .country_id').on('change', function(){
var country_id = $('.edit_contact_form .country_id').find(":selected").attr('value');
$(".edit_contact_form .state[country!="+country_id+"]").css('display','none');
$(".edit_contact_form .state[country="+country_id+"]").css('display','block');
});
$('.edit_contact_confirm').on('click',function(e){
$('.edit_contact_confirm').on('click',function(){
var $btn = this;
$btn.prop('disabled', true);
new Model('crm.lead')
.call("write", [[parseInt($('.edit_contact_form .opportunity_id').val())],{
partner_name: $('.edit_contact_form .partner_name').val(),
@@ -77,7 +91,10 @@ $('.edit_contact_confirm').on('click',function(e){
state_id: parseInt($('.edit_contact_form .state_id').find(":selected").attr('value')),
country_id: parseInt($('.edit_contact_form .country_id').find(":selected").attr('value')),
}])
.done(function(response){
.fail(function() {
$btn.prop('disabled', false);
})
.done(function(){
window.location.reload();
});
return false;
@@ -102,7 +119,9 @@ $('.new_opp_confirm').on('click',function(e){
return false;
});
$('.edit_opp_confirm').on('click',function(e){
$('.edit_opp_confirm').on('click',function(){
var $btn = this;
$btn.prop('disabled', true);
new Model('crm.lead')
.call("update_lead_portal", [[parseInt($('.edit_opp_form .opportunity_id').val())],{
activity_id: parseInt($('.edit_opp_form .next_activity').find(":selected").attr('data')),
@@ -113,13 +132,16 @@ $('.edit_opp_confirm').on('click',function(e){
date_action: $('.edit_opp_form .date_action').val(),
priority: $('input[name="PriorityRadioOptions"]:checked').val(),
}])
.done(function(response){
.fail(function() {
$btn.prop('disabled', false);
})
.done(function(){
window.location.reload();
});
return false;
});
$('.edit_opp_form .next_activity').on('change', function(e){
$('.edit_opp_form .next_activity').on('change', function(){
var selected = $('.edit_opp_form .next_activity').find(":selected");
if(selected.attr('description')){
$('.edit_opp_form .title_action').val(selected.attr('description'));
@@ -99,7 +99,7 @@ class CrmLeadForwardToPartner(models.TransientModel):
for lead_data in partner_leads['leads']:
leads |= lead_data['lead_id']
values = {'partner_assigned_id': partner_id, 'user_id': partner_leads['partner'].user_id.id}
leads.write(values)
leads.with_context(mail_auto_subscribe_no_notify=1).write(values)
self.env['crm.lead'].message_subscribe([partner_id])
return True
+36 -26
View File
@@ -41,32 +41,42 @@ class PaymentTransaction(models.Model):
tx = None
res = super(PaymentTransaction, self).form_feedback(data, acquirer_name)
# fetch the tx, check its state, confirm the potential SO
try:
tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name
if hasattr(self, tx_find_method_name):
tx = getattr(self, tx_find_method_name)(data)
_logger.info('<%s> transaction processed: tx ref:%s, tx amount: %s', acquirer_name, tx.reference if tx else 'n/a', tx.amount if tx else 'n/a')
# fetch the tx
tx_find_method_name = '_%s_form_get_tx_from_data' % acquirer_name
if hasattr(self, tx_find_method_name):
tx = getattr(self, tx_find_method_name)(data)
_logger.info('<%s> transaction processed: tx ref:%s, tx amount: %s', acquirer_name, tx.reference if tx else 'n/a', tx.amount if tx else 'n/a')
if tx and tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']:
# verify SO/TX match, excluding tx.fees which are currently not included in SO
amount_matches = float_compare(tx.amount, tx.sale_order_id.amount_total, 2) == 0
if amount_matches:
if tx.state == 'authorized' and tx.acquirer_id.auto_confirm == 'authorize':
_logger.info('<%s> transaction authorized, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
tx.sale_order_id.with_context(send_email=True).action_confirm()
if tx.state == 'done' and tx.acquirer_id.auto_confirm in ['confirm_so', 'generate_and_pay_invoice']:
_logger.info('<%s> transaction completed, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
tx.sale_order_id.with_context(send_email=True).action_confirm()
if tx.acquirer_id.auto_confirm == 'generate_and_pay_invoice':
self._generate_and_pay_invoice(tx, acquirer_name)
elif tx.state not in ['cancel', 'error'] and tx.sale_order_id.state == 'draft':
_logger.info('<%s> transaction pending/to confirm manually, sending quote email for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
tx.sale_order_id.force_quotation_send()
else:
_logger.warning('<%s> transaction MISMATCH for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
except Exception:
_logger.exception('Fail to confirm the order or send the confirmation email%s', tx and ' for the transaction %s' % tx.reference or '')
if tx:
# Auto-confirm SO if necessary
tx._confirm_so(acquirer_name=acquirer_name)
return res
def _confirm_so(self, acquirer_name=False):
for tx in self:
try:
# check tx state, confirm the potential SO
if tx.sale_order_id and tx.sale_order_id.state in ['draft', 'sent']:
# verify SO/TX match, excluding tx.fees which are currently not included in SO
amount_matches = float_compare(tx.amount, tx.sale_order_id.amount_total, 2) == 0
if amount_matches:
if not acquirer_name:
acquirer_name = tx.sale_order_id.payment_acquirer_id.provider or 'unknown'
if tx.state == 'authorized' and tx.acquirer_id.auto_confirm == 'authorize':
_logger.info('<%s> transaction authorized, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
tx.sale_order_id.with_context(send_email=True).action_confirm()
if tx.state == 'done' and tx.acquirer_id.auto_confirm in ['confirm_so', 'generate_and_pay_invoice']:
_logger.info('<%s> transaction completed, auto-confirming order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
tx.sale_order_id.with_context(send_email=True).action_confirm()
if tx.acquirer_id.auto_confirm == 'generate_and_pay_invoice':
self._generate_and_pay_invoice(tx, acquirer_name)
elif tx.state not in ['cancel', 'error'] and tx.sale_order_id.state == 'draft':
_logger.info('<%s> transaction pending/to confirm manually, sending quote email for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
tx.sale_order_id.force_quotation_send()
else:
_logger.warning('<%s> transaction MISMATCH for order %s (ID %s)', acquirer_name, tx.sale_order_id.name, tx.sale_order_id.id)
except Exception:
_logger.exception('Fail to confirm the order or send the confirmation email%s', tx and ' for the transaction %s' % tx.reference or '')
+4 -1
View File
@@ -753,7 +753,10 @@ class WebsiteSale(http.Controller):
valid_state = 'authorized' if tx.acquirer_id.auto_confirm == 'authorize' else 'done'
if not s2s_result or tx.state != valid_state:
return dict(success=False, error=_("Payment transaction failed (%s)") % tx.state_message)
return dict(success=True, url='/shop/payment/validate')
else:
# Auto-confirm SO if necessary
tx._confirm_so()
return dict(success=True, url='/shop/payment/validate')
except Exception, e:
_logger.warning(_("Payment transaction (%s) failed : <%s>") % (tx.id, str(e)))
return dict(success=False, error=_("Payment transaction failed (Contact Administrator)"))
+12 -39
View File
@@ -840,13 +840,9 @@ msgstr ""
msgid "Delivery methods are selectable on the website: the customer pays for shipping costs"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_quote_description
msgid "Description for the quote"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_website_description
#: model:ir.model.fields,field_description:website_sale.field_product_template_website_description
msgid "Description for the website"
msgstr ""
@@ -924,15 +920,6 @@ msgstr ""
msgid "Enter a name for your new product"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,help:website_sale.field_product_product_split_method
msgid "Equal : Cost will be equally divided.\n"
"By Quantity : Cost will be divided according to product's quantity.\n"
"By Current cost : Cost will be divided according to product's current cost.\n"
"By Weight : Cost will be divided depending on its weight.\n"
"By Volume : Cost will be divided depending on its volume."
msgstr ""
#. module: website_sale
#: code:addons/website_sale/models/product.py:89
#, python-format
@@ -1001,11 +988,6 @@ msgstr ""
msgid "Gives the sequence order when displaying a list of product categories."
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_hs_code
msgid "HS Code"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_style_html_class
msgid "HTML Classes"
@@ -1129,11 +1111,6 @@ msgstr ""
msgid "Keyboard / Mouse"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_landed_cost_ok
msgid "Landed Costs"
msgstr ""
#. module: website_sale
#: model:product.public.category,name:website_sale.laptops
msgid "Laptops"
@@ -1216,6 +1193,7 @@ msgstr ""
#: model:ir.model.fields,field_description:website_sale.field_product_image_name
#: model:ir.model.fields,field_description:website_sale.field_product_public_category_name
#: model:ir.ui.view,arch_db:website_sale.address
#: model:ir.ui.view,arch_db:website_sale.sort
msgid "Name"
msgstr ""
@@ -1445,6 +1423,16 @@ msgstr ""
msgid "Price"
msgstr ""
#. module: website_sale
#: model:ir.ui.view,arch_db:website_sale.sort
msgid "Price <i class=\"fa fa-arrow-down\" aria-hidden=\"true\"/>"
msgstr ""
#. module: website_sale
#: model:ir.ui.view,arch_db:website_sale.sort
msgid "Price <i class=\"fa fa-arrow-up\" aria-hidden=\"true\"/>"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_website_pricelist_ids
msgid "Price list available for this Ecommerce/Website"
@@ -1476,11 +1464,6 @@ msgstr ""
msgid "Printer"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_purchase_requisition
msgid "Procurement"
msgstr ""
#. module: website_sale
#. openerp-web
#: code:addons/website_sale/static/src/xml/website_sale_dashboard.xml:29
@@ -1926,16 +1909,6 @@ msgid "Specific prices per customer segment, currency, etc.: new pricing table a
"Advanced pricing based on formulas (discounts, margins, rounding): apply price rules from a new *Pricelists* menu in Configuration."
msgstr ""
#. module: website_sale
#: model:ir.model.fields,field_description:website_sale.field_product_product_split_method
msgid "Split Method"
msgstr ""
#. module: website_sale
#: model:ir.model.fields,help:website_sale.field_product_product_hs_code
msgid "Standardized code for international shipping and goods declaration"
msgstr ""
#. module: website_sale
#: model:ir.ui.view,arch_db:website_sale.website_planner
msgid "Start your online shop by creating 3 products pages.<br/>"
+6 -3
View File
@@ -217,10 +217,13 @@
<template id="sort" inherit_id="website_sale.products" active="True" customize_show="True" name="Show Sort by">
<xpath expr="//div[@class='products_pager']/div/t[@t-call][last()]" position="after">
<t t-set="list_price_desc_label">Price <i class="fa fa-carret-up" aria-hidden="true"/></t>
<t t-set="list_price_asc_label">Price <i class="fa fa-carret-down" aria-hidden="true"/></t>
<t t-set="name_asc_label">Name <i class="fa fa-carret-down" aria-hidden="true"/></t>
<t t-set="website_sale_sortable" t-value="[
('Price &lt;i class=\'fa fa-caret-up\' aria-hidden=\'true\'&gt;&lt;/i&gt;', 'list_price desc'),
('Price &lt;i class=\'fa fa-caret-down\' aria-hidden=\'true\'&gt;&lt;/i&gt;', 'list_price asc'),
('Name &lt;i class=\'fa fa-caret-down\' aria-hidden=\'true\'&gt;&lt;/i&gt;', 'name asc')
(list_price_desc_label, 'list_price desc'),
(list_price_asc_label, 'list_price asc'),
(name_asc_label, 'name asc')
]"/>
<t t-set="website_sale_sortable_current" t-value="[sort for sort in website_sale_sortable if sort[1]==request.params.get('order', '')]"/>
<div class="dropdown btn-group dropdown_sorty_by">
-2
View File
@@ -13,6 +13,4 @@ Yenthe Van Ginneken yenthe.vanginneken@vanroey.be https://github.com/Yenthe666
List of contributors:
Yenthe Van Ginneken yenthe.vanginneken@vanroey.be https://github.com/Yenthe666
Maarten Wijnants maarten.wijnants@vanroey.be https://github.com/weilant
Vincent Adriaensen vincent.adriaensen@vanroey.be https://github.com/vincentadriaensen
Pieter Paulussen pieter.paulussen@vanroey.be https://github.com/PieterPaulussen
+1
View File
@@ -12,4 +12,5 @@ Aleš Ferlan alefer89@protonmail.com
List of contributors:
Aleš Ferlan alefer89@gmail.com https://github.com/Alko89
Aleš Ferlan alefer89@protonmail.com
+11
View File
@@ -0,0 +1,11 @@
Cuba, 2016-10-24
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,
Sergio Valdés sergiov@merchise.org https://github.com/Sergio2409
+11
View File
@@ -0,0 +1,11 @@
Slovenia, 2016-11-07
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,
Jaka Luthar jl2035@users.noreply.github.com https://github.com/jl2035
+1 -1
View File
@@ -374,7 +374,7 @@ class IrAttachment(models.Model):
continue
# filter ids according to what access rules permit
target_ids = list(targets)
allowed = self.env[res_model].search([('id', 'in', target_ids)])
allowed = self.env[res_model].with_context(active_test=False).search([('id', 'in', target_ids)])
for res_id in set(target_ids).difference(allowed.ids):
ids.difference_update(targets[res_id])
+4 -4
View File
@@ -83,11 +83,11 @@ class IrQWeb(models.AbstractModel, QWeb):
# QWeb's `read_template` will check if one of the first children of
# what we send to it has a "t-name" attribute having `name` as value
# to consider it has found it. As it'll never be the case when working
# with view ids or children view, force it here.
def is_child_view(view):
view_id = self.env['ir.ui.view'].get_view_id(name)
# with view ids or children view or children primary views, force it here.
def is_child_view(view_name):
view_id = self.env['ir.ui.view'].get_view_id(view_name)
view = self.env['ir.ui.view'].browse(view_id)
return view.inherit_id is not None and view.mode != 'primary'
return view.inherit_id is not None
if isinstance(name, (int, long)) or is_child_view(name):
for node in etree.fromstring(template):
+1 -1
View File
@@ -278,7 +278,7 @@ actual arch.
self.raise_view_error(message, self.id)
return True
@api.constrains('arch', 'arch_base')
@api.constrains('arch_db')
def _check_xml(self):
# Sanity checks: the view should not break anything upon rendering!
# Any exception raised below will cause a transaction rollback.
+28 -2
View File
@@ -1207,14 +1207,25 @@ class TestQWebRender(ViewCase):
</xpath>
"""
})
view3 = self.View.create({
'name': "dummy_primary_ext",
'type': 'qweb',
'inherit_id': view1.id,
'mode': 'primary',
'arch': """
<xpath expr="//div" position="inside">
<span>another primary thing</span>
</xpath>
"""
})
# render with an id
# render view and child view with an id
content1 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id]).render(view1.id)
content2 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id]).render(view2.id)
self.assertEqual(content1, content2)
# render with an xmlid
# render view and child view with an xmlid
self.env.cr.execute("INSERT INTO ir_model_data(name, model, res_id, module)"
"VALUES ('dummy', 'ir.ui.view', %s, 'base')" % view1.id)
self.env.cr.execute("INSERT INTO ir_model_data(name, model, res_id, module)"
@@ -1224,3 +1235,18 @@ class TestQWebRender(ViewCase):
content2 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id]).render('base.dummy_ext')
self.assertEqual(content1, content2)
# render view and primary extension with an id
content1 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id, view3.id]).render(view1.id)
content3 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id, view3.id]).render(view3.id)
self.assertNotEqual(content1, content3)
# render view and primary extension with an xmlid
self.env.cr.execute("INSERT INTO ir_model_data(name, model, res_id, module)"
"VALUES ('dummy_primary_ext', 'ir.ui.view', %s, 'base')" % view3.id)
content1 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id, view3.id]).render('base.dummy')
content3 = self.env['ir.qweb'].with_context(check_view_ids=[view1.id, view2.id, view3.id]).render('base.dummy_primary_ext')
self.assertNotEqual(content1, content3)
@@ -130,6 +130,26 @@ class TestFields(common.TransactionCase):
})
check_stored(discussion3)
def test_11_computed_access(self):
""" test computed fields with access right errors """
User = self.env['res.users']
user1 = User.create({'name': 'Aaaah', 'login': 'a'})
user2 = User.create({'name': 'Boooh', 'login': 'b'})
user3 = User.create({'name': 'Crrrr', 'login': 'c'})
# add a rule to not give access to user2
self.env['ir.rule'].create({
'model_id': self.env['ir.model'].search([('model', '=', 'res.users')]).id,
'domain_force': "[('id', '!=', %d)]" % user2.id,
})
# group users as a recordset, and read them as user demo
users = (user1 + user2 + user3).sudo(self.env.ref('base.user_demo'))
user1, user2, user3 = users
# regression test: a bug invalidated the field's value from cache
user1.company_type
with self.assertRaises(AccessError):
user2.company_type
user3.company_type
def test_12_recursive(self):
""" test recursively dependent fields """
Category = self.env['test_new_api.category']
@@ -504,6 +524,14 @@ class TestFields(common.TransactionCase):
record.write({key: False})
self.assertEqual(record.data, dict(values[n+1:]))
# check reflection of sparse fields in 'ir.model.fields'
names = [name for name, _ in values]
domain = [('model', '=', 'test_new_api.sparse'), ('name', 'in', names)]
fields = self.env['ir.model.fields'].search(domain)
self.assertEqual(len(fields), len(names))
for field in fields:
self.assertEqual(field.serialization_field_id.name, 'data')
def test_30_read(self):
""" test computed fields as returned by read(). """
discussion = self.env.ref('test_new_api.discussion_0')
+6 -6
View File
@@ -925,15 +925,15 @@ class Field(object):
for field in fields:
for record in records:
record._cache[field] = field.convert_to_cache(False, record, validate=False)
with records.env.protecting(fields, records):
if isinstance(self.compute, basestring):
getattr(records, self.compute)()
else:
self.compute(records)
if isinstance(self.compute, basestring):
getattr(records, self.compute)()
else:
self.compute(records)
def compute_value(self, records):
""" Invoke the compute method on ``records``; the results are in cache. """
with records.env.do_in_draft():
fields = records._field_computed[self]
with records.env.do_in_draft(), records.env.protecting(fields, records):
try:
self._compute_value(records)
except (AccessError, MissingError):
+9 -6
View File
@@ -308,7 +308,7 @@ class BaseModel(object):
Fields = self.env['ir.model.fields']
# sparse fields should be created at the end, as they depend on their serialized field
model_fields = sorted(self._fields.itervalues(), key=lambda field: field.type == 'sparse')
model_fields = sorted(self._fields.itervalues(), key=lambda field: bool(field.sparse))
for field in model_fields:
vals = {
'model_id': model.id,
@@ -332,11 +332,11 @@ class BaseModel(object):
'column1': field.column1 if field.type == 'many2many' else None,
'column2': field.column2 if field.type == 'many2many' else None,
}
if getattr(field, 'serialization_field', None):
if field.sparse:
# resolve link to serialization_field if specified by name
serialization_field = Fields.search([('model', '=', vals['model']), ('name', '=', field.serialization_field)])
serialization_field = Fields.search([('model', '=', vals['model']), ('name', '=', field.sparse)])
if not serialization_field:
raise UserError(_("Serialization field `%s` not found for sparse field `%s`!") % (field.serialization_field, field.name))
raise UserError(_("Serialization field `%s` not found for sparse field `%s`!") % (field.sparse, field.name))
vals['serialization_field_id'] = serialization_field.id
if field.name not in cols:
@@ -664,8 +664,11 @@ class BaseModel(object):
cls = type(self)
methods = []
for attr, func in getmembers(cls, is_constraint):
if not all(name in cls._fields for name in func._constrains):
_logger.warning("@constrains%r parameters must be field names", func._constrains)
for name in func._constrains:
if name not in cls._fields:
_logger.warning("method %s.%s: @constrains parameter %r is not a field name", cls._name, attr, name)
if not cls._fields[name].store:
_logger.warning("method %s.%s: @constrains parameter %r is not stored", cls._name, attr, name)
methods.append(func)
# optimization: memoize result on cls, it will not be recomputed
+2
View File
@@ -223,6 +223,8 @@ def html_sanitize(src, silent=True, sanitize_tags=True, sanitize_attributes=Fals
cleaned = cleaned.replace('%7C', '|')
cleaned = cleaned.replace('&lt;%', '<%')
cleaned = cleaned.replace('%&gt;', '%>')
# html considerations so real html content match database value
cleaned.replace(u'\xa0', '&nbsp;')
except etree.ParserError, e:
if 'empty' in str(e):
return ""