[MERGE] forward port branch 10.0 up to 342d037373

This commit is contained in:
Christophe Simonis
2018-08-21 11:33:53 +02:00
13 changed files with 115 additions and 12 deletions
+4 -2
View File
@@ -873,11 +873,13 @@ class Meeting(models.Model):
@api.onchange('start_date')
def _onchange_start_date(self):
self.start = self.start_date
if self.start_date:
self.start = self.start_date
@api.onchange('stop_date')
def _onchange_stop_date(self):
self.stop = self.stop_date
if self.stop_date:
self.stop = self.stop_date
####################################################
# Calendar Business, Reccurency, ...
+1 -1
View File
@@ -640,7 +640,7 @@ class Lead(models.Model):
def _get_duplicated_leads_by_emails(self, partner_id, email, include_lost=False):
""" Search for opportunities that have the same partner and that arent done or cancelled """
if not email:
return []
return self.env['crm.lead']
partner_match_domain = []
for email in set(email_split(email) + [email]):
partner_match_domain.append(('email_from', '=ilike', email))
+4 -4
View File
@@ -161,13 +161,13 @@ class GamificationBadge(models.Model):
for badge in self:
owners = badge.owner_ids
badge.stats_my = sum(o.user_id == self.env.user for o in owners)
badge.stats_this_month = sum(o.create_date >= first_month_day for o in owners)
badge.stats_my_this_month = sum(
badge.stat_my = sum(o.user_id == self.env.user for o in owners)
badge.stat_this_month = sum(o.create_date >= first_month_day for o in owners)
badge.stat_my_this_month = sum(
o.user_id == self.env.user and o.create_date >= first_month_day
for o in owners
)
badge.stats_my_monthly_sending = sum(
badge.stat_my_monthly_sending = sum(
o.create_uid == self.env.user and o.create_date >= first_month_day
for o in owners
)
@@ -12,4 +12,15 @@
</field>
</field>
</record>
<record id="supplier_invoice_bbacomm_form" model="ir.ui.view">
<field name="name">account.invoice.supplier.form</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<field name="reference" position="before">
<field name="reference_type" attrs="{'readonly':[('state','!=','draft')]}"/>
</field>
</field>
</record>
</odoo>
+32 -1
View File
@@ -52,6 +52,10 @@
<field name="name">Switzerland VAT Form: grid 381 base</field>
<field name="applicability">taxes</field>
</record>
<record id="vat_tag_382_a" model="account.account.tag">
<field name="name">Switzerland VAT Form: grid 382 base</field>
<field name="applicability">taxes</field>
</record>
<record id="vat_tag_301_b" model="account.account.tag">
<field name="name">Switzerland VAT Form: grid 301 tax</field>
<field name="applicability">taxes</field>
@@ -76,6 +80,10 @@
<field name="name">Switzerland VAT Form: grid 381 tax</field>
<field name="applicability">taxes</field>
</record>
<record id="vat_tag_382_b" model="account.account.tag">
<field name="name">Switzerland VAT Form: grid 382 tax</field>
<field name="applicability">taxes</field>
</record>
<record id="vat_tag_400" model="account.account.tag">
<field name="name">Switzerland VAT Form: grid 400</field>
<field name="applicability">taxes</field>
@@ -98,7 +106,7 @@
</record>
<record id="vat_tag_dedouanement" model="account.account.tag">
<field name="name">Switzerland VAT Form: 100% dédouanement (base in grid 400)</field>
<field name="name">Switzerland VAT Form: 100% dédouanement (base in grid 400)</field>
<field name="applicability">taxes</field>
</record>
@@ -388,6 +396,18 @@
<field name="account_id" ref="ch_coa_1171"/>
<field name="tag_ids" eval="[(6,0,[ref('vat_tag_405')])]"/>
</record>
<record model="account.tax.template" id="vat_77_purchase_return">
<field name="name">TVA due a 7.7% (TN) (return)</field>
<field name="description">7.7% achat (return)</field>
<field name="amount" eval="-7.7"/>
<field name="amount_type">percent</field>
<field name="sequence" eval="0"/>
<field name="chart_template_id" ref="l10nch_chart_template"/>
<field name="type_tax_use">purchase</field>
<field name="refund_account_id" ref="ch_coa_1170"/>
<field name="account_id" ref="ch_coa_1170"/>
<field name="tag_ids" eval="[(6,0,[ref('vat_tag_382_a'),ref('vat_tag_382_b')])]"/>
</record>
<record model="account.tax.template" id="vat_80">
<field name="name">TVA due a 8.0% (TN)</field>
<field name="description">8.0%</field>
@@ -501,4 +521,15 @@
<field name="account_id" ref="ch_coa_1171"/>
<field name="tag_ids" eval="[(6,0,[ref('vat_tag_dedouanement')])]"/>
</record>
<!--# for reverse charge or VAT on Acquisition (group of taxes)-->
<record model="account.tax.template" id="vat_77_purchase_reverse">
<field name="description">7.7% achat</field>
<field name="name">TVA 7.7% sur achat service a l'etranger (reverse charge)</field>
<field name="amount" eval="7.7"/>
<field name="amount_type">group</field>
<field name="type_tax_use">purchase</field>
<field name="children_tax_ids" eval="[(6, 0, [ref('vat_77_purchase_return'), ref('vat_77_purchase')])]"/>
<field name="chart_template_id" ref="l10nch_chart_template"/>
<field name="tag_ids" eval="[(6,0,[ref('vat_tag_382_a'), ref('vat_tag_382_b')])]"/>
</record>
</odoo>
@@ -12,7 +12,7 @@
<h4>Paie du <span t-field="o.date_from"/> au <span t-field="o.date_to"/></h4>
</div>
<div class="col-xs-4 pull-right">
<table class="table table-bordered" stype="border: 2px solid black;">
<table class="table table-bordered" style="border: 2px solid black;">
<tr>
<td>
<div t-field="o.employee_id.company_id.partner_id"
+3 -1
View File
@@ -86,7 +86,9 @@ class Users(models.Model):
params['forum_id'] = forum_id
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
token_url = base_url + '/forum/validate_email?%s' % urlencode(params)
activation_template.sudo().with_context(token_url=token_url).send_mail(self.id, force_send=True)
with self._cr.savepoint():
activation_template.sudo().with_context(token_url=token_url).send_mail(
self.id, force_send=True, raise_exception=True)
return True
@api.one
+15
View File
@@ -0,0 +1,15 @@
France, 2018-06-20
JANUS 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,
Martin Duvergey martin.duvergey@gpsante.fr https://github.com/mduvergey
List of contributors:
Martin Duvergey martin.duvergey@gpsante.fr https://github.com/mduvergey
+11
View File
@@ -0,0 +1,11 @@
Ukraine, 2018-06-11
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,
Paziuk Oleksandr o.paziuk@mobilunity.com https://github.com/oleksandrpaziuk
+2
View File
@@ -707,6 +707,8 @@ class IrModelFields(models.Model):
# add compute function if given
if field_data['compute']:
attrs['compute'] = make_compute(field_data['compute'], field_data['depends'])
if field_data.get('sparse'):
attrs['sparse'] = field_data['sparse']
return fields.Field.by_type[field_data['ttype']](**attrs)
+24
View File
@@ -202,6 +202,30 @@ class TestORM(TransactionCase):
group_user.write({'users': [(3, user.id)]})
self.assertTrue(user.share)
@mute_logger('odoo.models')
def test_unlink_with_property(self):
""" Verify that unlink removes the related ir.property as unprivileged user """
user = self.env['res.users'].create({
'name': 'Justine Bridou',
'login': 'saucisson',
'groups_id': [4, self.ref('base.group_partner_manager')],
})
p1 = self.env['res.partner'].sudo(user).create({'name': 'Zorro'})
p1_prop = self.env['ir.property'].sudo(user).create({
'name': 'Slip en laine',
'res_id': 'res.partner,{}'.format(p1.id),
'fields_id': self.env['ir.model.fields'].search([
('model', '=', 'res.partner'), ('name', '=', 'ref')], limit=1).id,
'value_text': 'Nain poilu',
'type': 'char',
})
# Unlink with unprivileged user
p1.unlink()
# ir.property is deleted
self.assertEqual(
p1_prop.exists(), self.env['ir.property'], 'p1_prop should have been deleted')
class TestInherits(TransactionCase):
""" test the behavior of the orm for models that use _inherits;
+1 -2
View File
@@ -3364,9 +3364,8 @@ class BaseModel(object):
# Delete the records' properties.
with self.env.norecompute():
self.env['ir.property'].search([('res_id', 'in', refs)]).unlink()
self.check_access_rule('unlink')
self.env['ir.property'].search([('res_id', 'in', refs)]).sudo().unlink()
cr = self._cr
Data = self.env['ir.model.data'].sudo().with_context({})
+6
View File
@@ -212,9 +212,15 @@ class Registry(Mapping):
if self._fields_by_model is None:
# Query manual fields for all models at once
self._fields_by_model = dic = defaultdict(dict)
id2name = {}
cr.execute('SELECT * FROM ir_model_fields WHERE state=%s', ('manual',))
for field in cr.dictfetchall():
dic[field['model']][field['name']] = field
id2name[field['id']] = field['name']
# compute the attribute 'sparse'
for fields in dic.values():
for name, field in fields.items():
field['sparse'] = id2name.get(field['serialization_field_id'])
return self._fields_by_model[model_name]
def do_parent_store(self, cr):