[REM] Remove scrap functionality
This commit is contained in:
parent
57de0cd91d
commit
f113b10d44
@ -25,7 +25,6 @@ Keeps track of depreciations, and creates corresponding journal entries.
|
|||||||
'data/account_asset_data.xml',
|
'data/account_asset_data.xml',
|
||||||
'wizard/asset_modify_views.xml',
|
'wizard/asset_modify_views.xml',
|
||||||
'wizard/sale_asset_wizard_view.xml',
|
'wizard/sale_asset_wizard_view.xml',
|
||||||
'wizard/scrap_asset_wizard_view.xml',
|
|
||||||
'wizard/asset_depreciation_summary_wizard_view.xml',
|
'wizard/asset_depreciation_summary_wizard_view.xml',
|
||||||
'views/account_asset_views.xml',
|
'views/account_asset_views.xml',
|
||||||
'views/account_invoice_views.xml',
|
'views/account_invoice_views.xml',
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 23 KiB |
Binary file not shown.
Before Width: | Height: | Size: 31 KiB |
@ -240,48 +240,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="container">
|
|
||||||
<div class="row oe_spaced">
|
|
||||||
<h3 class="oe_slogan">Scrap Asset</h3>
|
|
||||||
<div class="oe_span12">
|
|
||||||
<div class="oe_demo oe_picture oe_screenshot">
|
|
||||||
<img src="account_asset_sc_10.png">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="container">
|
|
||||||
<div class="row oe_spaced">
|
|
||||||
<div class="oe_span12">
|
|
||||||
<p class="mt32 text-justify">
|
|
||||||
If your products that are damaged or that are unusable then you can use Scrap.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="container">
|
|
||||||
<div class="row oe_spaced">
|
|
||||||
<h3 class="oe_slogan">Scrap Details</h3>
|
|
||||||
<div class="oe_span12">
|
|
||||||
<div class="oe_demo oe_picture oe_screenshot">
|
|
||||||
<img src="account_asset_sc_11.png">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="container">
|
|
||||||
<div class="row oe_spaced">
|
|
||||||
<div class="oe_span12">
|
|
||||||
<p class="mt32 text-justify">
|
|
||||||
Just define the details related to Scrap Product. Once product is scrap it become Inactive.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section class="container">
|
<section class="container">
|
||||||
<div class="row oe_spaced">
|
<div class="row oe_spaced">
|
||||||
<h3 class="oe_slogan">Report</h3>
|
<h3 class="oe_slogan">Report</h3>
|
||||||
|
@ -118,23 +118,6 @@ class TestAccountAsset(common.TransactionCase):
|
|||||||
else:
|
else:
|
||||||
logging.info("Asset Sale Function successfully executed")
|
logging.info("Asset Sale Function successfully executed")
|
||||||
|
|
||||||
scrap_asset_id = self.env['scrap.asset.wizard'].create({
|
|
||||||
'partner_id': self.asset_id_1.partner_id.id,
|
|
||||||
'asset_id': self.asset_id_1.id,
|
|
||||||
'product_id': self.asset_id_1.product_id.id,
|
|
||||||
'asset_category_id': self.asset_id_1.category_id.id,
|
|
||||||
'depreciated_amount': self.asset_id_1.remaining_asset_value,
|
|
||||||
'sale_date': date.today(),
|
|
||||||
})
|
|
||||||
|
|
||||||
scrap_asset_id.with_context(
|
|
||||||
{'active_id': self.asset_id_1.id}).do_scrap()
|
|
||||||
|
|
||||||
if self.asset_id_1.state != 'close':
|
|
||||||
raise AssertionError("Asset is not moved to scrap location")
|
|
||||||
else:
|
|
||||||
logging.info("Asset scrap function successfully executed")
|
|
||||||
|
|
||||||
# Check Fiscal Year
|
# Check Fiscal Year
|
||||||
account_config = self.env['res.config.settings'].create({
|
account_config = self.env['res.config.settings'].create({
|
||||||
'fiscalyear_last_month': 3,
|
'fiscalyear_last_month': 3,
|
||||||
|
@ -148,17 +148,6 @@
|
|||||||
'default_depreciated_amount': remaining_asset_value,
|
'default_depreciated_amount': remaining_asset_value,
|
||||||
'default_sale_value': remaining_asset_value,
|
'default_sale_value': remaining_asset_value,
|
||||||
}"/>
|
}"/>
|
||||||
<button name="%(asset_scrap_action)d" type="action" string="Scrap" class="oe_highlight"
|
|
||||||
context="{
|
|
||||||
'default_product_id': product_id,
|
|
||||||
'default_asset_category_id': category_id,
|
|
||||||
'default_asset_id': active_id,
|
|
||||||
'default_depreciated_amount': remaining_asset_value,
|
|
||||||
'default_sale_value': remaining_asset_value,
|
|
||||||
'default_partner_id': partner_id,
|
|
||||||
}"
|
|
||||||
attrs="{'invisible': [('state', '!=', 'open')]}"
|
|
||||||
/>
|
|
||||||
<button type="object" name="compute_depreciation_board" string="Compute Depreciation" states="draft"/>
|
<button type="object" name="compute_depreciation_board" string="Compute Depreciation" states="draft"/>
|
||||||
<button name="set_to_close" states="open" string="Sell or Dispose" type="object" class="oe_highlight" invisible="1"/>
|
<button name="set_to_close" states="open" string="Sell or Dispose" type="object" class="oe_highlight" invisible="1"/>
|
||||||
<button name="set_to_draft" string="Set to Draft" type="object" attrs="{'invisible': ['|', ('entry_count', '!=', 0), ('state', '!=', 'open')]}"/>
|
<button name="set_to_draft" string="Set to Draft" type="object" attrs="{'invisible': ['|', ('entry_count', '!=', 0), ('state', '!=', 'open')]}"/>
|
||||||
|
@ -4,5 +4,4 @@
|
|||||||
from . import asset_depreciation_confirmation_wizard
|
from . import asset_depreciation_confirmation_wizard
|
||||||
from . import asset_modify
|
from . import asset_modify
|
||||||
from . import sale_asset_wizard
|
from . import sale_asset_wizard
|
||||||
from . import scrap_asset_wizard
|
|
||||||
from . import asset_depreciation_summary
|
from . import asset_depreciation_summary
|
@ -1,44 +0,0 @@
|
|||||||
# Part of Flectra. See LICENSE file for full copyright and licensing
|
|
||||||
# details.
|
|
||||||
|
|
||||||
from flectra import fields, models, api
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
|
|
||||||
class ScrapAssetWizard(models.TransientModel):
|
|
||||||
_name = "scrap.asset.wizard"
|
|
||||||
|
|
||||||
partner_id = fields.Many2one('res.partner', 'Partner', required=True)
|
|
||||||
asset_id = fields.Many2one("account.asset.asset", string="Asset")
|
|
||||||
asset_category_id = fields.Many2one("account.asset.category",
|
|
||||||
string="Asset Category", required=True)
|
|
||||||
product_id = fields.Many2one("product.product", string="Product",
|
|
||||||
required=True)
|
|
||||||
depreciated_amount = fields.Float(string="Depreciated Amount",
|
|
||||||
required=True)
|
|
||||||
sale_date = fields.Date(
|
|
||||||
string="Date", default=lambda self: datetime.today(),
|
|
||||||
required=True)
|
|
||||||
|
|
||||||
financial_move = fields.Boolean(string="Create Financial Move")
|
|
||||||
journal_id = fields.Many2one("account.journal", string="Payment Journal",
|
|
||||||
domain=[('type', 'in', ('bank', 'cash'))])
|
|
||||||
amount = fields.Float(string="Payment Amount")
|
|
||||||
|
|
||||||
@api.multi
|
|
||||||
def do_scrap(self):
|
|
||||||
asset_id = self.env['account.asset.asset'].browse(
|
|
||||||
self._context['active_id'])
|
|
||||||
|
|
||||||
if asset_id:
|
|
||||||
asset_id.write({
|
|
||||||
'active': False,
|
|
||||||
'state': 'close'
|
|
||||||
})
|
|
||||||
depreciation_line_ids = self.env[
|
|
||||||
'account.asset.depreciation.line'].search(
|
|
||||||
[('asset_id', '=', asset_id.id), ('move_check', '=', False)])
|
|
||||||
|
|
||||||
if depreciation_line_ids:
|
|
||||||
depreciation_line_ids.unlink()
|
|
||||||
return True
|
|
@ -1,36 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<flectra>
|
|
||||||
<record id="asset_scrap_form_view" model="ir.ui.view">
|
|
||||||
<field name="name">scrap.asset.wizard</field>
|
|
||||||
<field name="model">scrap.asset.wizard</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<form>
|
|
||||||
<group col="4">
|
|
||||||
<field name="partner_id"/>
|
|
||||||
<field name="asset_id" readonly="1"/>
|
|
||||||
<field name="product_id"/>
|
|
||||||
<field name="asset_category_id"/>
|
|
||||||
<field name="depreciated_amount"/>
|
|
||||||
<field name="sale_date"/>
|
|
||||||
</group>
|
|
||||||
<footer>
|
|
||||||
<button name="do_scrap" string="Confirm"
|
|
||||||
type="object"
|
|
||||||
class="oe_highlight" context="{}"/>
|
|
||||||
<button string="Cancel" class="oe_highlight"
|
|
||||||
special="cancel"/>
|
|
||||||
</footer>
|
|
||||||
</form>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
<record id="asset_scrap_action" model="ir.actions.act_window">
|
|
||||||
<field name="name">Scrap Asset</field>
|
|
||||||
<field name="type">ir.actions.act_window</field>
|
|
||||||
<field name="res_model">scrap.asset.wizard</field>
|
|
||||||
<field name="view_type">form</field>
|
|
||||||
<field name="view_mode">form</field>
|
|
||||||
<field name="target">new</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</flectra>
|
|
Loading…
Reference in New Issue
Block a user