[TMP] beginning of state of last invoice

This commit is contained in:
michel 2018-02-09 14:30:08 +01:00
parent 5f8433e112
commit 1531a3c7b8
3 changed files with 16 additions and 10 deletions

View File

@ -103,15 +103,6 @@ class GolemMember(models.Model):
is_number_manual = fields.Boolean('Is number manual?', store=False, is_number_manual = fields.Boolean('Is number manual?', store=False,
compute='_compute_is_number_manual') compute='_compute_is_number_manual')
image_permission = fields.Boolean('Image permission?', default=True) 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') @api.onchange('country_id')
def _onchange_country_id(self): def _onchange_country_id(self):

View File

@ -33,7 +33,17 @@ class GolemMember(models.Model):
""" Open invoices member """ """ Open invoices member """
self.ensure_one() self.ensure_one()
return {'type': 'ir.actions.act_window', return {'type': 'ir.actions.act_window',
'name': 'Invoices',
'res_model': 'account.invoice', 'res_model': 'account.invoice',
'view_mode': 'tree', 'view_mode': 'tree,form',
'context': {'search_default_partner_id': self.partner_id.id, 'context': {'search_default_partner_id': self.partner_id.id,
'default_partner_id': self.partner_id.id}} 'default_partner_id': self.partner_id.id}}
# state_invoice = fields.One2many(related='member_id.invoice_ids')
state_last_invoice = fields.Char(compute='_compute_state_of_last_invoice')
@api.depends('invoice_ids')
def _compute_state_of_last_invoice(self):
for member in self:
if mem.invoice_ids.state == 'open':

View File

@ -35,10 +35,15 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<span class="o_stat_value"> <span class="o_stat_value">
<field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/></span> <field name="total_invoiced" widget='monetary' options="{'currency_field': 'currency_id'}"/></span>
<span class="o_stat_text">Invoiced</span> <span class="o_stat_text">Invoiced</span>
</div> </div>
</button> </button>
</div> </div>
</div> </div>
<field name="season_ids" position="before">
<field name="state_last_invoice" />
</field>
</field> </field>
</record> </record>