[MERGE] forward port branch saas-15 up to 9cf0dbe226

This commit is contained in:
Christophe Simonis
2018-08-21 16:00:40 +02:00
13 changed files with 109 additions and 14 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ class IrModelFields(models.Model):
ttype = fields.Selection(selection_add=[('serialized', 'serialized')]) ttype = fields.Selection(selection_add=[('serialized', 'serialized')])
serialization_field_id = fields.Many2one('ir.model.fields', string='Serialization Field', serialization_field_id = fields.Many2one('ir.model.fields', string='Serialization Field',
ondelete='cascade', domain="[('ttype','=','serialized')]", ondelete='cascade', domain="[('ttype','=','serialized'), ('model_id', '=', model_id)]",
help="If set, this field will be stored in the sparse structure of the " help="If set, this field will be stored in the sparse structure of the "
"serialization field, instead of having its own database column. " "serialization field, instead of having its own database column. "
"This cannot be changed after creation.", "This cannot be changed after creation.",
+1 -1
View File
@@ -22,7 +22,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="related" position="before"> <field name="related" position="before">
<field name="serialization_field_id" <field name="serialization_field_id"
domain="[('ttype','=','serialized'), ('model_id','=',model_id)]" context="{'default_model_id': model_id, 'default_ttype': 'serialized'}"
attrs="{'readonly': [('state','=','base')]}"/> attrs="{'readonly': [('state','=','base')]}"/>
</field> </field>
</field> </field>
+4 -2
View File
@@ -946,11 +946,13 @@ class Meeting(models.Model):
@api.onchange('start_date') @api.onchange('start_date')
def _onchange_start_date(self): def _onchange_start_date(self):
self.start = self.start_date if self.start_date:
self.start = self.start_date
@api.onchange('stop_date') @api.onchange('stop_date')
def _onchange_stop_date(self): def _onchange_stop_date(self):
self.stop = self.stop_date if self.stop_date:
self.stop = self.stop_date
#################################################### ####################################################
# Calendar Business, Reccurency, ... # Calendar Business, Reccurency, ...
+1 -1
View File
@@ -700,7 +700,7 @@ class Lead(models.Model):
def _get_duplicated_leads_by_emails(self, partner_id, email, include_lost=False): 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 """ """ Search for opportunities that have the same partner and that arent done or cancelled """
if not email: if not email:
return [] return self.env['crm.lead']
partner_match_domain = [] partner_match_domain = []
for email in set(email_split(email) + [email]): for email in set(email_split(email) + [email]):
partner_match_domain.append(('email_from', '=ilike', 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: for badge in self:
owners = badge.owner_ids owners = badge.owner_ids
badge.stats_my = sum(o.user_id == self.env.user for o in owners) badge.stat_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.stat_this_month = sum(o.create_date >= first_month_day for o in owners)
badge.stats_my_this_month = sum( badge.stat_my_this_month = sum(
o.user_id == self.env.user and o.create_date >= first_month_day o.user_id == self.env.user and o.create_date >= first_month_day
for o in owners 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 o.create_uid == self.env.user and o.create_date >= first_month_day
for o in owners for o in owners
) )
@@ -12,4 +12,15 @@
</field> </field>
</field> </field>
</record> </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> </odoo>
+32 -1
View File
@@ -52,6 +52,10 @@
<field name="name">Switzerland VAT Form: grid 381 base</field> <field name="name">Switzerland VAT Form: grid 381 base</field>
<field name="applicability">taxes</field> <field name="applicability">taxes</field>
</record> </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"> <record id="vat_tag_301_b" model="account.account.tag">
<field name="name">Switzerland VAT Form: grid 301 tax</field> <field name="name">Switzerland VAT Form: grid 301 tax</field>
<field name="applicability">taxes</field> <field name="applicability">taxes</field>
@@ -76,6 +80,10 @@
<field name="name">Switzerland VAT Form: grid 381 tax</field> <field name="name">Switzerland VAT Form: grid 381 tax</field>
<field name="applicability">taxes</field> <field name="applicability">taxes</field>
</record> </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"> <record id="vat_tag_400" model="account.account.tag">
<field name="name">Switzerland VAT Form: grid 400</field> <field name="name">Switzerland VAT Form: grid 400</field>
<field name="applicability">taxes</field> <field name="applicability">taxes</field>
@@ -98,7 +106,7 @@
</record> </record>
<record id="vat_tag_dedouanement" model="account.account.tag"> <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> <field name="applicability">taxes</field>
</record> </record>
@@ -411,6 +419,18 @@
<field name="tag_ids" eval="[(6,0,[ref('vat_tag_405')])]"/> <field name="tag_ids" eval="[(6,0,[ref('vat_tag_405')])]"/>
<field name="tax_group_id" ref="tax_group_tva_77"/> <field name="tax_group_id" ref="tax_group_tva_77"/>
</record> </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"> <record model="account.tax.template" id="vat_80">
<field name="name">TVA due a 8.0% (TN)</field> <field name="name">TVA due a 8.0% (TN)</field>
<field name="description">8.0%</field> <field name="description">8.0%</field>
@@ -534,4 +554,15 @@
<field name="tag_ids" eval="[(6,0,[ref('vat_tag_dedouanement')])]"/> <field name="tag_ids" eval="[(6,0,[ref('vat_tag_dedouanement')])]"/>
<field name="tax_group_id" ref="tax_group_tva_0"/> <field name="tax_group_id" ref="tax_group_tva_0"/>
</record> </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> </odoo>
@@ -12,7 +12,7 @@
<h4>Paie du <span t-field="o.date_from"/> au <span t-field="o.date_to"/></h4> <h4>Paie du <span t-field="o.date_from"/> au <span t-field="o.date_to"/></h4>
</div> </div>
<div class="col-xs-4 pull-right"> <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> <tr>
<td> <td>
<div t-field="o.employee_id.company_id.partner_id" <div t-field="o.employee_id.company_id.partner_id"
+3 -1
View File
@@ -88,7 +88,9 @@ class Users(models.Model):
params['forum_id'] = forum_id params['forum_id'] = forum_id
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url') base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
token_url = base_url + '/forum/validate_email?%s' % urls.url_encode(params) token_url = base_url + '/forum/validate_email?%s' % urls.url_encode(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 return True
@api.one @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
+24
View File
@@ -202,6 +202,30 @@ class TestORM(TransactionCase):
group_user.write({'users': [(3, user.id)]}) group_user.write({'users': [(3, user.id)]})
self.assertTrue(user.share) 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): class TestInherits(TransactionCase):
""" test the behavior of the orm for models that use _inherits; """ test the behavior of the orm for models that use _inherits;
+1 -2
View File
@@ -2922,9 +2922,8 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
# Delete the records' properties. # Delete the records' properties.
with self.env.norecompute(): with self.env.norecompute():
self.env['ir.property'].search([('res_id', 'in', refs)]).unlink()
self.check_access_rule('unlink') self.check_access_rule('unlink')
self.env['ir.property'].search([('res_id', 'in', refs)]).sudo().unlink()
cr = self._cr cr = self._cr
Data = self.env['ir.model.data'].sudo().with_context({}) Data = self.env['ir.model.data'].sudo().with_context({})