Skip to content

Commit

Permalink
[IMP] account: allow to reorder payment terms
Browse files Browse the repository at this point in the history
  • Loading branch information
dpa-odoo authored and rim-odoo committed Aug 8, 2017
1 parent 24c6e98 commit 31e4675
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addons/account/models/account_invoice.py
Expand Up @@ -1520,7 +1520,7 @@ def _compute_base_amount(self):
class AccountPaymentTerm(models.Model):
_name = "account.payment.term"
_description = "Payment Terms"
_order = "name"
_order = "sequence, id"

def _default_line_ids(self):
return [(0, 0, {'value': 'balance', 'value_amount': 0.0, 'sequence': 9, 'days': 0, 'option': 'day_after_invoice_date'})]
Expand All @@ -1530,6 +1530,7 @@ def _default_line_ids(self):
note = fields.Text(string='Description on the Invoice', translate=True)
line_ids = fields.One2many('account.payment.term.line', 'payment_id', string='Terms', copy=True, default=_default_line_ids)
company_id = fields.Many2one('res.company', string='Company', required=True, default=lambda self: self.env.user.company_id)
sequence = fields.Integer(required=True, default=10)

@api.constrains('line_ids')
@api.one
Expand Down
10 changes: 10 additions & 0 deletions addons/account/views/account_view.xml
Expand Up @@ -1606,6 +1606,16 @@
</search>
</field>
</record>
<record id="view_payment_term_tree" model="ir.ui.view">
<field name="name">account.payment.term.tree</field>
<field name="model">account.payment.term</field>
<field name="arch" type="xml">
<tree string="Payment Terms">
<field name="sequence" widget="handle"/>
<field name="name"/>
</tree>
</field>
</record>
<record id="view_payment_term_form" model="ir.ui.view">
<field name="name">account.payment.term.form</field>
<field name="model">account.payment.term</field>
Expand Down

0 comments on commit 31e4675

Please sign in to comment.