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
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -17,7 +17,7 @@ class AccountMove(models.Model): ...@@ -17,7 +17,7 @@ class AccountMove(models.Model):
# Fields declaration # Fields declaration
# ------------------------------------------------------ # ------------------------------------------------------
is_fee = fields.Boolean( is_fee = fields.Boolean(
string="Redevance", string="Est une redevance",
related="journal_id.is_fee", related="journal_id.is_fee",
readonly=True, readonly=True,
store=True, store=True,
...@@ -39,6 +39,7 @@ class AccountMove(models.Model): ...@@ -39,6 +39,7 @@ class AccountMove(models.Model):
compute="_compute_fee_state", compute="_compute_fee_state",
store=True, store=True,
) )
end_fee_reason = fields.Char(string="Raison du non renouvellement")
# ------------------------------------------------------ # ------------------------------------------------------
# Computed fields / Search Fields # Computed fields / Search Fields
...@@ -77,6 +78,7 @@ class AccountMove(models.Model): ...@@ -77,6 +78,7 @@ class AccountMove(models.Model):
""" """
Create new invoice with start and end fee dates Create new invoice with start and end fee dates
""" """
self.ensure_one()
new_start_fee = self.end_fee + relativedelta(days=1) new_start_fee = self.end_fee + relativedelta(days=1)
new_end_fee = self.end_fee + relativedelta(years=1) new_end_fee = self.end_fee + relativedelta(years=1)
next_fee_id = self.copy( next_fee_id = self.copy(
...@@ -98,6 +100,12 @@ class AccountMove(models.Model): ...@@ -98,6 +100,12 @@ class AccountMove(models.Model):
"target": "current", "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 # Business methods
# ------------------------------------------------------ # ------------------------------------------------------
......
...@@ -42,16 +42,16 @@ ...@@ -42,16 +42,16 @@
<group> <group>
<field <field
name="is_fee" name="is_fee"
attrs="{'readonly': [('move_type', '=', 'posted')]}" attrs="{'readonly': [('state', '=', 'posted')]}"
groups="base.group_no_one" groups="base.group_no_one"
/> />
<field <field
name="start_fee" 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 <field
name="end_fee" 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>
<group> <group>
...@@ -64,6 +64,19 @@ ...@@ -64,6 +64,19 @@
name="fee_state" name="fee_state"
attrs="{'invisible': [('state', '!=', 'posted')]}" 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>
</group> </group>
</xpath> </xpath>
...@@ -119,7 +132,21 @@ ...@@ -119,7 +132,21 @@
</record> </record>
<!-- Pivot view --> <!-- 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> </data>
</odoo> </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