mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[11.0] stock_request_analytic:
* clean views. * allow to create a stock.request with no analytic account. * remove copy attribute in non-stored field. * remove non-existing field from compute method.
This commit is contained in:
59
stock_request_analytic/i18n/stock_request_analytic.pot
Normal file
59
stock_request_analytic/i18n/stock_request_analytic.pot
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# Translation of Odoo Server.
|
||||||
|
# This file contains the translation of the following modules:
|
||||||
|
# * stock_request_analytic
|
||||||
|
#
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: Odoo Server 11.0\n"
|
||||||
|
"Report-Msgid-Bugs-To: \n"
|
||||||
|
"Last-Translator: <>\n"
|
||||||
|
"Language-Team: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
|
"Content-Transfer-Encoding: \n"
|
||||||
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model,name:stock_request_analytic.model_account_analytic_account
|
||||||
|
#: model:ir.model.fields,field_description:stock_request_analytic.field_stock_request_analytic_account_id
|
||||||
|
msgid "Analytic Account"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model.fields,field_description:stock_request_analytic.field_stock_request_order_analytic_account_ids
|
||||||
|
#: model:ir.ui.view,arch_db:stock_request_analytic.stock_request_order_form
|
||||||
|
msgid "Analytic Accounts"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model.fields,field_description:stock_request_analytic.field_stock_request_order_analytic_count
|
||||||
|
msgid "Analytic Count"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model,name:stock_request_analytic.model_procurement_rule
|
||||||
|
msgid "Procurement Rule"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model,name:stock_request_analytic.model_stock_request
|
||||||
|
#: model:ir.ui.view,arch_db:stock_request_analytic.view_account_analytic_account_form
|
||||||
|
msgid "Stock Request"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model,name:stock_request_analytic.model_stock_request_order
|
||||||
|
msgid "Stock Request Order"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: model:ir.model.fields,field_description:stock_request_analytic.field_account_analytic_account_stock_request_ids
|
||||||
|
msgid "Stock Requests"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. module: stock_request_analytic
|
||||||
|
#: code:addons/stock_request_analytic/models/stock_request.py:19
|
||||||
|
#, python-format
|
||||||
|
msgid "You cannot link a analytic account to a stock request that belongs to another company."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ class ProcurementRule(models.Model):
|
|||||||
res = super(ProcurementRule, self)._get_stock_move_values(
|
res = super(ProcurementRule, self)._get_stock_move_values(
|
||||||
product_id, product_qty, product_uom, location_id, name, origin,
|
product_id, product_qty, product_uom, location_id, name, origin,
|
||||||
values, group_id)
|
values, group_id)
|
||||||
|
if values.get('stock_request_id'):
|
||||||
analytic_account_id = self.env['stock.request'].browse(
|
analytic_account_id = self.env['stock.request'].browse(
|
||||||
values['stock_request_id']).analytic_account_id.id
|
values['stock_request_id']).analytic_account_id.id
|
||||||
res.update(analytic_account_id=analytic_account_id)
|
res.update(analytic_account_id=analytic_account_id)
|
||||||
|
|||||||
@@ -13,9 +13,8 @@ class StockRequest(models.Model):
|
|||||||
|
|
||||||
@api.constrains('analytic_account_id')
|
@api.constrains('analytic_account_id')
|
||||||
def _check_analytic_company_constrains(self):
|
def _check_analytic_company_constrains(self):
|
||||||
if any(request.company_id and
|
if any(r.company_id and r.analytic_account_id and
|
||||||
request.analytic_account_id.company_id !=
|
r.analytic_account_id.company_id != r.company_id for r in self):
|
||||||
request.company_id for request in self):
|
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_('You cannot link a analytic account '
|
_('You cannot link a analytic account '
|
||||||
'to a stock request that belongs to '
|
'to a stock request that belongs to '
|
||||||
|
|||||||
@@ -7,23 +7,23 @@ from odoo import api, fields, models
|
|||||||
class StockRequestOrder(models.Model):
|
class StockRequestOrder(models.Model):
|
||||||
_inherit = 'stock.request.order'
|
_inherit = 'stock.request.order'
|
||||||
|
|
||||||
analytic_count = fields.Integer(string='analytic count',
|
analytic_count = fields.Integer(
|
||||||
compute='_compute_analytic_ids',
|
compute='_compute_analytic_ids',
|
||||||
readonly=True)
|
readonly=True,
|
||||||
|
)
|
||||||
analytic_account_ids = fields.One2many(
|
analytic_account_ids = fields.One2many(
|
||||||
'account.analytic.account',
|
comodel_name='account.analytic.account',
|
||||||
compute='_compute_analytic_ids',
|
compute='_compute_analytic_ids',
|
||||||
string='Analytic Accounts',
|
string='Analytic Accounts',
|
||||||
readonly=True, copy=False)
|
readonly=True,
|
||||||
|
)
|
||||||
|
|
||||||
@api.depends('stock_request_ids')
|
@api.depends('stock_request_ids')
|
||||||
def _compute_analytic_ids(self):
|
def _compute_analytic_ids(self):
|
||||||
for req in self.sudo():
|
for req in self.sudo():
|
||||||
req.analytic_ids = req.stock_request_ids.mapped(
|
|
||||||
'analytic_account_id')
|
|
||||||
req.analytic_account_ids = req.stock_request_ids.mapped(
|
req.analytic_account_ids = req.stock_request_ids.mapped(
|
||||||
'analytic_account_id')
|
'analytic_account_id')
|
||||||
req.analytic_count = len(req.analytic_ids)
|
req.analytic_count = len(req.analytic_account_ids)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def action_view_analytic(self):
|
def action_view_analytic(self):
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<odoo>
|
<odoo>
|
||||||
|
|
||||||
<record id="stock_request_order_form" model="ir.ui.view">
|
<record id="stock_request_order_form" model="ir.ui.view">
|
||||||
<field name="name">stock.request.order.form</field>
|
<field name="name">stock.request.order.form - stock_request_analytic</field>
|
||||||
<field name="model">stock.request.order</field>
|
<field name="model">stock.request.order</field>
|
||||||
<field name="inherit_id" ref="stock_request.stock_request_order_form"/>
|
<field name="inherit_id" ref="stock_request.stock_request_order_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
@@ -13,14 +13,14 @@
|
|||||||
<button type="object"
|
<button type="object"
|
||||||
name="action_view_analytic"
|
name="action_view_analytic"
|
||||||
class="oe_stat_button"
|
class="oe_stat_button"
|
||||||
icon="fa-truck"
|
icon="fa-list"
|
||||||
attrs="{'invisible': [('analytic_count', '=', 0)]}"
|
attrs="{'invisible': [('analytic_count', '=', 0)]}"
|
||||||
groups="analytic.group_analytic_accounting">
|
groups="analytic.group_analytic_accounting">
|
||||||
<field name="analytic_count" widget="statinfo"
|
<field name="analytic_count" widget="statinfo"
|
||||||
string="analytic"/>
|
string="Analytic Accounts"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<xpath expr="//sheet/notebook/page/field[@name='stock_request_ids']/tree//field[@name='route_id']" position="after">
|
<xpath expr="//field[@name='stock_request_ids']/tree//field[@name='route_id']" position="after">
|
||||||
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<field name="inherit_id" ref="stock_request.view_stock_request_form"/>
|
<field name="inherit_id" ref="stock_request.view_stock_request_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="procurement_group_id" position="after">
|
<field name="procurement_group_id" position="after">
|
||||||
<field name="analytic_account_id"/>
|
<field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
|
||||||
</field>
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user