[TMP] Button style and currency

This commit is contained in:
michel 2018-02-08 10:18:04 +01:00
parent 7e236226b7
commit 8c102ff103
2 changed files with 24 additions and 12 deletions

View File

@ -66,6 +66,7 @@ class ResPartner(models.Model):
gm_obj = self.env['golem.member']
gm_obj.create({'partner_id': self[0].id})
class GolemMember(models.Model):
""" GOLEM Member model """
_name = 'golem.member'
@ -102,6 +103,15 @@ class GolemMember(models.Model):
is_number_manual = fields.Boolean('Is number manual?', store=False,
compute='_compute_is_number_manual')
image_permission = fields.Boolean('Image permission?', default=True)
currency_id = fields.Many2one('res.currency', compute='_get_company_currency',
string="Currency")
@api.one
def _get_company_currency(self):
if self.company_id:
self.currency_id = self.sudo().company_id.currency_id
else:
self.currency_id = self.env.user.company_id.currency_id
@api.onchange('country_id')
def _onchange_country_id(self):

View File

@ -28,17 +28,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<sheet>
<div colspan="2"
style="background-color: #ccc; color: #fff; font-size: 150%; font-weight: bold; padding: 0.5%; text-align: center; margin-bottom: 1%;">Member form</div>
<div name="button_box" position="inside">
<button type="object" class="oe_stat_button" id="invoice_button"
icon="fa-pencil-square-o" name="open_partner_invoices"
attrs="{'invisible': [('free_member', '=', True)]}"
context="{'default_partner_id': active_id}">
<div class="o_form_field o_stat_info">
<span class="o_stat_value"><field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/></span>
<span class="o_stat_text">Invoiced</span>
</div>
</button>
</div>
<div class="oe_button_box" name="button_box">
<button type="object" class="oe_stat_button" id="invoice_button"
icon="fa-pencil-square-o" name="open_partner_invoices"
attrs="{'invisible': [('free_member', '=', True)]}"
context="{'default_partner_id': active_id}">
<div class="o_form_field o_stat_info">
<span class="o_stat_value">
<field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/></span>
<span class="o_stat_text">Invoiced</span>
</div>
</button>
</div>
<group>
<div class="oe_title">
<h1>
@ -53,7 +55,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="season_ids" widget="many2many_tags" />
<field name="category_id" widget="many2many_tags"
placeholder="Tags..."/>
<field name="partner_id" />
<field name="currency_id" invisible="1"/>
</group>
</group>
<group string="Personal details">