Merge branch '10.0' of https://github.com/akretion/odoo-usability into 10.0
This commit is contained in:
3
account_aged_balance_from_partner/__init__.py
Normal file
3
account_aged_balance_from_partner/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import partner
|
||||
25
account_aged_balance_from_partner/__manifest__.py
Normal file
25
account_aged_balance_from_partner/__manifest__.py
Normal file
@@ -0,0 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2015-2018 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
{
|
||||
'name': 'Aged Partner Balance from Partner',
|
||||
'version': '10.0.0.1.0',
|
||||
'category': 'Accounting',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Direct access to the aged partner balance report from the partner form',
|
||||
'description': """
|
||||
Aged Partner Balance from Partner
|
||||
=================================
|
||||
|
||||
This module adds a button on the partner form view (the icon on the button is a banknote) to easily open the detailed aged partner balance of the partner in PDF format.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['account_financial_report_qweb'],
|
||||
'data': ['partner_view.xml'],
|
||||
'installable': True,
|
||||
}
|
||||
30
account_aged_balance_from_partner/partner.py
Normal file
30
account_aged_balance_from_partner/partner.py
Normal file
@@ -0,0 +1,30 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2015-2018 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
@api.depends('credit', 'debit')
|
||||
def _compute_balance(self):
|
||||
for partner in self:
|
||||
partner.balance = partner.credit - partner.debit
|
||||
|
||||
# The field 'currency_id' defined in the account module
|
||||
# is a computed field that gets the company currency
|
||||
balance = fields.Monetary(
|
||||
compute='_compute_balance', readonly=True,
|
||||
string="Account Balance")
|
||||
|
||||
def open_aged_open_invoices_report(self):
|
||||
wiz = self.env['aged.partner.balance.wizard'].create({
|
||||
'show_move_line_details': True,
|
||||
'partner_ids': [(6, 0, self.ids)],
|
||||
})
|
||||
action = wiz.button_export_pdf()
|
||||
return action
|
||||
31
account_aged_balance_from_partner/partner_view.xml
Normal file
31
account_aged_balance_from_partner/partner_view.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015-2018 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="name">account.balance.button.partner.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="account.partner_view_buttons"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="open_partner_history" type="object" position="after">
|
||||
<button class="oe_stat_button" type="object"
|
||||
name="open_aged_open_invoices_report"
|
||||
attrs="{'invisible': [('parent_id', '!=', False)]}"
|
||||
icon="fa-money">
|
||||
<div class="o_form_field o_stat_info">
|
||||
<span class="o_stat_value"><field name="balance"/></span>
|
||||
<span class="o_stat_text">Account Balance</span>
|
||||
</div>
|
||||
</button>
|
||||
</button>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -36,6 +36,7 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
||||
],
|
||||
'data': [
|
||||
'account_view.xml',
|
||||
'account_report.xml',
|
||||
'partner_view.xml',
|
||||
'product_view.xml',
|
||||
'wizard/account_invoice_mark_sent_view.xml',
|
||||
|
||||
15
account_usability/account_report.xml
Normal file
15
account_usability/account_report.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright 2018 Akretion (http://www.akretion.com/)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="account.account_invoices" model="ir.actions.report.xml">
|
||||
<!-- Don't attach on supplier invoices/refunds ! -->
|
||||
<field name="attachment">(object.type in ('out_invoice', 'out_refund')) and (object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
@@ -252,6 +252,12 @@ module -->
|
||||
<record id="account.menu_action_account_moves_all" model="ir.ui.menu">
|
||||
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_user')])]"/>
|
||||
</record>
|
||||
|
||||
<!-- accountant must be able to access the Adviser section ! -->
|
||||
<record id="account.menu_finance_entries" model="ir.ui.menu">
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_user'))]"/>
|
||||
</record>
|
||||
|
||||
<!-- model account.move / Journal Entries -->
|
||||
<record id="account.action_move_journal_line" model="ir.actions.act_window">
|
||||
<field name="limit">200</field>
|
||||
@@ -287,6 +293,9 @@ module -->
|
||||
<filter name="reconciled" string="Fully Reconciled" domain="[('full_reconcile_id', '!=', False)]"/>
|
||||
<!-- <filter name="partial_reconciled" string="Partially Reconciled" domain="[('reconcile_partial_id', '!=', False)]"/> -->
|
||||
</filter>
|
||||
<filter name="unreconciled" position="attributes">
|
||||
<attribute name="string">Unreconciled or Partially Reconciled</attribute>
|
||||
</filter>
|
||||
<field name="name" position="attributes">
|
||||
<attribute name="string">Name or Reference</attribute>
|
||||
</field>
|
||||
@@ -421,6 +430,40 @@ module -->
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ACCOUNT TAX GROUP -->
|
||||
<!-- in the account module, there is nothing for account.tax.group : no form/tree view, no menu... -->
|
||||
<record id="account_tax_group_form" model="ir.ui.view">
|
||||
<field name="name">usability.account.tax.group.form</field>
|
||||
<field name="model">account.tax.group</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Tax Group">
|
||||
<group name="main">
|
||||
<field name="name"/>
|
||||
<field name="sequence" invisible="1"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_tax_group_tree" model="ir.ui.view">
|
||||
<field name="name">usability.account.tax.group.tree</field>
|
||||
<field name="model">account.tax.group</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Tax Groups">
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="account_tax_group_action" model="ir.actions.act_window">
|
||||
<field name="name">Tax Groups</field>
|
||||
<field name="res_model">account.tax.group</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="account_tax_group_menu" action="account_tax_group_action" parent="account.account_account_menu" sequence="2"/>
|
||||
|
||||
<!-- Remove menu entry "Accounting > Configuration > Accounting > Bank Accounts"
|
||||
(account.journal filtered on type = 'bank' with special tree and form view)
|
||||
because it is useless and confusing -->
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<field name="property_account_position_id" position="attributes">
|
||||
<attribute name="widget">selection</attribute>
|
||||
</field>
|
||||
<group name="accounting_entries" position="attributes">
|
||||
<attribute name="groups">account.group_account_user</attribute>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
<xpath expr="//sheet/div[@class='oe_title']" position="attributes">
|
||||
<attribute name="style">width: 650px;</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='child_ids']/form//field[@name='email']" position="attributes">
|
||||
<attribute name="widget">email</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
from . import partner
|
||||
@@ -1,45 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Partner Aged Open Invoices module for Odoo
|
||||
# Copyright (C) 2015-2016 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Partner Aged Open Invoices',
|
||||
'version': '10.0.0.1.0',
|
||||
'category': 'Accounting & Finance',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Direct access to the aged open invoice report from the partner form',
|
||||
'description': """
|
||||
Partner Aged Open Invoices
|
||||
==========================
|
||||
|
||||
This module adds a button on the partner form view (the icon on the button is a banknote) to easily open the aged open invoices report of the partner.
|
||||
|
||||
It requires the updated version of the module **account_financial_report_webkit** that has the aged open invoice report ; you can find it in this pull request https://github.com/OCA/account-financial-reporting/pull/102
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['account_financial_report_webkit'],
|
||||
'data': ['partner_view.xml'],
|
||||
'installable': False,
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Partner Aged Open Invoices module for Odoo
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
import openerp.addons.decimal_precision as dp
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = 'res.partner'
|
||||
|
||||
@api.one
|
||||
@api.depends('credit', 'debit')
|
||||
def _compute_balance(self):
|
||||
self.balance = self.credit - self.debit
|
||||
|
||||
balance = fields.Float(
|
||||
compute='_compute_balance', readonly=True,
|
||||
digits=dp.get_precision('Account'), string="Account Balance")
|
||||
|
||||
@api.multi
|
||||
def open_aged_open_invoices_report(self):
|
||||
aoiwo = self.env['aged.open.invoices.webkit']
|
||||
afo = self.env['account.fiscalyear']
|
||||
# Force 'date_from' to the first day of the company's life
|
||||
# in order to get the full picture of the partner's account
|
||||
# (we could also do that via a filter by period, but, in this case,
|
||||
# account_financial_report_webkit doesn't accept "until_date = today" ;
|
||||
# until_date has to be the end date of the last period
|
||||
fy_years = afo.search([], order='date_start')
|
||||
date_from = fy_years[0].date_start
|
||||
fy_id = aoiwo._get_fiscalyear()
|
||||
filter_change = aoiwo.onchange_filter(
|
||||
filter='filter_date', fiscalyear_id=fy_id)
|
||||
vals = {
|
||||
'fiscalyear_id': fy_id,
|
||||
'filter': 'filter_date',
|
||||
'partner_ids': [(6, 0, [self.commercial_partner_id.id])],
|
||||
'target_move': 'all',
|
||||
}
|
||||
vals.update(filter_change['value'])
|
||||
vals['date_from'] = date_from
|
||||
wizard = aoiwo.create(vals)
|
||||
data = {'form': {
|
||||
'chart_account_id': wizard.chart_account_id.id,
|
||||
'filter': vals['filter'],
|
||||
'date_from': vals['date_from'],
|
||||
'date_to': vals['date_to'],
|
||||
'period_to': False,
|
||||
'fiscalyear_id': vals['fiscalyear_id'],
|
||||
'partner_ids': vals['partner_ids'][0][2],
|
||||
'target_move': vals['target_move'],
|
||||
}
|
||||
}
|
||||
action = wizard._print_report(data)
|
||||
return action
|
||||
@@ -1,41 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2015 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="name">account.balance.button.partner.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<!-- Put the button after the "Journal Items" without depending
|
||||
on the view account.partner_view_button_journal_item_count
|
||||
which is linked to the group account.group_account_user -->
|
||||
<field name="priority" eval="22"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='buttons']" position="inside">
|
||||
<button class="oe_stat_button" type="object"
|
||||
name="open_aged_open_invoices_report"
|
||||
attrs="{'invisible': [('parent_id', '!=', False)]}"
|
||||
icon="fa-money"
|
||||
>
|
||||
<div>
|
||||
<strong>
|
||||
<field string="Account Balance" name="balance"
|
||||
widget="monetary"/>
|
||||
</strong>
|
||||
<br/>
|
||||
Account Balance
|
||||
</div>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -6,13 +6,13 @@
|
||||
'name': 'Purchase Hide Report Print Menu',
|
||||
'summary': "Hide print report 'Request for Quotation' "
|
||||
"in purchase order menu",
|
||||
'version': '8.0.1.0.0',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Purchase Management',
|
||||
'website': 'http://akretion.com',
|
||||
'author': 'Akretion, Odoo Community Association (OCA)',
|
||||
'license': 'AGPL-3',
|
||||
'application': False,
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
'depends': [
|
||||
'purchase',
|
||||
],
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# © 2016 Chafique DELLI @ Akretion
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, api
|
||||
from odoo import models, api
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<openerp>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record model="ir.actions.act_window" id="purchase.purchase_form_action">
|
||||
@@ -8,4 +8,4 @@
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -180,4 +180,42 @@
|
||||
|
||||
<!-- The menu entry should be added in customer-specific module -->
|
||||
|
||||
<!-- in v10, the cart button is present on the product.template form view
|
||||
but not on the product.product form view
|
||||
In v8, it was present on both, so I put the cart button on the product.product form view too -->
|
||||
<record id="action_purchase_line_product_product_tree" model="ir.actions.act_window">
|
||||
<field name="name">Purchase Order Lines</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="view_id" ref="purchase_order_line_tree"/>
|
||||
<field name="domain">[('product_id','in',active_ids), ('state', 'in', ['purchase', 'done'])]</field>
|
||||
<field name="context">{}</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_normal_purchase_buttons_from" model="ir.ui.view">
|
||||
<field name="name">product.product.purchase.button.inherit</field>
|
||||
<field name="model">product.product</field>
|
||||
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||
<field name="groups_id" eval="[(4, ref('purchase.group_purchase_user'))]"/>
|
||||
<field name="arch" type="xml">
|
||||
<div name="button_box" position="inside">
|
||||
<button class="oe_inline oe_stat_button"
|
||||
name="%(action_purchase_line_product_product_tree)d"
|
||||
type="action" icon="fa-shopping-cart">
|
||||
<field string="Purchases" name="purchase_count" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_product_supplier_inherit" model="ir.ui.view">
|
||||
<field name="name">purchase_usability.product.template.form</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="purchase.view_product_supplier_inherit"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="purchase_method" position="attributes">
|
||||
<attribute name="groups"></attribute>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,45 +1,26 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Stock Picking Type Default Partner module for Odoo
|
||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014-2018 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
{
|
||||
'name': 'Stock Picking Type Default Partner',
|
||||
'version': '0.1',
|
||||
'category': 'Inventory, Logistic, Storage',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Inventory, Logistics, Warehousing',
|
||||
'license': 'AGPL-3',
|
||||
'summary': 'Adds a default partner on types of operation',
|
||||
'description': """
|
||||
Stock Picking Type Default Partner
|
||||
==================================
|
||||
|
||||
This module adds a new field on the Types of Operation (stock.picking.type) : *Default Partner*.
|
||||
This module adds a new field on the Types of Operation (stock.picking.type) : *Default Partner*. This is useful for multi-site companies that create inter-site Type of Operations: all the operations that use this Type of Operation should have the same destination partner.
|
||||
|
||||
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
|
||||
""",
|
||||
'author': 'Akretion',
|
||||
'website': 'http://www.akretion.com',
|
||||
'depends': ['stock'],
|
||||
'data': [
|
||||
'stock_view.xml'
|
||||
],
|
||||
'installable': False,
|
||||
'data': ['stock_view.xml'],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -1,57 +1,31 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Stock Picking Type Default Partner module for Odoo
|
||||
# Copyright (C) 2014 Akretion (http://www.akretion.com)
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2014-2018 Akretion (http://www.akretion.com)
|
||||
# @author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# For an unknown reasons, it doesn't work when using the new API
|
||||
# with this module it breaks in an SQL query trying to select the
|
||||
# "picking_type_code" on stock.picking although it is a related field
|
||||
# store=False So I keep it with the old API for the moment
|
||||
from openerp.osv import orm, fields
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
|
||||
class StockPickingType(orm.Model):
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class StockPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
_columns = {
|
||||
'default_partner_id': fields.many2one(
|
||||
'res.partner', 'Default Partner', ondelete='restrict',
|
||||
help="If set, it will be the default partner on this type "
|
||||
"of pickings."),
|
||||
}
|
||||
default_partner_id = fields.Many2one(
|
||||
'res.partner', string='Default Partner', ondelete='restrict',
|
||||
help="If set, it will be the default partner on this type of "
|
||||
"pickings.")
|
||||
|
||||
|
||||
class StockPicking(orm.Model):
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def _default_partner_id(self, cr, uid, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
if context.get('default_picking_type_id'):
|
||||
picktype = self.pool['stock.picking.type'].browse(
|
||||
cr, uid, context.get('default_picking_type_id'),
|
||||
context=context)
|
||||
@api.model
|
||||
def _default_partner_id(self):
|
||||
if self._context.get('default_picking_type_id'):
|
||||
picktype = self.env['stock.picking.type'].browse(
|
||||
self._context.get('default_picking_type_id'))
|
||||
if picktype.default_partner_id:
|
||||
return picktype.default_partner_id.id
|
||||
return picktype.default_partner_id
|
||||
return False
|
||||
|
||||
_defaults = {
|
||||
'partner_id': _default_partner_id,
|
||||
}
|
||||
partner_id = fields.Many2one(default=_default_partner_id)
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright (C) 2015 Akretion (http://www.akretion.com/)
|
||||
Copyright (C) 2015-2018 Akretion (http://www.akretion.com/)
|
||||
@author Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_picking_type_form" model="ir.ui.view">
|
||||
<field name="name">default.partner.stock.picking.type.form</field>
|
||||
@@ -20,5 +19,5 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -3,3 +3,5 @@ access_procurement_scheduler_log_full,Full access on procurement.scheduler.log t
|
||||
access_procurement_scheduler_log_user,Read/Create procurement.scheduler.log to Stock user,model_procurement_scheduler_log,stock.group_stock_user,1,0,1,0
|
||||
access_procurement_scheduler_log_read,Read access on procurement.scheduler.log to Employee,model_procurement_scheduler_log,base.group_user,1,0,0,0
|
||||
access_stock_warehouse_orderpoint_employee,Read access on stock.warehouse.orderpoint to employee (needed to open product form view with employee-only group),stock.model_stock_warehouse_orderpoint,base.group_user,1,0,0,0
|
||||
stock.access_product_product_stock_user,product_product_stock_user,product.model_product_product,stock.group_stock_user,1,0,0,0
|
||||
stock.access_product_template_stock_user,product.template stock user,product.model_product_template,stock.group_stock_user,1,0,0,0
|
||||
|
||||
|
@@ -31,6 +31,13 @@ class StockPicking(models.Model):
|
||||
pick.message_post(_("Using <b>Force Availability</b>!"))
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def do_unreserve(self):
|
||||
res = super(StockPicking, self).do_unreserve()
|
||||
for pick in self:
|
||||
pick.message_post(_("Picking <b>unreserved</b>."))
|
||||
return res
|
||||
|
||||
|
||||
class StockLocation(models.Model):
|
||||
_inherit = 'stock.location'
|
||||
@@ -115,6 +122,22 @@ class StockMove(models.Model):
|
||||
res.append((line.id, name))
|
||||
return res
|
||||
|
||||
def button_do_unreserve(self):
|
||||
for move in self:
|
||||
move.do_unreserve()
|
||||
if move.picking_id:
|
||||
product = move.product_id
|
||||
self.picking_id.message_post(_(
|
||||
"Product <a href=# data-oe-model=product.product "
|
||||
"data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>")
|
||||
% (product.id, product.display_name,
|
||||
move.product_qty, move.product_id.uom_id.name))
|
||||
ops = self.env['stock.pack.operation']
|
||||
for smol in move.linked_move_operation_ids:
|
||||
if smol.operation_id:
|
||||
ops += smol.operation_id
|
||||
ops.unlink()
|
||||
|
||||
|
||||
class StockIncoterms(models.Model):
|
||||
_inherit = 'stock.incoterms'
|
||||
|
||||
@@ -114,14 +114,14 @@
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_form" />
|
||||
<field name="arch" type="xml">
|
||||
<!-- There are no button any more on that view...
|
||||
so probably not a good idea to add one
|
||||
<button name="force_assign" position="after">
|
||||
<button type="object" name="do_unreserve" string="Unreserve"
|
||||
<field name="state" position="before">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
states="confirmed,assigned"/>
|
||||
</button>
|
||||
-->
|
||||
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"/>
|
||||
</field>
|
||||
<field name="picking_id" position="after">
|
||||
<field name="inventory_id" readonly="1"/>
|
||||
</field>
|
||||
<group name="moved_quants_grp" position="after">
|
||||
<notebook colspan="2">
|
||||
<page string="Notes" name="notes">
|
||||
@@ -133,8 +133,10 @@
|
||||
<field name="route_ids" widget="many2many_tags"/>
|
||||
<field name="rule_id" readonly="1"/>
|
||||
<field name="push_rule_id" readonly="1"/>
|
||||
<field name="propagate" readonly="1"/>
|
||||
<field name="price_unit"
|
||||
attrs="{'readonly': [('state', '=', 'done')]}"/>
|
||||
<field name="reserved_quant_ids" readonly="1"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
@@ -147,6 +149,11 @@
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_picking_form" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="state" position="before">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"/>
|
||||
</field>
|
||||
<field name="group_id" position="replace"/> <!-- in stock, this field has invisible="1" re-add it below as visible -->
|
||||
<group name="moved_quants_grp" position="after">
|
||||
<notebook colspan="2">
|
||||
@@ -161,7 +168,9 @@
|
||||
<field name="route_ids" widget="many2many_tags"/>
|
||||
<field name="rule_id" readonly="1"/>
|
||||
<field name="push_rule_id" readonly="1"/>
|
||||
<field name="propagate" readonly="1"/>
|
||||
<field name="price_unit" readonly="1"/>
|
||||
<field name="reserved_quant_ids" readonly="1"/>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
@@ -180,6 +189,30 @@
|
||||
<field name="location_dest_id" position="attributes">
|
||||
<attribute name="invisible">0</attribute>
|
||||
</field>
|
||||
<field name="state" position="after">
|
||||
<button type="object" name="button_do_unreserve" string="Unreserve"
|
||||
groups="stock.group_stock_user"
|
||||
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"
|
||||
icon="fa-ban"/>
|
||||
<field name="reserved_quant_ids" invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- By default, stock.move have:
|
||||
_order = 'picking_id, sequence, id'
|
||||
I don't know if they have a good reason to choose this order,
|
||||
but, when you open tree view of move lines from product, you want
|
||||
the most recent moves at the top, so we change the default
|
||||
order in the tree view (lower impact than changing _order -->
|
||||
<record id="view_move_tree" model="ir.ui.view">
|
||||
<field name="name">stock_usability.move.tree.better.order</field>
|
||||
<field name="model">stock.move</field>
|
||||
<field name="inherit_id" ref="stock.view_move_tree" />
|
||||
<field name="arch" type="xml">
|
||||
<tree position="attributes">
|
||||
<attribute name="default_order">date desc, picking_id, sequence</attribute>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -311,14 +344,14 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
|
||||
but it forces a group by on products that you can't remove
|
||||
So I create another "regular" Quants" menu entry -->
|
||||
<record id="stock_quant_action" model="ir.actions.act_window">
|
||||
<field name="name">Quants</field>
|
||||
<field name="name">Quants List</field>
|
||||
<field name="res_model">stock.quant</field>
|
||||
<field name="view_mode">tree,form,pivot</field>
|
||||
<field name="context">{'search_default_internal_loc': 1}</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="stock_quant_menu" action="stock_quant_action"
|
||||
parent="stock.menu_warehouse_report" groups="stock.group_stock_manager"
|
||||
parent="stock.menu_warehouse_report"
|
||||
sequence="135"/>
|
||||
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user