Skip to content
Extraits de code Groupes Projets
Valider 93eabb6f rédigé par Benjamin - Le Filament's avatar Benjamin - Le Filament
Parcourir les fichiers

[UPD] add pivot view and end reason fee field

parent 0c5e136c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -17,7 +17,7 @@ class AccountMove(models.Model):
# Fields declaration
# ------------------------------------------------------
is_fee = fields.Boolean(
string="Redevance",
string="Est une redevance",
related="journal_id.is_fee",
readonly=True,
store=True,
......@@ -39,6 +39,7 @@ class AccountMove(models.Model):
compute="_compute_fee_state",
store=True,
)
end_fee_reason = fields.Char(string="Raison du non renouvellement")
# ------------------------------------------------------
# Computed fields / Search Fields
......@@ -77,6 +78,7 @@ class AccountMove(models.Model):
"""
Create new invoice with start and end fee dates
"""
self.ensure_one()
new_start_fee = self.end_fee + relativedelta(days=1)
new_end_fee = self.end_fee + relativedelta(years=1)
next_fee_id = self.copy(
......@@ -98,6 +100,12 @@ class AccountMove(models.Model):
"target": "current",
}
def action_not_renewed(self):
self.ensure_one()
if self.next_fee_id:
self.next_fee_id.unlink()
self.fee_state = "not_renewed"
# ------------------------------------------------------
# Business methods
# ------------------------------------------------------
......
......@@ -42,16 +42,16 @@
<group>
<field
name="is_fee"
attrs="{'readonly': [('move_type', '=', 'posted')]}"
attrs="{'readonly': [('state', '=', 'posted')]}"
groups="base.group_no_one"
/>
<field
name="start_fee"
attrs="{'invisible': [('is_fee', '=', False)], 'required': [('is_fee', '=', True)], 'readonly': [('move_type', '=', 'posted')]}"
attrs="{'invisible': [('is_fee', '=', False)], 'required': [('is_fee', '=', True)], 'readonly': [('state', '=', 'posted')]}"
/>
<field
name="end_fee"
attrs="{'invisible': [('is_fee', '=', False)], 'required': [('is_fee', '=', True)], 'readonly': [('move_type', '=', 'posted')]}"
attrs="{'invisible': [('is_fee', '=', False)], 'required': [('is_fee', '=', True)], 'readonly': [('state', '=', 'posted')]}"
/>
</group>
<group>
......@@ -64,6 +64,19 @@
name="fee_state"
attrs="{'invisible': [('state', '!=', 'posted')]}"
/>
<div colspan="2">
<button
name="action_not_renewed"
type="object"
string="Non renouvellement"
attrs="{'invisible': [('fee_state', 'not in', ['to_renew', 'renewing'])]}"
confirm="Valider le non renouvellement de cette redevance ?"
/>
</div>
<field
name="end_fee_reason"
attrs="{'invisible': [('fee_state', '!=', 'not_renewed')]}"
/>
</group>
</group>
</xpath>
......@@ -119,7 +132,21 @@
</record>
<!-- Pivot view -->
<record id="afac_fee_account_invoice_view_pivot" model="ir.ui.view">
<field name="name">account.invoice.pivot</field>
<field name="model">account.move</field>
<field name="arch" type="xml">
<pivot string="Factures">
<field name="is_fee" type="col" />
<field name="invoice_date" type="row" />
<field name="amount_total_signed" type="measure" />
</pivot>
</field>
</record>
<!-- Action view -->
<!-- Action view : add pivot view -->
<record id="account.action_move_out_invoice_type" model="ir.actions.act_window">
<field name="view_mode">tree,kanban,pivot,form</field>
</record>
</data>
</odoo>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter