mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] purchase_unreconciled: Migration to 17.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
|
||||
{
|
||||
"name": "Purchase Unreconciled",
|
||||
"version": "16.0.1.0.0",
|
||||
"version": "17.0.1.0.0",
|
||||
"author": "ForgeFlow S.L., Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/account-financial-tools",
|
||||
"category": "Purchases",
|
||||
|
||||
@@ -86,5 +86,5 @@ class AccountMoveLine(models.Model):
|
||||
)
|
||||
move.action_post()
|
||||
return move.line_ids.filtered(
|
||||
lambda l: l.account_id.id == counterpart_account.id
|
||||
lambda line: line.account_id.id == counterpart_account.id
|
||||
)
|
||||
|
||||
@@ -130,8 +130,9 @@ class PurchaseOrder(models.Model):
|
||||
group["purchase_line_id"][0] if group["purchase_line_id"] else False
|
||||
)
|
||||
unreconciled_items_group = unreconciled_items.filtered(
|
||||
lambda l: (
|
||||
l.account_id.id == account_id and l.product_id.id == product_id
|
||||
lambda line, account_id=account_id, product_id=product_id: (
|
||||
line.account_id.id == account_id
|
||||
and line.product_id.id == product_id
|
||||
)
|
||||
)
|
||||
# Check which type of force reconciling we are doing:
|
||||
@@ -139,8 +140,9 @@ class PurchaseOrder(models.Model):
|
||||
# - Force reconciling amount_residual_currency
|
||||
amount_residual_currency_reconcile = any(
|
||||
unreconciled_items_group.filtered(
|
||||
lambda l: l.amount_residual_currency != 0.0
|
||||
and l.account_id.id == account_id
|
||||
lambda item_group,
|
||||
account_id=account_id: item_group.amount_residual_currency != 0.0
|
||||
and item_group.account_id.id == account_id
|
||||
)
|
||||
)
|
||||
if amount_residual_currency_reconcile:
|
||||
@@ -165,7 +167,9 @@ class PurchaseOrder(models.Model):
|
||||
# Check if reconciliation is total or needs an exchange rate entry to be
|
||||
# created
|
||||
if moves_to_reconcile:
|
||||
moves_to_reconcile.filtered(lambda l: not l.reconciled).reconcile()
|
||||
moves_to_reconcile.filtered(
|
||||
lambda move: not move.reconciled
|
||||
).reconcile()
|
||||
reconciled_ids = unreconciled_items | all_writeoffs
|
||||
res = {
|
||||
"name": _("Reconciled journal items"),
|
||||
|
||||
@@ -194,10 +194,11 @@ class TestPurchaseUnreconciled(SingleTransactionCase):
|
||||
def _do_picking(self, picking, date):
|
||||
"""Do picking with only one move on the given date."""
|
||||
picking.action_confirm()
|
||||
picking.action_assign()
|
||||
for move in picking.move_ids:
|
||||
move.quantity_done = move.product_uom_qty
|
||||
move.quantity = move.product_uom_qty
|
||||
move.date = date
|
||||
picking._action_done()
|
||||
picking.button_validate()
|
||||
|
||||
def test_01_nothing_to_reconcile(self):
|
||||
po = self.po
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
groups="account.group_account_manager"
|
||||
class="oe_stat_button"
|
||||
icon="fa-gears"
|
||||
attrs="{'invisible':[('unreconciled', '=', False)]}"
|
||||
invisible="not unreconciled"
|
||||
>
|
||||
</button>
|
||||
<button
|
||||
@@ -26,7 +26,7 @@
|
||||
groups="account.group_account_manager"
|
||||
class="oe_stat_button"
|
||||
icon="fa-link"
|
||||
attrs="{'invisible':['|',('unreconciled', '=', False), ('state', '!=', 'done')]}"
|
||||
invisible="not unreconciled or state != 'done'"
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -5,61 +5,25 @@
|
||||
<field name="model">res.config.settings</field>
|
||||
<field name="inherit_id" ref="account.res_config_settings_view_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@id='bank_cash']" position="after">
|
||||
<h2>Purchase Reconciling</h2>
|
||||
<div
|
||||
class="row mt16 o_settings_container"
|
||||
id="account_purchase_unreconciled"
|
||||
>
|
||||
<div
|
||||
class="col-xs-12 col-md-6 o_setting_box"
|
||||
id="purchase_reconcile_account"
|
||||
<xpath expr="//block[@id='bank_cash']/.." position="after">
|
||||
<block title="Purchase Reconciling" id="purchase_reconcile">
|
||||
<setting
|
||||
id="purchase_lock_auto_reconcile"
|
||||
help="Reconcile PO upon locking"
|
||||
company_dependent="1"
|
||||
>
|
||||
|
||||
<div>
|
||||
<div class="o_setting_left_pane">
|
||||
<field name="purchase_lock_auto_reconcile" />
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="purchase_lock_auto_reconcile" />
|
||||
<span
|
||||
class="fa fa-lg fa-building-o"
|
||||
title="Values set here are company-specific."
|
||||
role="img"
|
||||
aria-label="Values set here are company-specific."
|
||||
groups="base.group_multi_company"
|
||||
/>
|
||||
<div class="text-muted">
|
||||
Reconcile PO upon locking
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
<div class="o_setting_right_pane">
|
||||
<label for="purchase_reconcile_account_id" />
|
||||
<div class="content-group">
|
||||
<field
|
||||
name="purchase_reconcile_account_id"
|
||||
class="o_light_label mt16"
|
||||
/>
|
||||
</div>
|
||||
<label for="purchase_reconcile_journal_id" />
|
||||
<div class="content-group">
|
||||
<field
|
||||
name="purchase_reconcile_journal_id"
|
||||
class="o_light_label mt16"
|
||||
/>
|
||||
</div>
|
||||
<label for="purchase_reconcile_tolerance" />
|
||||
<div class="content-group">
|
||||
<field
|
||||
name="purchase_reconcile_tolerance"
|
||||
class="o_light_label mt16"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<field name="purchase_lock_auto_reconcile" />
|
||||
</setting>
|
||||
<setting id="purchase_reconcile_account_id">
|
||||
<field name="purchase_reconcile_account_id" />
|
||||
</setting>
|
||||
<setting id="purchase_reconcile_journal_id">
|
||||
<field name="purchase_reconcile_journal_id" />
|
||||
</setting>
|
||||
<setting id="purchase_reconcile_tolerance">
|
||||
<field name="purchase_reconcile_tolerance" />
|
||||
</setting>
|
||||
</block>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user