[IMP] base: Display 'Contains In-App Purchases' on module form views

Purpose
=======

There are no mentions that a module may contain In-App Purchases in Apps.
We should inform the users of this so they make a conscious decision when
installing such app.

closes odoo/odoo#40731

Taskid: 2129214
Signed-off-by: Yannick Tivisse (yti) <yti@odoo.com>
This commit is contained in:
Yannick Tivisse
2019-11-29 14:03:41 +00:00
parent dec397b86d
commit 4411cedde8
2 changed files with 7 additions and 0 deletions
+5
View File
@@ -294,11 +294,16 @@ class Module(models.Model):
icon = fields.Char('Icon URL')
icon_image = fields.Binary(string='Icon', compute='_get_icon_image')
to_buy = fields.Boolean('Odoo Enterprise Module', default=False)
has_iap = fields.Boolean(compute='_compute_has_iap')
_sql_constraints = [
('name_uniq', 'UNIQUE (name)', 'The name of the module must be unique!'),
]
def _compute_has_iap(self):
for module in self:
module.has_iap = 'iap' in module.upstream_dependencies(exclude_states=('',)).mapped('name')
def unlink(self):
if not self:
return True
@@ -75,12 +75,14 @@
<button name="button_upgrade_cancel" states="to upgrade" string="Cancel Upgrade" type="object" class="btn btn-secondary mr-1"/>
<button name="button_install_cancel" states="to install" string="Cancel Install" type="object" class="btn btn-secondary mr-1"/>
</div>
<h6 class="text-muted mt-2" attrs="{'invisible': [('has_iap', '=', False)]}">Contains In-App Purchases</h6>
</div>
<div class="oe_clear"/>
<notebook groups="base.group_no_one">
<page string="Information">
<group>
<group>
<field name="has_iap" invisible="1"/>
<field name="website" widget="url" attrs="{'invisible':[('website','=',False)]}"/>
<field name="category_id" widget="selection"/>
<field name="summary"/>