[MIG] stock_cycle_count: Migration to 13.0

This commit is contained in:
jim.hoefnagels
2020-02-05 11:26:32 +01:00
committed by Lois Rilo
parent 186249ba66
commit 414c3bc89a
23 changed files with 309 additions and 299 deletions

View File

@@ -0,0 +1 @@
../../../../stock_cycle_count

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)

View File

@@ -1,14 +1,14 @@
# Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
# (http://www.eficent.com)
# Copyright 2017-18 ForgeFlow Business and IT Consulting Services S.L.
# (http://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Stock Cycle Count",
"summary": "Adds the capability to schedule cycle counts in a "
"warehouse through different rules defined by the user.",
"version": "12.0.1.0.1",
"version": "13.0.1.0.0",
"development_status": "Mature",
"maintainers": ["lreficent"],
"author": "Eficent, " "Odoo Community Association (OCA)",
"maintainers": ["LoisRForgeFlow"],
"author": "ForgeFlow, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"category": "Warehouse Management",
"depends": [

View File

@@ -1,20 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record forcecreate="True"
id="ir_cron_compute_cycle_count_action" model="ir.cron">
<record forcecreate="True" id="ir_cron_compute_cycle_count_action" model="ir.cron">
<field name="name">Cycle Count Planner Computation</field>
<field name="state">code</field>
<field name="user_id" ref="base.user_root"/>
<field name="user_id" ref="base.user_root" />
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="doall" eval="False"/>
<field name="model_id" ref="stock.model_stock_warehouse"/>
<field name="doall" eval="False" />
<field name="model_id" ref="stock.model_stock_warehouse" />
<field name="code">model.cron_cycle_count()</field>
</record>
</odoo>

View File

@@ -1,15 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record id="seq_cycle_count" model="ir.sequence">
<field name="name">Cycle Count</field>
<field name="code">stock.cycle.count</field>
<field name="prefix">CC/%(range_year)s/</field>
<field name="padding">5</field>
<field name="company_id" eval="False"/>
<field name="company_id" eval="False" />
</record>
</odoo>

View File

@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 12.0\n"
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"

View File

@@ -12,11 +12,6 @@ class StockCycleCount(models.Model):
_inherit = "mail.thread"
_order = "id desc"
@api.model
def _default_company(self):
company_id = self.env["res.company"]._company_default_get(self._name)
return company_id
name = fields.Char(string="Name", readonly=True)
location_id = fields.Many2one(
comodel_name="stock.location",
@@ -68,27 +63,24 @@ class StockCycleCount(models.Model):
comodel_name="res.company",
string="Company",
required=True,
default=_default_company,
default=lambda self: self.env.company,
readonly=True,
)
@api.depends("stock_adjustment_ids")
@api.multi
def _compute_inventory_adj_count(self):
for rec in self:
rec.inventory_adj_count = len(rec.stock_adjustment_ids)
@api.multi
def do_cancel(self):
self.write({"state": "cancelled"})
@api.multi
def _prepare_inventory_adjustment(self):
self.ensure_one()
return {
"name": "INV/{}".format(self.name),
"cycle_count_id": self.id,
"location_id": self.location_id.id,
"location_ids": [(4, self.location_id.id)],
"exclude_sublocation": True,
}
@@ -97,7 +89,6 @@ class StockCycleCount(models.Model):
vals["name"] = self.env["ir.sequence"].next_by_code("stock.cycle.count") or ""
return super(StockCycleCount, self).create(vals)
@api.multi
def action_create_inventory_adjustment(self):
if any([s != "draft" for s in self.mapped("state")]):
raise UserError(_("You can only confirm cycle counts in state 'Planned'."))
@@ -107,7 +98,6 @@ class StockCycleCount(models.Model):
self.write({"state": "open"})
return True
@api.multi
def action_view_inventory(self):
action = self.env.ref("stock.action_inventory_form")
result = action.read()[0]

View File

@@ -12,7 +12,6 @@ class StockCycleCountRule(models.Model):
_name = "stock.cycle.count.rule"
_description = "Stock Cycle Counts Rules"
@api.multi
def _compute_currency_id(self):
for rec in self:
rec.currency_id = self.env.user.company_id.currency_id
@@ -26,7 +25,6 @@ class StockCycleCountRule(models.Model):
("zero", _("Zero Confirmation")),
]
@api.multi
@api.constrains("rule_type", "warehouse_ids")
def _check_zero_rule(self):
for rec in self:
@@ -83,7 +81,6 @@ class StockCycleCountRule(models.Model):
else:
self.rule_description = _("(No description provided.)")
@api.multi
@api.constrains("periodic_qty_per_period", "periodic_count_period")
def _check_negative_periodic(self):
for rec in self:
@@ -174,7 +171,7 @@ class StockCycleCountRule(models.Model):
self.env["stock.inventory"]
.search(
[
("location_id", "=", loc.id),
("location_ids", "in", [loc.id]),
("state", "in", ["confirm", "done", "draft"]),
],
order="date desc",
@@ -231,7 +228,7 @@ class StockCycleCountRule(models.Model):
self.env["stock.inventory"]
.search(
[
("location_id", "=", loc.id),
("location_ids", "in", [loc.id]),
("state", "in", ["confirm", "done", "draft"]),
]
)
@@ -264,7 +261,6 @@ class StockCycleCountRule(models.Model):
cycle_counts.append(cycle_count)
return cycle_counts
@api.multi
def _compute_rule_accuracy(self, locs):
self.ensure_one()
cycle_counts = []

View File

@@ -11,7 +11,6 @@ PERCENT = 100.0
class StockInventory(models.Model):
_inherit = "stock.inventory"
@api.multi
@api.depends("state", "line_ids")
def _compute_inventory_accuracy(self):
for inv in self:
@@ -44,19 +43,16 @@ class StockInventory(models.Model):
inv.cycle_count_id.state = "done"
return True
@api.multi
def action_validate(self):
res = super(StockInventory, self).action_validate()
self._update_cycle_state()
return res
@api.multi
def action_force_done(self):
res = super(StockInventory, self).action_force_done()
self._update_cycle_state()
return res
@api.multi
def write(self, vals):
for inventory in self:
if (

View File

@@ -5,7 +5,7 @@
import logging
from datetime import datetime
from odoo import api, fields, models, tools
from odoo import fields, models, tools
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT
_logger = logging.getLogger(__name__)
@@ -21,13 +21,12 @@ except (ImportError, IOError) as err:
class StockLocation(models.Model):
_inherit = "stock.location"
@api.multi
def _compute_loc_accuracy(self):
for rec in self:
history = self.env["stock.inventory"].search(
[("location_id", "=", rec.id), ("state", "=", "done")]
[("location_ids", "in", rec.id), ("state", "=", "done")],
order="write_date desc",
)
history = history.sorted(key=lambda r: r.write_date, reverse=True)
if history:
wh = rec.get_warehouse()
if (
@@ -41,6 +40,8 @@ class StockLocation(models.Model):
)
else:
rec.loc_accuracy = mean(history.mapped("inventory_accuracy"))
else:
rec.loc_accuracy = 0
zero_confirmation_disabled = fields.Boolean(
string="Disable Zero Confirmations",
@@ -59,13 +60,11 @@ class StockLocation(models.Model):
string="Inventory Accuracy", compute="_compute_loc_accuracy", digits=(3, 2)
)
@api.multi
def _get_zero_confirmation_domain(self):
self.ensure_one()
domain = [("location_id", "=", self.id), ("quantity", ">", 0.0)]
return domain
@api.multi
def check_zero_confirmation(self):
for rec in self:
if not rec.zero_confirmation_disabled:
@@ -81,7 +80,6 @@ class StockLocation(models.Model):
if not quants:
rec.create_zero_confirmation_cycle_count()
@api.multi
def create_zero_confirmation_cycle_count(self):
self.ensure_one()
date = datetime.today().strftime(DEFAULT_SERVER_DATETIME_FORMAT)
@@ -113,7 +111,6 @@ class StockLocation(models.Model):
)
return True
@api.multi
def action_accuracy_stats(self):
self.ensure_one()
action = self.env.ref("stock_cycle_count.act_accuracy_stats")

View File

@@ -3,14 +3,13 @@
# Copyright 2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models
from odoo import models
class StockMove(models.Model):
_inherit = "stock.move"
@api.multi
def _action_done(self):
res = super()._action_done()
def _action_done(self, cancel_backorder=False):
res = super()._action_done(cancel_backorder=cancel_backorder)
self.mapped("location_id").check_zero_confirmation()
return res

View File

@@ -31,7 +31,6 @@ class StockWarehouse(models.Model):
help="Number of latest inventories used to calculate location " "accuracy",
)
@api.multi
def get_horizon_date(self):
self.ensure_one()
date = datetime.today()
@@ -61,7 +60,6 @@ class StockWarehouse(models.Model):
)
return locations
@api.multi
def _cycle_count_rules_to_compute(self):
self.ensure_one()
rules = self.env["stock.cycle.count.rule"].search(
@@ -78,7 +76,6 @@ class StockWarehouse(models.Model):
"state": "draft",
}
@api.multi
def action_compute_cycle_count_rules(self):
""" Apply the rule in all the sublocations of a given warehouse(s) and
returns a list with required dates for the cycle count of each

View File

@@ -1,3 +1,4 @@
* Lois Rilo <lois.rilo@eficent.com>
* Jordi Ballester Alomar <jordi.ballester@eficent.com>
* Bhavesh Odedra <bodedra@opensourceintegrators.com>
* Jim Hoefnagels <jim.hoefnagels@dynapps.be>

View File

@@ -1,3 +1,9 @@
13.0.1.0.0 (2020-02-05)
~~~~~~~~~~~~~~~~~~~~~~~
* [MIG] Migrated to v13.
12.0.1.0.0 (2019-06-24)
~~~~~~~~~~~~~~~~~~~~~~~

View File

@@ -26,7 +26,6 @@ class LocationAccuracyReport(models.AbstractModel):
data[loc] = counts
return data
@api.multi
def render_html(self, data=None):
report_obj = self.env["report"]
locs = self.env["stock.location"].browse(self._ids)

View File

@@ -1,14 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<template id="report_cyclecount">
<t t-call="web.html_container">
<t t-call="web.internal_layout">
<div class="page">
<table class="table table-condensed">
<thead>
<tr>
@@ -18,35 +15,33 @@
<th>Assigned to</th>
<th>Status</th>
</tr>
</thead>
<tbody class="sale_tbody">
</thead>
<tbody class="sale_tbody">
<t t-foreach="docs" t-as="doc">
<tr>
<td>
<span t-field="doc.name"/>
<span t-field="doc.name" />
</td>
<td>
<span t-field="doc.location_id"/>
<span t-field="doc.location_id" />
</td>
<td>
<span t-field="doc.date_deadline"/>
<span t-field="doc.date_deadline" />
</td>
<td>
<span t-field="doc.responsible_id"/>
<span t-field="doc.responsible_id" />
</td>
<td class="text-right">
<span t-field="doc.state"/>
<span t-field="doc.state" />
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</template>
<!-- Report action -->
<report
id="action_report_stock_cycle_count"
@@ -54,6 +49,6 @@
name="stock_cycle_count.report_cyclecount"
string="Cycle Count"
report_type="qweb-pdf"
groups="stock.group_stock_user"/>
groups="stock.group_stock_user"
/>
</odoo>

View File

@@ -1,66 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Templates -->
<template id="stock_location_accuracy">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout">
<div class="page">
<div class="oe_structure"/>
<div class="oe_structure" />
<h3>
<span>Location:</span>
<span t-field="doc.name"/>
<span t-field="doc.name" />
</h3>
<div class="row mt32 mb32" id="informations">
<div class="col-xs-6">
<strong>Complete name:</strong>
<p t-field="doc.complete_name"/>
<p t-field="doc.complete_name" />
</div>
<div class="col-xs-3">
<strong>Current Accuracy:</strong>
<p t-field="doc.loc_accuracy"/>
<p t-field="doc.loc_accuracy" />
</div>
</div>
<table class="table table-condensed">
<thead>
<tr>
<th>Inventory</th>
<th class="text-right">Date</th>
<th class="text-right">Accuracy</th>
</tr>
</thead>
<tbody class="sale_tbody">
</thead>
<tbody class="sale_tbody">
<t t-foreach="data[doc]" t-as="l">
<tr>
<td>
<span t-field="l.name"/>
<span t-field="l.name" />
</td>
<td class="text-right">
<span t-field="l.date"/>
<span t-field="l.date" />
</td>
<td class="text-right">
<span t-field="l.inventory_accuracy"/>
<span t-field="l.inventory_accuracy" />
</td>
</tr>
</t>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
<!-- Report action -->
<report
id="action_report_stock_location_accuracy"
@@ -68,6 +59,6 @@
name="stock_location_accuracy"
string="Accuracy report"
report_type="qweb-pdf"
groups="stock.group_stock_user"/>
groups="stock.group_stock_user"
/>
</odoo>

View File

@@ -70,7 +70,7 @@ class TestStockCycleCount(common.TransactionCase):
self.stock_location_model._parent_store_compute()
# Create a cycle count:
self.cycle_count_1 = self.cycle_count_model.sudo(self.manager).create(
self.cycle_count_1 = self.cycle_count_model.with_user(self.manager).create(
{
"name": "Test cycle count",
"cycle_count_rule_id": self.rule_periodic.id,
@@ -98,7 +98,7 @@ class TestStockCycleCount(common.TransactionCase):
return user
def _create_stock_cycle_count_rule_periodic(self, uid, name, values):
rule = self.stock_cycle_count_rule_model.sudo(uid).create(
rule = self.stock_cycle_count_rule_model.with_user(uid).create(
{
"name": name,
"rule_type": "periodic",
@@ -109,7 +109,7 @@ class TestStockCycleCount(common.TransactionCase):
return rule
def _create_stock_cycle_count_rule_turnover(self, uid, name, values):
rule = self.stock_cycle_count_rule_model.sudo(uid).create(
rule = self.stock_cycle_count_rule_model.with_user(uid).create(
{
"name": name,
"rule_type": "turnover",
@@ -119,7 +119,7 @@ class TestStockCycleCount(common.TransactionCase):
return rule
def _create_stock_cycle_count_rule_accuracy(self, uid, name, values, zone_ids):
rule = self.stock_cycle_count_rule_model.sudo(uid).create(
rule = self.stock_cycle_count_rule_model.with_user(uid).create(
{
"name": name,
"rule_type": "accuracy",
@@ -131,7 +131,7 @@ class TestStockCycleCount(common.TransactionCase):
return rule
def _create_stock_cycle_count_rule_zero(self, uid, name):
rule = self.stock_cycle_count_rule_model.sudo(uid).create(
rule = self.stock_cycle_count_rule_model.with_user(uid).create(
{"name": name, "rule_type": "zero"}
)
return rule
@@ -161,7 +161,11 @@ class TestStockCycleCount(common.TransactionCase):
)
date = datetime.today() - timedelta(days=1)
self.inventory_model.create(
{"name": "Pre-existing inventory", "location_id": loc.id, "date": date}
{
"name": "Pre-existing inventory",
"location_ids": [(4, loc.id)],
"date": date,
}
)
self.quant_model.create(
{
@@ -266,7 +270,7 @@ class TestStockCycleCount(common.TransactionCase):
with self.assertRaises(AccessError):
self._create_stock_cycle_count_rule_periodic(self.user, "rule_1b", [2, 7])
with self.assertRaises(AccessError):
self.cycle_count_1.sudo(self.user).unlink()
self.cycle_count_1.with_user(self.user).unlink()
def test_rule_periodic_constrains(self):
"""Tests the constrains for the periodic rules."""

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Stock Cycle Count Rule List view -->
<record id="stock_cycle_count_rule_tree_view" model="ir.ui.view">
@@ -9,10 +8,10 @@
<field name="model">stock.cycle.count.rule</field>
<field name="arch" type="xml">
<tree string="Stock Cycle Count">
<field name="name"/>
<field name="warehouse_ids"/>
<field name="location_ids"/>
<field name="rule_type"/>
<field name="name" />
<field name="warehouse_ids" />
<field name="location_ids" />
<field name="rule_type" />
</tree>
</field>
</record>
@@ -22,29 +21,38 @@
<field name="model">stock.cycle.count.rule</field>
<field name="arch" type="xml">
<form string="cycle counts test:">
<sheet>
<group name="top">
<group>
<field name="name"/>
<field name="rule_type"/>
<field name="rule_description"/>
<field name="active"/>
<field name="name" />
<field name="rule_type" />
<field name="rule_description" />
<field name="active" />
</group>
<group name="specific rule fields">
<field name="periodic_qty_per_period"
attrs="{'invisible': [('rule_type', '!=', 'periodic')]}"/>
<field name="periodic_count_period"
attrs="{'invisible': [('rule_type', '!=', 'periodic')]}"/>
<field name="turnover_inventory_value_threshold"
attrs="{'invisible': [('rule_type', '!=', 'turnover')]}"
widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="currency_id"
invisible="True"/>
<label for="accuracy_threshold"
attrs="{'invisible': [('rule_type', '!=', 'accuracy')]}"/>
<div attrs="{'invisible': [('rule_type', '!=', 'accuracy')]}">
<field name="accuracy_threshold" class="oe_inline"/> %
<field
name="periodic_qty_per_period"
attrs="{'invisible': [('rule_type', '!=', 'periodic')]}"
/>
<field
name="periodic_count_period"
attrs="{'invisible': [('rule_type', '!=', 'periodic')]}"
/>
<field
name="turnover_inventory_value_threshold"
attrs="{'invisible': [('rule_type', '!=', 'turnover')]}"
widget="monetary"
options="{'currency_field': 'currency_id'}"
/>
<field name="currency_id" invisible="True" />
<label
for="accuracy_threshold"
attrs="{'invisible': [('rule_type', '!=', 'accuracy')]}"
/>
<div
attrs="{'invisible': [('rule_type', '!=', 'accuracy')]}"
>
<field name="accuracy_threshold" class="oe_inline" /> %
</div>
</group>
</group>
@@ -56,31 +64,36 @@
going to the locations form and checking the box
"Exclude from Cycle Count".</p>
<group colspan="2">
<field name="apply_in"/>
<field name="apply_in" />
</group>
<group colspan="2">
<field name="warehouse_ids" widget="many2many_tags"
attrs="{'readonly': [('apply_in', '!=', 'warehouse')]}"/>
<field name="location_ids" widget="many2many_tags"
attrs="{'invisible': [('apply_in', '!=', 'location')]}"/>
<field
name="warehouse_ids"
widget="many2many_tags"
attrs="{'readonly': [('apply_in', '!=', 'warehouse')]}"
/>
<field
name="location_ids"
widget="many2many_tags"
attrs="{'invisible': [('apply_in', '!=', 'location')]}"
/>
</group>
</group>
</sheet>
</form>
</field>
</record>
<!-- Action to open Stock Cycle Count Rule -->
<act_window id="action_stock_cycle_count_rules"
name="Stock Cycle Count Rules"
res_model="stock.cycle.count.rule"
view_mode="tree,form" />
<menuitem id="menu_stock_cycle_count_rule"
name="Cycle Count Rules"
parent="stock.menu_stock_config_settings"
action="action_stock_cycle_count_rules" />
<act_window
id="action_stock_cycle_count_rules"
name="Stock Cycle Count Rules"
res_model="stock.cycle.count.rule"
view_mode="tree,form"
/>
<menuitem
id="menu_stock_cycle_count_rule"
name="Cycle Count Rules"
parent="stock.menu_stock_config_settings"
action="action_stock_cycle_count_rules"
/>
</odoo>

View File

@@ -1,145 +1,181 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<!-- Stock Cycle Count List view -->
<record id="stock_cycle_count_tree_view" model="ir.ui.view">
<field name="name">stock.cycle.count.tree</field>
<field name="model">stock.cycle.count</field>
<field name="arch" type="xml">
<tree string="Stock Cycle Count"
decoration-muted="state == 'cancelled'"
decoration-info="state == 'draft'">
<field name="name"/>
<field name="location_id"/>
<field name="cycle_count_rule_id"/>
<field name="responsible_id"/>
<field name="date_deadline"/>
<field name="state"/>
<tree
string="Stock Cycle Count"
decoration-muted="state == 'cancelled'"
decoration-info="state == 'draft'"
>
<field name="name" />
<field name="location_id" />
<field name="cycle_count_rule_id" />
<field name="responsible_id" />
<field name="date_deadline" />
<field name="state" />
</tree>
</field>
</record>
<record id="stock_cycle_count_form_view" model="ir.ui.view">
<field name="name">stock.cycle.count.form</field>
<field name="model">stock.cycle.count</field>
<field name="arch" type="xml">
<form string="cycle counts test:">
<header>
<button name="action_create_inventory_adjustment"
type="object" states="draft"
string="Confirm" class="oe_highlight" />
<button name="do_cancel" type="object"
string="Cancel" states="draft"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,open,done"/>
<button
name="action_create_inventory_adjustment"
type="object"
states="draft"
string="Confirm"
class="oe_highlight"
/>
<button
name="do_cancel"
type="object"
string="Cancel"
states="draft"
/>
<field
name="state"
widget="statusbar"
statusbar_visible="draft,open,done"
/>
</header>
<sheet>
<div class="oe_button_box" name="button_box"
attrs="{'invisible':
[('state', 'not in', ('draft', 'open', 'done'))]}">
<button name="action_view_inventory"
type="object" class="oe_stat_button"
icon="fa-building-o">
<field name="inventory_adj_count"
widget="statinfo"
help="Inventory adjustments associated"
modifiers="{'readonly': true}"
string="Inventory Adjustments"/>
</button>
<div
class="oe_button_box"
name="button_box"
attrs="{'invisible':
[('state', 'not in', ('draft', 'open', 'done'))]}"
>
<button
name="action_view_inventory"
type="object"
class="oe_stat_button"
icon="fa-building-o"
>
<field
name="inventory_adj_count"
widget="statinfo"
help="Inventory adjustments associated"
modifiers="{'readonly': true}"
string="Inventory Adjustments"
/>
</button>
</div>
<div class="oe_title">
<label string="Cycle Count" for="name"/>
<label string="Cycle Count" for="name" />
<h1>
<field name="name"/>
<field name="name" />
</h1>
</div>
<group name="top">
<group name="left">
<field name="location_id">Location</field>
<field name="cycle_count_rule_id"/>
<field name="cycle_count_rule_id" />
</group>
<group name="right">
<field name="responsible_id">Assigned to</field>
<field name="date_deadline">Deadline Date</field>
<field name="company_id"/>
<field name="company_id" />
</group>
</group>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers" />
<field name="message_ids" widget="mail_thread" />
</div>
</form>
</field>
</record>
<record id="stock_cycle_count_search_view" model="ir.ui.view">
<field name="name">stock.cycle.count.search</field>
<field name="model">stock.cycle.count</field>
<field name="arch" type="xml">
<search string="Search Cycle Count">
<field name="name" string="Cycle Count"/>
<separator/>
<field name="state"/>
<filter name="planned" string="Planned"
domain="[('state','=', 'draft')]"
help="Cycle Counts Planned"/>
<filter name="execution" string="Execution"
domain="[('state','=', 'open')]"
help="Cycle Counts in Execution"/>
<filter name="done" string="Done"
domain="[('state','=', 'done')]"
help="Cycle Counts Done"/>
<filter name="cancelled" string="Cancelled"
domain="[('state','=', 'cancelled')]"
help="Cycle Counts Cancelled"/>
<filter name="assigned_to_user" string="Assigned to me"
domain="[('responsible_id','=', uid)]"
help="Cycle Counts Assigned to me"/>
<field name="responsible_id" />
<group expand="0" string="Group By...">
<filter string="Location"
name="location"
domain="[]"
context="{'group_by':'location_id'}"/>
<filter string="State"
name="state"
domain="[]"
context="{'group_by':'state'}"/>
<filter string="Assigned to"
name="responsible"
domain="[]"
context="{'group_by':'responsible_id'}"/>
</group>
</search>
</field>
</record>
<field name="name">stock.cycle.count.search</field>
<field name="model">stock.cycle.count</field>
<field name="arch" type="xml">
<search string="Search Cycle Count">
<field name="name" string="Cycle Count" />
<separator />
<field name="state" />
<filter
name="planned"
string="Planned"
domain="[('state','=', 'draft')]"
help="Cycle Counts Planned"
/>
<filter
name="execution"
string="Execution"
domain="[('state','=', 'open')]"
help="Cycle Counts in Execution"
/>
<filter
name="done"
string="Done"
domain="[('state','=', 'done')]"
help="Cycle Counts Done"
/>
<filter
name="cancelled"
string="Cancelled"
domain="[('state','=', 'cancelled')]"
help="Cycle Counts Cancelled"
/>
<filter
name="assigned_to_user"
string="Assigned to me"
domain="[('responsible_id','=', uid)]"
help="Cycle Counts Assigned to me"
/>
<field name="responsible_id" />
<group expand="0" string="Group By...">
<filter
string="Location"
name="location"
domain="[]"
context="{'group_by':'location_id'}"
/>
<filter
string="State"
name="state"
domain="[]"
context="{'group_by':'state'}"
/>
<filter
string="Assigned to"
name="responsible"
domain="[]"
context="{'group_by':'responsible_id'}"
/>
</group>
</search>
</field>
</record>
<!-- Action to open Stock Cycle Count -->
<act_window id="action_stock_cycle_count"
name="Stock Cycle Count"
res_model="stock.cycle.count"
view_mode="tree,form"
context="{'search_default_planned':1,'search_default_execution':1}"/>
<menuitem id="menu_stock_cycle_count"
name="Cycle Counts"
parent="stock.menu_stock_warehouse_mgmt"
sequence="28"
action="action_stock_cycle_count"/>
<act_window
id="action_stock_cycle_count"
name="Stock Cycle Count"
res_model="stock.cycle.count"
view_mode="tree,form"
context="{'search_default_planned':1,'search_default_execution':1}"
/>
<menuitem
id="menu_stock_cycle_count"
name="Cycle Counts"
parent="stock.menu_stock_warehouse_mgmt"
sequence="28"
action="action_stock_cycle_count"
/>
<!-- Action to confirm several Stock Cycle Counts -->
<record id="action_server_cycle_count_confirm"
model="ir.actions.server">
<record id="action_server_cycle_count_confirm" model="ir.actions.server">
<field name="name">Confirm Cycle Counts</field>
<field name="model_id" ref="model_stock_cycle_count" />
<field name="binding_model_id" ref="model_stock_cycle_count"/>
<field name="binding_model_id" ref="model_stock_cycle_count" />
<field name="state">code</field>
<field name="code">records.action_create_inventory_adjustment()</field>
</record>
</odoo>

View File

@@ -1,83 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_inventory_tree" model="ir.ui.view">
<field name="name">Inventory tree view - cycle count extension</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_tree"/>
<field name="inherit_id" ref="stock.view_inventory_tree" />
<field name="arch" type="xml">
<field name="date" position="after">
<field name="location_id"/>
<field name="cycle_count_id"/>
<field name="inventory_accuracy"/>
<field name="location_ids" />
<field name="cycle_count_id" />
<field name="inventory_accuracy" />
</field>
</field>
</record>
<record id="view_inventory_form" model="ir.ui.view">
<field name="name">Inventory form view - cycle count extension </field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_form"/>
<field name="inherit_id" ref="stock.view_inventory_form" />
<field name="arch" type="xml">
<field name="date" position="after">
<field name="cycle_count_id"/>
<label for="inventory_accuracy"/>
<field name="company_id" position="after">
<field name="cycle_count_id" />
<label for="inventory_accuracy" />
<div>
<field name="inventory_accuracy" class="oe_inline"/> %
<field name="inventory_accuracy" class="oe_inline" /> %
</div>
</field>
</field>
</record>
<record id="view_inventory_filter" model="ir.ui.view">
<field name="name">stock.inventory.filter - stock_cycle_count</field>
<field name="model">stock.inventory</field>
<field name="inherit_id" ref="stock.view_inventory_filter"/>
<field name="inherit_id" ref="stock.view_inventory_filter" />
<field name="arch" type="xml">
<field name="company_id" position="after">
<field name="location_id"/>
<field name="product_ids" position="after">
<field name="location_ids" />
</field>
</field>
</record>
<record id="view_inventory_graph" model="ir.ui.view">
<field name="name">stock.inventory.graph</field>
<field name="model">stock.inventory</field>
<field name="arch" type="xml">
<graph string="Inventory accuracy evolution" type="line">
<field name="cycle_count_id" type="col"/>
<field name="inventory_accuracy" type="measure"/>
<field name="cycle_count_id" type="col" />
<field name="inventory_accuracy" type="measure" />
</graph>
</field>
</record>
<record id="view_inventory_pivot" model="ir.ui.view">
<field name="name">stock.inventory.pivot</field>
<field name="model">stock.inventory</field>
<field name="arch" type="xml">
<pivot string="Inventory Accuracy">
<field name="date" type="col"/>
<field name="location_id" type="row"/>
<field name="inventory_accuracy" type="measure"/>
<field name="date" type="col" />
<field name="name" type="row" />
<field name="inventory_accuracy" type="measure" />
</pivot>
</field>
</record>
<record model="ir.actions.act_window" id="act_accuracy_stats">
<field name="domain">[('exclude_sublocation', '=', True),
('state', '=', 'done')]</field>
<field name="name">Accuracy Stats</field>
<field name="res_model">stock.inventory</field>
<field name="view_type">form</field>
<field name="view_mode">pivot,tree,form,graph</field>
</record>
<menuitem id="menu_report_accuracy_stats"
name="Cycle Count Accuracy"
parent="stock.menu_warehouse_report"
action="act_accuracy_stats" />
<menuitem
id="menu_report_accuracy_stats"
name="Cycle Count Accuracy"
parent="stock.menu_warehouse_report"
action="act_accuracy_stats"
/>
</odoo>

View File

@@ -1,31 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_location_form" model="ir.ui.view">
<field name="name">Location form - cycle count extension</field>
<field name="model">stock.location</field>
<field name="inherit_id" ref="stock.view_location_form"/>
<field name="inherit_id" ref="stock.view_location_form" />
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button string="Accuracy Stats" class="oe_stat_button"
icon="fa-line-chart" name="action_accuracy_stats"
context="{'location_id': active_ids}"
type="object"/>
<button
string="Accuracy Stats"
class="oe_stat_button"
icon="fa-line-chart"
name="action_accuracy_stats"
context="{'location_id': active_ids}"
type="object"
/>
</xpath>
<group name="localization" position="after">
<group name="additional_info" position="before">
<group name="cycle_count" string="Cycle Count">
<field name="zero_confirmation_disabled"/>
<field name="cycle_count_disabled"/>
<label for="loc_accuracy"/>
<field name="zero_confirmation_disabled" />
<field name="cycle_count_disabled" />
<label for="loc_accuracy" />
<div>
<field name="loc_accuracy" class="oe_inline"/> %
<field name="loc_accuracy" class="oe_inline" /> %
</div>
</group>
</group>
</field>
</record>
</odoo>

View File

@@ -1,35 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright 2017 Eficent Business and IT Consulting Services S.L.
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="view_warehouse_form" model="ir.ui.view">
<field name="name">Warehouse form - cycle count extension</field>
<field name="model">stock.warehouse</field>
<field name="inherit_id" ref="stock.view_warehouse"/>
<field name="inherit_id" ref="stock.view_warehouse" />
<field name="arch" type="xml">
<notebook position="before">
<group string="Cycle Counting" colspan="4">
<field name="cycle_count_planning_horizon"/>
<field name="counts_for_accuracy_qty"/>
<br></br>
<center colspan="4"><h3 colspan="4">Cycle Count Rules
applied in this Warehouse:</h3></center>
<field name="cycle_count_planning_horizon" />
<field name="counts_for_accuracy_qty" />
<br />
<center colspan="4">
<h3 colspan="4">Cycle Count Rules
applied in this Warehouse:</h3>
</center>
<field name="cycle_count_rule_ids" nolabel="1" colspan="4">
Cycle count rules</field>
</group>
</notebook>
</field>
</record>
<record id="action_server_warehouse_execute_cycle_count"
model="ir.actions.server">
<record id="action_server_warehouse_execute_cycle_count" model="ir.actions.server">
<field name="name">Compute Cycle Count Rules</field>
<field name="model_id" ref="stock.model_stock_warehouse"/>
<field name="binding_model_id" ref="stock.model_stock_warehouse"/>
<field name="model_id" ref="stock.model_stock_warehouse" />
<field name="binding_model_id" ref="stock.model_stock_warehouse" />
<field name="state">code</field>
<field name="code">records.action_compute_cycle_count_rules()</field>
</record>
</odoo>