Skip to content

Commit

Permalink
[MIG] account_invoice_commission: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pablohmontenegro committed Dec 7, 2023
1 parent 8fad14f commit 39f60cd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions account_invoice_commission/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Commission Invoices',
'version': "16.0.1.0.0",
'version': "17.0.1.0.0",
'category': 'Accounting',
'sequence': 14,
'summary': '',
Expand All @@ -40,7 +40,7 @@
],
'test': [
],
'installable': False,
'installable': True,
'auto_install': False,
'application': False,
}
3 changes: 1 addition & 2 deletions account_invoice_commission/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ class AccountMove(models.Model):
domain=[('move_type', 'in', ('out_invoice', 'out_refund'))],
string='Commissioned invoices',
readonly=True,
states={'draft': [('readonly', False)]},
help='The invoices that this commission invoice is commissioning',
copy=False,
)
Expand Down Expand Up @@ -69,7 +68,7 @@ def _compute_date_last_payment(self):
@api.depends('invoice_line_ids.commission_amount')
@api.depends_context('commissioned_partner_id')
def _compute_commission_amount(self):
commissioned_partner_id = self._context.get('commissioned_partner_id')
commissioned_partner_id = self.invoice_user_id.partner_id.id
if commissioned_partner_id:
_logger.info('Computing commission amount')
for rec in self:
Expand Down
2 changes: 1 addition & 1 deletion account_invoice_commission/models/account_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AccountMoveLine(models.Model):
)

def _compute_commission_amount(self):
commissioned_partner_id = self._context.get('commissioned_partner_id')
commissioned_partner_id = self.move_id.invoice_user_id.partner_id.id
if commissioned_partner_id:
today = fields.Date.context_today(self)
rules = self.env['account.commission.rule']
Expand Down
10 changes: 5 additions & 5 deletions account_invoice_commission/views/account_move_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
<field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml">
<xpath expr="//sheet//field[@name='date']" position="after">
<field name="partner_user_id" attrs="{'invisible': [('move_type', 'not in', ('in_invoice', 'in_refund', 'in_receipt'))]}"/>
<field name="date_last_payment" states="open,paid"/>
<field name="partner_user_id" invisible="move_type not in ('in_invoice', 'in_refund', 'in_receipt')"/>
<field name="date_last_payment" invisible="state not in ('open', 'paid')"/>
</xpath>
<notebook>
<page string="Commissions" attrs="{'invisible': [('move_type', 'in', ('in_invoice', 'in_refund', 'in_receipt'))]}">
<page string="Commissions" invisible="move_type in ('in_invoice', 'in_refund', 'in_receipt')">
<field name="commission_invoice_ids"/>
</page>
<page string="Commission" attrs="{'invisible': [('move_type', 'in', ('out_invoice', 'out_refund', 'out_receipt'))]}">
<field name="commissioned_invoice_ids" context="{'commissioned_partner_id': partner_id, 'tree_view_ref':'account_invoice_commission.view_invoice_tree', 'form_view_ref':'account.move_form', 'search_default_not_commissioned': True, 'search_default_closed': 1, 'search_default_invoice_user_id': partner_user_id, 'default_move_type': 'out_invoice'}"/>
<page string="Commission" invisible="move_type in ('out_invoice', 'out_refund', 'out_receipt')">
<field name="commissioned_invoice_ids" context="{'commissioned_partner_id': partner_id, 'tree_view_ref':'account_invoice_commission.view_invoice_tree', 'form_view_ref':'account.move_form', 'search_default_not_commissioned': True, 'search_default_closed': 1, 'search_default_invoice_user_id': partner_user_id, 'default_move_type': 'out_invoice'}" readonly="state != 'draft'"/>
</page>
</notebook>
<xpath expr="//field[@name='invoice_line_ids']/tree" position="inside">
Expand Down

0 comments on commit 39f60cd

Please sign in to comment.