Mig account_usability, sale_stock_usability, sale_usability, stock_usability

New module stock_account_usability
This commit is contained in:
Alexis de Lattre
2019-02-04 20:00:41 +01:00
parent 1a193dcbec
commit 9f1cf7af1e
39 changed files with 210 additions and 432 deletions

View File

@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
from . import account from . import account
from . import account_invoice_report #from . import account_invoice_report
from . import partner from . import partner
from . import wizard from . import wizard

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # Copyright 2015-2019 Akretion (http://www.akretion.com)
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -40,7 +39,6 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
'account_report.xml', 'account_report.xml',
'account_invoice_report_view.xml', 'account_invoice_report_view.xml',
'partner_view.xml', 'partner_view.xml',
'product_view.xml',
'wizard/account_invoice_mark_sent_view.xml', 'wizard/account_invoice_mark_sent_view.xml',
], ],
'installable': True, 'installable': True,

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # Copyright 2015-2019 Akretion (http://www.akretion.com)
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -27,11 +26,6 @@ class AccountInvoice(models.Model):
partner_bank_id = fields.Many2one(track_visibility='onchange') partner_bank_id = fields.Many2one(track_visibility='onchange')
fiscal_position_id = fields.Many2one(track_visibility='onchange') fiscal_position_id = fields.Many2one(track_visibility='onchange')
amount_total = fields.Monetary(track_visibility='onchange') amount_total = fields.Monetary(track_visibility='onchange')
# for those fields, the 'account' module sets track_visibility='always':
partner_id = fields.Many2one(track_visibility='onchange')
currency_id = fields.Many2one(track_visibility='onchange')
type = fields.Selection(track_visibility='onchange')
amount_untaxed = fields.Monetary(track_visibility='onchange')
# I want to see the number of cancelled invoice in chatter # I want to see the number of cancelled invoice in chatter
move_id = fields.Many2one(track_visibility='onchange') move_id = fields.Many2one(track_visibility='onchange')
# for invoice report # for invoice report
@@ -75,7 +69,7 @@ class AccountInvoice(models.Model):
('res_id', '!=', False)], ['res_id']) ('res_id', '!=', False)], ['res_id'])
for att in search_res: for att in search_res:
att_inv_ids[att['res_id']] = True att_inv_ids[att['res_id']] = True
res = [('id', value and 'in' or 'not in', att_inv_ids.keys())] res = [('id', value and 'in' or 'not in', list(att_inv_ids))]
return res return res
# when you have an invoice created from a lot of sale orders, the 'name' # when you have an invoice created from a lot of sale orders, the 'name'
@@ -103,17 +97,18 @@ class AccountInvoice(models.Model):
# write a rubbish '/' in it ! # write a rubbish '/' in it !
# 2) the 'name' field of the account.move.line is used in the overdue # 2) the 'name' field of the account.move.line is used in the overdue
# letter, and '/' is not meaningful for our customer ! # letter, and '/' is not meaningful for our customer !
@api.multi # TODO mig to v12
def action_move_create(self): # @api.multi
res = super(AccountInvoice, self).action_move_create() # def action_move_create(self):
for inv in self: # res = super(AccountInvoice, self).action_move_create()
self._cr.execute( # for inv in self:
"UPDATE account_move_line SET name= " # self._cr.execute(
"CASE WHEN name='/' THEN %s " # "UPDATE account_move_line SET name= "
"ELSE %s||' - '||name END " # "CASE WHEN name='/' THEN %s "
"WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id)) # "ELSE %s||' - '||name END "
self.invalidate_cache() # "WHERE move_id=%s", (inv.number, inv.number, inv.move_id.id))
return res # self.invalidate_cache()
# return res
def delete_lines_qty_zero(self): def delete_lines_qty_zero(self):
lines = self.env['account.invoice.line'].search([ lines = self.env['account.invoice.line'].search([
@@ -151,8 +146,7 @@ class AccountInvoiceLine(models.Model):
# In the 'account' module, we have related stored field for: # In the 'account' module, we have related stored field for:
# company_id, partner_id, currency_id # company_id, partner_id, currency_id
invoice_type = fields.Selection( invoice_type = fields.Selection(store=True)
related='invoice_id.type', store=True, readonly=True)
date_invoice = fields.Date( date_invoice = fields.Date(
related='invoice_id.date_invoice', store=True, readonly=True) related='invoice_id.date_invoice', store=True, readonly=True)
commercial_partner_id = fields.Many2one( commercial_partner_id = fields.Many2one(
@@ -187,20 +181,6 @@ class AccountJournal(models.Model):
res.append((journal.id, name)) res.append((journal.id, name))
return res return res
# Also search on start of 'code', not only on 'name'
@api.model
def name_search(
self, name='', args=None, operator='ilike', limit=80):
if args is None:
args = []
if name:
jrls = self.search(
[('code', '=ilike', name + '%')] + args, limit=limit)
if jrls:
return jrls.name_get()
return super(AccountJournal, self).name_search(
name=name, args=args, operator=operator, limit=limit)
@api.constrains('default_credit_account_id', 'default_debit_account_id') @api.constrains('default_credit_account_id', 'default_debit_account_id')
def _check_account_type_on_bank_journal(self): def _check_account_type_on_bank_journal(self):
bank_acc_type = self.env.ref('account.data_account_type_liquidity') bank_acc_type = self.env.ref('account.data_account_type_liquidity')
@@ -230,6 +210,7 @@ class AccountAccount(models.Model):
_inherit = 'account.account' _inherit = 'account.account'
@api.multi @api.multi
@api.depends('name', 'code')
def name_get(self): def name_get(self):
if self._context.get('account_account_show_code_only'): if self._context.get('account_account_show_code_only'):
res = [] res = []
@@ -240,6 +221,7 @@ class AccountAccount(models.Model):
return super(AccountAccount, self).name_get() return super(AccountAccount, self).name_get()
# https://github.com/odoo/odoo/issues/23040 # https://github.com/odoo/odoo/issues/23040
# TODO mig to v12
def fix_bank_account_types(self): def fix_bank_account_types(self):
aao = self.env['account.account'] aao = self.env['account.account']
companies = self.env['res.company'].search([]) companies = self.env['res.company'].search([])
@@ -277,6 +259,7 @@ class AccountAccount(models.Model):
logger.info("END of the script 'fix bank and cash account types'") logger.info("END of the script 'fix bank and cash account types'")
return True return True
# TODO mig to v12
@api.model @api.model
def create_account_groups(self, level=2, name_prefix=u'Comptes '): def create_account_groups(self, level=2, name_prefix=u'Comptes '):
'''Should be launched by a script. Make sure the account_group module is installed '''Should be launched by a script. Make sure the account_group module is installed
@@ -379,7 +362,6 @@ class AccountMoveLine(models.Model):
# Update field only to add a string (there is no string in account module) # Update field only to add a string (there is no string in account module)
invoice_id = fields.Many2one(string='Invoice') invoice_id = fields.Many2one(string='Invoice')
date_maturity = fields.Date(copy=False)
account_reconcile = fields.Boolean( account_reconcile = fields.Boolean(
related='account_id.reconcile', readonly=True) related='account_id.reconcile', readonly=True)
full_reconcile_id = fields.Many2one(string='Full Reconcile') full_reconcile_id = fields.Many2one(string='Full Reconcile')
@@ -544,7 +526,6 @@ class AccountBankStatementLine(models.Model):
vals['ref'] = False vals['ref'] = False
return vals return vals
@api.multi
def show_account_move(self): def show_account_move(self):
self.ensure_one() self.ensure_one()
action = self.env['ir.actions.act_window'].for_xml_id( action = self.env['ir.actions.act_window'].for_xml_id(
@@ -565,8 +546,7 @@ class AccountBankStatementLine(models.Model):
class AccountFiscalPosition(models.Model): class AccountFiscalPosition(models.Model):
_inherit = 'account.fiscal.position' _inherit = 'account.fiscal.position'
note = fields.Text(translate=True) # TODO mig to v12 ?
@api.model @api.model
def get_fiscal_position_no_partner( def get_fiscal_position_no_partner(
self, company_id=None, vat_subjected=False, country_id=None): self, company_id=None, vat_subjected=False, country_id=None):

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # Copyright 2018-2019 Akretion (http://www.akretion.com)
# Copyright 2018 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

View File

@@ -21,7 +21,7 @@
<field name="user_id"/> <field name="user_id"/>
<field name="product_id"/> <field name="product_id"/>
<field name="product_qty" sum="1"/> <field name="product_qty" sum="1"/>
<field name="uom_name" groups="product.group_uom"/> <field name="uom_name" groups="uom.group_uom"/>
<field name="price_total" sum="1"/> <field name="price_total" sum="1"/>
<field name="state"/> <field name="state"/>
</tree> </tree>

View File

@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2018 Akretion (http://www.akretion.com/) Copyright 2018-2019 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<odoo> <odoo>
<record id="account.account_invoices" model="ir.actions.report.xml"> <record id="account.account_invoices" model="ir.actions.report">
<!-- Don't attach on supplier invoices/refunds ! --> <!-- 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> <field name="attachment">(object.type in ('out_invoice', 'out_refund')) and (object.state in ('open','in_payment','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')</field>
</record> </record>
</odoo> </odoo>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2015-2016 Akretion (http://www.akretion.com/) Copyright 2015-2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -42,12 +42,13 @@
<field name="base" readonly="1"/> <field name="base" readonly="1"/>
</xpath> </xpath>
<!-- Warning: there are 2 invoice_print buttons in the native view... probably a bug --> <!-- Warning: there are 2 invoice_print buttons in the native view... probably a bug -->
<!--
<xpath expr="//button[@name='invoice_print']" position="attributes"> <xpath expr="//button[@name='invoice_print']" position="attributes">
<attribute name="attrs">{'invisible': [('state', 'not in', ('open', 'paid'))]}</attribute> <attribute name="attrs">{'invisible': [('state', 'not in', ('open', 'paid'))]}</attribute>
</xpath> </xpath>
<xpath expr="//button[@name='invoice_print'][2]" position="attributes"> <xpath expr="//button[@name='invoice_print'][2]" position="attributes">
<attribute name="attrs">{'invisible': True}</attribute> <attribute name="attrs">{'invisible': True}</attribute>
</xpath> </xpath> -->
</field> </field>
</record> </record>
@@ -193,17 +194,6 @@ module -->
<field name="context">{'show_invoice_fields': True}</field> <field name="context">{'show_invoice_fields': True}</field>
</record> </record>
<record id="view_account_invoice_report_search" model="ir.ui.view">
<field name="name">usability.account.invoice.report.search</field>
<field name="model">account.invoice.report</field>
<field name="inherit_id" ref="account.view_account_invoice_report_search"/>
<field name="arch" type="xml">
<field name="categ_id" position="after">
<field name="product_id"/>
</field>
</field>
</record>
<record id="account_invoice_report_tree" model="ir.ui.view"> <record id="account_invoice_report_tree" model="ir.ui.view">
<field name="name">usability.account.invoice.report.tree</field> <field name="name">usability.account.invoice.report.tree</field>
<field name="model">account.invoice.report</field> <field name="model">account.invoice.report</field>
@@ -272,20 +262,15 @@ module -->
<field name="context">{'journal_show_code_only': True}</field> <field name="context">{'journal_show_code_only': True}</field>
</record> </record>
<!-- remove base.group_no_one on Journal Items--> <!-- replace group_account_manager on Journal Items-->
<record id="account.menu_action_account_moves_all" model="ir.ui.menu"> <record id="account.menu_action_account_moves_all" model="ir.ui.menu">
<field name="groups_id" eval="[(6, 0, [ref('account.group_account_user')])]"/> <field name="groups_id" eval="[(6, 0, [ref('account.group_account_user')])]"/>
</record> </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 --> <!-- model account.move / Journal Entries -->
<record id="account.action_move_journal_line" model="ir.actions.act_window"> <record id="account.action_move_journal_line" model="ir.actions.act_window">
<field name="limit">200</field> <field name="limit">200</field>
<field name="context">{}</field> <!-- Don't filter by default on misc journal --> <field name="context">{'view_no_maturity': True}</field> <!-- Don't filter by default on misc journal -->
</record> </record>
<record id="view_move_form" model="ir.ui.view"> <record id="view_move_form" model="ir.ui.view">
@@ -293,11 +278,11 @@ module -->
<field name="model">account.move</field> <field name="model">account.move</field>
<field name="inherit_id" ref="account.view_move_form"/> <field name="inherit_id" ref="account.view_move_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="ref" position="after"> <field name="journal_id" position="after">
<field name="default_move_line_name"/> <field name="default_move_line_name"/>
<field name="default_account_id" invisible="1"/> <field name="default_account_id" invisible="1"/>
<field name="default_credit" invisible="0"/> <field name="default_credit" invisible="1"/>
<field name="default_debit" invisible="0"/> <field name="default_debit" invisible="1"/>
</field> </field>
<xpath expr="//field[@name='line_ids']" position="attributes"> <xpath expr="//field[@name='line_ids']" position="attributes">
<attribute name="context" operation="python_dict" key="default_name">default_move_line_name</attribute> <attribute name="context" operation="python_dict" key="default_name">default_move_line_name</attribute>
@@ -355,7 +340,7 @@ module -->
<field name="reconciled" invisible="1"/> <field name="reconciled" invisible="1"/>
<button name="open_reconcile_view" class="oe_link" type="object" <button name="open_reconcile_view" class="oe_link" type="object"
string="-> View partially reconciled entries" colspan="2" string="-> View partially reconciled entries" colspan="2"
attrs="{'invisible': ['|', ('full_reconcile_id', '!=', False), '&amp;', ('matched_debit_ids', '=', []),('matched_credit_ids', '=', [])]}"/> attrs="{'invisible': ['|', ('full_reconcile_id', '!=', False), '&amp;', ('matched_debit_ids', '=', []), ('matched_credit_ids', '=', [])]}"/>
<span colspan="2" attrs="{'invisible': ['|', '|', ('full_reconcile_id', '!=', False), ('matched_debit_ids', '!=', []), ('matched_credit_ids', '!=', [])]}" class="o_form_field">No Partial Reconcile</span> <span colspan="2" attrs="{'invisible': ['|', '|', ('full_reconcile_id', '!=', False), ('matched_debit_ids', '!=', []), ('matched_credit_ids', '!=', [])]}" class="o_form_field">No Partial Reconcile</span>
</xpath> </xpath>
<xpath expr="//label[@for='full_reconcile_id']/.." position="attributes"> <xpath expr="//label[@for='full_reconcile_id']/.." position="attributes">
@@ -435,9 +420,6 @@ module -->
<field name="model">account.bank.statement</field> <field name="model">account.bank.statement</field>
<field name="inherit_id" ref="account.view_bank_statement_form"/> <field name="inherit_id" ref="account.view_bank_statement_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<button name="button_cancel" position="attributes">
<attribute name="invisible">1</attribute>
</button>
<xpath expr="//field[@name='line_ids']/tree/field[@name='bank_account_id']" position="after"> <xpath expr="//field[@name='line_ids']/tree/field[@name='bank_account_id']" position="after">
<!-- The cancel button is provided by the account_cancel module, but we don't want to depend on it --> <!-- The cancel button is provided by the account_cancel module, but we don't want to depend on it -->
<button name="show_account_move" type="object" <button name="show_account_move" type="object"
@@ -481,10 +463,10 @@ module -->
<field name="start_date"/> <field name="start_date"/>
<field name="end_date"/> <field name="end_date"/>
</field> </field>
<filter context="{'group_by': 'date'}" position="attributes"> <filter name="date" position="attributes">
<attribute name="invisible">1</attribute> <attribute name="invisible">1</attribute>
</filter> </filter>
<filter context="{'group_by': 'date'}" position="after"> <filter name="date" position="after">
<filter name="start_date_groupby" string="Start Date" <filter name="start_date_groupby" string="Start Date"
context="{'group_by': 'start_date'}"/> context="{'group_by': 'start_date'}"/>
<filter name="end_date_groupby" string="End Date" <filter name="end_date_groupby" string="End Date"
@@ -534,11 +516,6 @@ because it is useless and confusing -->
<field name="groups_id" eval="[(6, 0, [ref('base_usability.group_nobody')])]"/> <field name="groups_id" eval="[(6, 0, [ref('base_usability.group_nobody')])]"/>
</record> </record>
<!-- Remove menu entry "Accounting > Reports > PDF Reports" as there are broken -->
<record id="account.menu_finance_legal_statement" model="ir.ui.menu">
<field name="groups_id" eval="[(6, 0, [ref('base_usability.group_nobody')])]"/>
</record>
<!-- Duplicate the menu "Sales > Configuration > Contacts > Bank Accounts" <!-- Duplicate the menu "Sales > Configuration > Contacts > Bank Accounts"
under "Accounting > Configuration", because most users will try to find it there --> under "Accounting > Configuration", because most users will try to find it there -->
<menuitem id="bank_account_account_config_menu" name="Bank Accounts" parent="account.menu_finance_configuration" sequence="9"/> <menuitem id="bank_account_account_config_menu" name="Bank Accounts" parent="account.menu_finance_configuration" sequence="9"/>

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion France (https://akretion.com/)
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields from odoo import models, fields

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2017 Akretion (http://www.akretion.com/) Copyright 2017-2019 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -16,9 +16,6 @@
<field name="property_account_position_id" position="attributes"> <field name="property_account_position_id" position="attributes">
<attribute name="widget">selection</attribute> <attribute name="widget">selection</attribute>
</field> </field>
<group name="accounting_entries" position="attributes">
<attribute name="groups">account.group_account_user</attribute>
</group>
</field> </field>
</record> </record>

View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2017 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_category_property_form" model="ir.ui.view">
<field name="name">account_usability.product.category.form</field>
<field name="model">product.category</field>
<field name="inherit_id" ref="account.view_category_property_form"/>
<field name="arch" type="xml">
<!-- On product form view, the group for Invoicing tab is limited to account.group_account_invoice... but on product category form, it is limited to account.group_account_manager -> we fix this and also use account.group_account_invoice -->
<group name="account_property" position="attributes">
<attribute name="groups">account.group_account_invoice</attribute>
</group>
</field>
</record>
</odoo>

View File

@@ -1,4 +1,2 @@
# -*- encoding: utf-8 -*-
from . import account_invoice_mark_sent from . import account_invoice_mark_sent
from . import account_move_reversal from . import account_move_reversal

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion France (https://akretion.com/en)
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models from odoo import models

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2017-2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) Copyright 2017-2019 Akretion France
@author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -16,7 +17,7 @@
</p> </p>
<footer> <footer>
<button type="object" name="run" string="Mark as Sent" class="btn-primary"/> <button type="object" name="run" string="Mark as Sent" class="btn-primary"/>
<button special="cancel" string="Cancel" class="oe_link"/> <button special="cancel" string="Cancel"/>
</footer> </footer>
</form> </form>
</field> </field>

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2018-2019 Akretion France (https://akretion.com/)
# Copyright 2018 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models from odoo import api, fields, models

View File

@@ -1,4 +1,2 @@
# -*- coding: utf-8 -*-
from . import sale_stock from . import sale_stock
from . import wizard from . import wizard

View File

@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*- # Copyright 2015-2019 Akretion (http://www.akretion.com)
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Sale Stock Usability', 'name': 'Sale Stock Usability',
'version': '10.0.1.0.3', 'version': '12.0.1.0.0',
'category': 'Sales Management', 'category': 'Sales Management',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Small usability improvements to the sale_stock module', 'summary': 'Small usability improvements to the sale_stock module',
@@ -16,8 +15,7 @@ Sale Stock Usability
The usability enhancements include: The usability enhancements include:
* *To invoice* filter on pickings filters on invoice_state = 2binvoiced AND state = done * TODO update the list
* Add a tab with the list of related pickings in sale order form
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>. This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
""", """,

View File

@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*- # Copyright 2015-2019 Akretion France (http://www.akretion.com)
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields from odoo import models, fields
class SaleOrder(models.Model): class SaleOrder(models.Model):

View File

@@ -1,28 +1,13 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2015-2016 Akretion (http://www.akretion.com/) Copyright 2015-2019 Akretion France (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
<odoo> <odoo>
<!-- the truck icon is probably enough
<record id="view_order_form_inherit" model="ir.ui.view">
<field name="name">sale_stock_usability.sale_order_form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale_stock.view_order_form_inherit"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Delivery Orders" states="progress,waiting_date,manual,invoice_except,shipping_except,done">
<field name="picking_ids" nolabel="1"/>
</page>
</notebook>
</field>
</record>
-->
<record id="view_picking_form" model="ir.ui.view"> <record id="view_picking_form" model="ir.ui.view">
<field name="name">sale_stock_usability.stock.picking.form</field> <field name="name">sale_stock_usability.stock.picking.form</field>
<field name="model">stock.picking</field> <field name="model">stock.picking</field>
@@ -34,4 +19,15 @@
</field> </field>
</record> </record>
<record id="view_move_form" model="ir.ui.view">
<field name="name">sale_stock_usability.stock_move.form</field>
<field name="model">stock.move</field>
<field name="inherit_id" ref="stock.view_move_form"/>
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="sale_line_id" readonly="1"/>
</field>
</field>
</record>
</odoo> </odoo>

View File

@@ -1,3 +1 @@
# -*- coding: utf-8 -*-
from . import stock_return_picking from . import stock_return_picking

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion France (https://akretion.com/)
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, api from odoo import models, api

View File

@@ -1,5 +1,3 @@
# -*- coding: utf-8 -*-
from . import sale from . import sale
from . import account_invoice from . import account_invoice
from . import product from . import product

View File

@@ -1,19 +1,18 @@
# -*- coding: utf-8 -*- # Copyright 2014-2019 Akretion (http://www.akretion.com)
# © 2014-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Sale Usability', 'name': 'Sale Usability',
'version': '10.0.0.1.0', 'version': '12.0.1.0.0',
'category': 'Sales', 'category': 'Sales',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Show invoices on sale orders', 'summary': 'Usability improvements on sale module',
'description': """ 'description': """
Sale Usability Extension Sale Usability
======================== ==============
Several small usability improvements: This module provides several small usability improvements on the official *sale* module:
* Display amount untaxed in tree view * Display amount untaxed in tree view
* TODO: update this list * TODO: update this list
@@ -23,12 +22,14 @@ This module has been written by Alexis de Lattre from Akretion
""", """,
'author': 'Akretion', 'author': 'Akretion',
'website': 'http://www.akretion.com', 'website': 'http://www.akretion.com',
'depends': ['sale'], 'depends': [
'sale',
'base_view_inheritance_extension',
],
'data': [ 'data': [
'sale_view.xml', 'sale_view.xml',
'sale_report_view.xml', 'sale_report_view.xml',
'product_view.xml', 'product_view.xml',
'security/ir.model.access.csv',
], ],
'installable': True, 'installable': True,
} }

View File

@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # Copyright 2017-2019 Akretion France (https://akretion.com/)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields from odoo import models, fields

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion France
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author: Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields from odoo import models, fields
@@ -8,7 +8,7 @@ from odoo import models, fields
class ProductTemplate(models.Model): class ProductTemplate(models.Model):
_inherit = 'product.template' _inherit = 'product.template'
track_service = fields.Selection(track_visibility='onchange') service_type = fields.Selection(track_visibility='onchange')
expense_policy = fields.Selection(track_visibility='onchange') expense_policy = fields.Selection(track_visibility='onchange')
invoice_policy = fields.Selection(track_visibility='onchange') invoice_policy = fields.Selection(track_visibility='onchange')
sale_line_warn = fields.Selection(track_visibility='onchange') sale_line_warn = fields.Selection(track_visibility='onchange')

View File

@@ -18,8 +18,9 @@ because the parent menu entry is in the sale module -->
<!-- This menu entry is very useful for mass export/import of prices --> <!-- This menu entry is very useful for mass export/import of prices -->
<menuitem id="product_pricelist_item_menu" <menuitem id="product_pricelist_item_menu"
parent="sale.menu_product_pricelist_main" parent="sale.product_menu_catalog"
action="product_pricelist_item_action" action="product_pricelist_item_action"
groups="product.group_pricelist_item"
sequence="50"/> sequence="50"/>

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*- # Copyright (C) 2015-2019 Akretion France (http://www.akretion.com)
# Copyright (C) 2015 Akretion (http://www.akretion.com) # @author Alexis de Lattre <alexis.delattre@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 from odoo import models, fields, api
from odoo.tools import float_is_zero from odoo.tools import float_is_zero
@@ -11,11 +11,10 @@ class SaleOrder(models.Model):
_inherit = 'sale.order' _inherit = 'sale.order'
date_order = fields.Datetime(track_visibility='onchange') date_order = fields.Datetime(track_visibility='onchange')
date_confirm = fields.Date(track_visibility='onchange') confirmation_date = fields.Datetime(track_visibility='onchange')
client_order_ref = fields.Char(track_visibility='onchange') client_order_ref = fields.Char(track_visibility='onchange')
# for partner_id, the 'sale' module sets track_visibility='always' # for partner_id, the 'sale' module sets track_visibility='always'
partner_id = fields.Many2one(track_visibility='onchange') partner_id = fields.Many2one(track_visibility='onchange')
# for amount_tax, the 'sale' module sets track_visibility='always'
amount_tax = fields.Monetary(track_visibility='onchange') amount_tax = fields.Monetary(track_visibility='onchange')
partner_shipping_id = fields.Many2one(track_visibility='onchange') partner_shipping_id = fields.Many2one(track_visibility='onchange')
partner_invoice_id = fields.Many2one(track_visibility='onchange') partner_invoice_id = fields.Many2one(track_visibility='onchange')
@@ -37,21 +36,6 @@ class SaleOrder(models.Model):
break break
order.has_discount = has_discount order.has_discount = has_discount
@api.multi
def action_confirm(self):
'''Reload view upon order confirmation to display the 3 qty cols'''
res = super(SaleOrder, self).action_confirm()
if len(self) == 1:
res = self.env['ir.actions.act_window'].for_xml_id(
'sale', 'action_orders')
res.update({
'view_mode': 'form,tree,kanban,calendar,pivot,graph',
'res_id': self.id,
'views': False,
'context': {'hide_sale': False},
})
return res
# for report # for report
@api.multi @api.multi
def py3o_lines_layout(self): def py3o_lines_layout(self):
@@ -88,11 +72,3 @@ class SaleOrder(models.Model):
# {'subtotal': 8932.23}, # {'subtotal': 8932.23},
# ] # ]
return res2 return res2
class ProcurementGroup(models.Model):
_inherit = 'procurement.group'
sale_ids = fields.One2many(
'sale.order', 'procurement_group_id', string='Sale Orders',
readonly=True)

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright 2018 Akretion (http://www.akretion.com/) Copyright 2018-2019 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -21,7 +21,7 @@
<field name="product_uom_qty" sum="1"/> <field name="product_uom_qty" sum="1"/>
<field name="qty_delivered" sum="1"/> <field name="qty_delivered" sum="1"/>
<field name="qty_to_invoice" sum="1"/> <field name="qty_to_invoice" sum="1"/>
<field name="product_uom" groups="product.group_uom"/> <field name="product_uom" groups="uom.group_uom"/>
<field name="price_subtotal" sum="1"/> <field name="price_subtotal" sum="1"/>
<field name="state"/> <field name="state"/>
</tree> </tree>

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2015-2016 Akretion (http://www.akretion.com/) Copyright 2015-2019 Akretion France (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com> @author: Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -12,17 +12,11 @@
<field name="model">sale.order</field> <field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/> <field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<notebook position="inside">
<page string="Invoices" states="progress,waiting_date,manual,invoice_except,shipping_except,done">
<field name="invoice_ids" nolabel="1" context="{'form_view_ref': 'account.invoice_form'}"/>
</page>
</notebook>
<field name="fiscal_position_id" position="attributes"> <field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute> <attribute name="widget">selection</attribute>
</field> </field>
<field name="partner_shipping_id" position="attributes"> <field name="partner_shipping_id" position="attributes">
<attribute name="context">{'show_address': 1, 'default_type': 'delivery'}</attribute> <attribute name="context" operation="python_dict" key="show_address">1</attribute>
<attribute name="options">{'always_reload': True}</attribute>
</field> </field>
<button name="action_cancel" type="object" position="attributes"> <button name="action_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this sale order?</attribute> <attribute name="confirm">Are you sure you want to cancel this sale order?</attribute>
@@ -41,7 +35,7 @@
<field name="inherit_id" ref="sale.view_quotation_tree"/> <field name="inherit_id" ref="sale.view_quotation_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="amount_total" position="before"> <field name="amount_total" position="before">
<field name="amount_untaxed" sum="Total Untaxed" widget="monetary"/> <field name="amount_untaxed" sum="Total Untaxed"/>
</field> </field>
</field> </field>
</record> </record>
@@ -52,13 +46,7 @@
<field name="inherit_id" ref="sale.view_order_tree"/> <field name="inherit_id" ref="sale.view_order_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="amount_total" position="before"> <field name="amount_total" position="before">
<field name="amount_untaxed" sum="Total Untaxed" widget="monetary"/> <field name="amount_untaxed" sum="Total Untaxed"/>
</field>
<field name="date_order" position="attributes">
<attribute name="invisible">1</attribute>
</field>
<field name="date_order" position="after">
<field name="confirmation_date"/>
</field> </field>
</field> </field>
</record> </record>
@@ -68,7 +56,7 @@
<field name="model">sale.order</field> <field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_sales_order_filter"/> <field name="inherit_id" ref="sale.view_sales_order_filter"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter context="{'group_by':'date_order'}" position="after"> <filter name="order_month" position="after">
<filter string="Order Confirmation Month" name="confirmation_date_groupby" context="{'group_by': 'confirmation_date'}"/> <filter string="Order Confirmation Month" name="confirmation_date_groupby" context="{'group_by': 'confirmation_date'}"/>
<filter string="State" name="state_groupby" context="{'group_by': 'state'}"/> <filter string="State" name="state_groupby" context="{'group_by': 'state'}"/>
</filter> </filter>
@@ -81,6 +69,10 @@ https://github.com/odoo/odoo/commit/c1e5ab9b1331c3cb7dc2232bf78952bdb40ad939 -->
<field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field> <field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field>
</record> </record>
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window">
<field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field>
</record>
<record id="sale.action_quotations_salesteams" model="ir.actions.act_window"> <record id="sale.action_quotations_salesteams" model="ir.actions.act_window">
<field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field> <field name="domain">[('state', 'in', ('draft', 'sent', 'cancel'))]</field>
</record> </record>
@@ -90,9 +82,9 @@ https://github.com/odoo/odoo/commit/c1e5ab9b1331c3cb7dc2232bf78952bdb40ad939 -->
<field name="model">sale.order.line</field> <field name="model">sale.order.line</field>
<field name="inherit_id" ref="sale.view_sales_order_line_filter"/> <field name="inherit_id" ref="sale.view_sales_order_line_filter"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<group expand="0" position="inside"> <filter name="product" position="before">
<filter string="Customer" context="{'group_by': 'order_partner_id'}"/> <filter string="Customer" name="partner_groupby" context="{'group_by': 'order_partner_id'}"/>
</group> </filter>
</field> </field>
</record> </record>
@@ -117,29 +109,4 @@ https://github.com/odoo/odoo/commit/c1e5ab9b1331c3cb7dc2232bf78952bdb40ad939 -->
</record> </record>
<record id="procurement_form_view" model="ir.ui.view">
<field name="name">procurement_usability.procurement.order.form</field>
<field name="model">procurement.order</field>
<field name="inherit_id" ref="procurement.procurement_form_view"/>
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="sale_line_id" readonly="True"/>
</field>
</field>
</record>
<record id="procurement_group_form_view" model="ir.ui.view">
<field name="name">sale_usability.procurement.group.form</field>
<field name="model">procurement.group</field>
<field name="inherit_id" ref="procurement.procurement_group_form_view"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='move_type']/.." position="after">
<group name="sale" string="Sale Orders">
<field name="sale_ids" nolabel="1"/>
</group>
</xpath>
</field>
</record>
</odoo> </odoo>

View File

@@ -1,3 +0,0 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
sale.access_product_uom_categ_sale_manager,product.uom.categ for settings grp,product.model_product_uom_categ,base.group_system,1,1,1,1
sale.access_product_uom_sale_manager,product.uom for settings grp,product.model_product_uom,base.group_system,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 sale.access_product_uom_categ_sale_manager product.uom.categ for settings grp product.model_product_uom_categ base.group_system 1 1 1 1
3 sale.access_product_uom_sale_manager product.uom for settings grp product.model_product_uom base.group_system 1 1 1 1

View File

@@ -0,0 +1 @@
from . import wizard

View File

@@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Copyright 2019 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': 'Stock Account Usability',
'version': '12.0.1.0.0',
'category': 'Hidden',
'license': 'AGPL-3',
'summary': 'Several usability enhancements on stock_account',
'description': """
Stock Account Usability
=======================
The usability enhancements include:
* TODO update the list
This module has been written by Alexis de Lattre from Akretion <alexis.delattre@akretion.com>.
""",
'author': 'Akretion',
'website': 'http://www.akretion.com',
'depends': ['stock_account'],
'data': [],
'installable': True,
}

View File

@@ -0,0 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2019 Akretion France (https://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
class StockReturnPickingLine(models.TransientModel):
_inherit = 'stock.return.picking.line'
to_refund = fields.Boolean(default=True)

View File

@@ -1,12 +1,11 @@
# -*- coding: utf-8 -*- # Copyright 2014-2019 Akretion (http://www.akretion.com)
# © 2014-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{ {
'name': 'Stock Usability', 'name': 'Stock Usability',
'version': '10.0.1.0.0', 'version': '12.0.1.0.0',
'category': 'Inventory, Logistic, Storage', 'category': 'Inventory, Logistic, Storage',
'license': 'AGPL-3', 'license': 'AGPL-3',
'summary': 'Several usability enhancements in Warehouse management', 'summary': 'Several usability enhancements in Warehouse management',

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*- # Copyright 2017-2019 Akretion France (https://akretion.com/)
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>) # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models, fields from odoo import models, fields

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # Copyright 2015-2019 Akretion (http://www.akretion.com)
# © 2015-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -10,28 +9,22 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class ProcurementOrder(models.Model): class ProcurementGroup(models.Model):
_inherit = 'procurement.order' _inherit = 'procurement.group'
@api.model @api.model
def _procure_orderpoint_confirm( def _procure_orderpoint_confirm(
self, use_new_cursor=False, company_id=False): self, use_new_cursor=False, company_id=False):
logger.info( logger.info(
'procurement scheduler: START to create procurements from ' 'procurement scheduler: START to create moves from '
'orderpoints') 'orderpoints')
res = super(ProcurementOrder, self)._procure_orderpoint_confirm( res = super(ProcurementGroup, self)._procure_orderpoint_confirm(
use_new_cursor=use_new_cursor, company_id=company_id) use_new_cursor=use_new_cursor, company_id=company_id)
logger.info( logger.info(
'procurement scheduler: END creation of procurements from ' 'procurement scheduler: END creation of moves from '
'orderpoints') 'orderpoints')
return res return res
# Why is this code in stock_usability and not in procurement_usability ?
# For a very good reason
# The stock module inherits run_scheduler(). So, if we want to have the
# START and END log message and a good end date
# for procurement.scheduler.log, the method below must be called first,
# so we must be "above" all modules that call run_scheduler()
@api.model @api.model
def run_scheduler( def run_scheduler(
self, use_new_cursor=False, company_id=False): self, use_new_cursor=False, company_id=False):
@@ -41,7 +34,7 @@ class ProcurementOrder(models.Model):
'(company ID=%d, uid=%d, use_new_cursor=%s)', '(company ID=%d, uid=%d, use_new_cursor=%s)',
company_id, self._uid, use_new_cursor) company_id, self._uid, use_new_cursor)
start_datetime = datetime.now() start_datetime = datetime.now()
res = super(ProcurementOrder, self).run_scheduler( res = super(ProcurementGroup, self).run_scheduler(
use_new_cursor=use_new_cursor, company_id=company_id) use_new_cursor=use_new_cursor, company_id=company_id)
logger.info( logger.info(
'END procurement scheduler ' 'END procurement scheduler '

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2015-2016 Akretion (http://www.akretion.com/) Copyright 2015-2019 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -10,33 +10,11 @@
<record id="procurement_group_form_view" model="ir.ui.view"> <record id="procurement_group_form_view" model="ir.ui.view">
<field name="name">stock_usability.procurement.group.form</field> <field name="name">stock_usability.procurement.group.form</field>
<field name="model">procurement.group</field> <field name="model">procurement.group</field>
<field name="inherit_id" ref="stock.procurement_group_form_view_herited"/> <field name="inherit_id" ref="stock.procurement_group_form_view"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="move_type" position="after"> <field name="move_type" position="after">
<field name="partner_id" readonly="True"/> <field name="partner_id" readonly="True"/>
</field> </field>
<xpath expr="//field[@name='move_type']/.." position="after">
<group name="picking" string="Pickings">
<field name="picking_ids" nolabel="1"/>
</group>
</xpath>
</field>
</record>
<record id="view_procurement_form_stock_inherit" model="ir.ui.view">
<field name="name">procurement_usability.procurement.order.form</field>
<field name="model">procurement.order</field>
<field name="inherit_id" ref="stock.view_procurement_form_stock_inherit"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='company_id']/.." position="after">
<group name="move_ids" string="Stock Moves" colspan="4">
<field name="move_ids" nolabel="1" readonly="True"/>
</group>
</xpath>
<field name="partner_dest_id" position="before">
<field name="orderpoint_id" readonly="1"/>
<field name="move_dest_id" groups="base.group_no_one" readonly="1"/>
</field>
</field> </field>
</record> </record>
@@ -61,6 +39,6 @@
<menuitem id="procurement_scheduler_log_menu" <menuitem id="procurement_scheduler_log_menu"
action="procurement_scheduler_log_action" action="procurement_scheduler_log_action"
parent="stock.menu_stock_sched" sequence="22"/> parent="stock.menu_stock_inventory_control" sequence="50"/>
</odoo> </odoo>

View File

@@ -3,5 +3,3 @@ 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_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_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 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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
3 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
4 access_procurement_scheduler_log_read Read access on procurement.scheduler.log to Employee model_procurement_scheduler_log base.group_user 1 0 0 0
5 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

View File

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*- # Copyright 2014-2019 Akretion (http://www.akretion.com)
# © 2014-2016 Akretion (http://www.akretion.com)
# @author Alexis de Lattre <alexis.delattre@akretion.com> # @author Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
@@ -9,11 +8,6 @@ import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class StockInventory(models.Model):
_inherit = 'stock.inventory'
_order = 'id desc'
class StockPicking(models.Model): class StockPicking(models.Model):
_inherit = 'stock.picking' _inherit = 'stock.picking'
_order = 'id desc' _order = 'id desc'
@@ -24,13 +18,6 @@ class StockPicking(models.Model):
picking_type_id = fields.Many2one(track_visibility='onchange') picking_type_id = fields.Many2one(track_visibility='onchange')
move_type = fields.Selection(track_visibility='onchange') move_type = fields.Selection(track_visibility='onchange')
@api.multi
def force_assign(self):
res = super(StockPicking, self).force_assign()
for pick in self:
pick.message_post(_("Using <b>Force Availability</b>!"))
return res
@api.multi @api.multi
def do_unreserve(self): def do_unreserve(self):
res = super(StockPicking, self).do_unreserve() res = super(StockPicking, self).do_unreserve()
@@ -39,18 +26,6 @@ class StockPicking(models.Model):
return res return res
class StockLocation(models.Model):
_inherit = 'stock.location'
name = fields.Char(translate=False)
# with the 'quant_ids' field below, you can for example search empty stock
# locations with self.env['stock.location'].search([
# ('child_ids', '=', False), ('quant_ids', '=', False),
# ('usage', '=', 'internal')])
quant_ids = fields.One2many(
'stock.quant', 'location_id', string="Related Quants")
class StockPickingType(models.Model): class StockPickingType(models.Model):
_inherit = 'stock.picking.type' _inherit = 'stock.picking.type'
@@ -94,14 +69,6 @@ class StockWarehouseOrderpoint(models.Model):
class StockMove(models.Model): class StockMove(models.Model):
_inherit = 'stock.move' _inherit = 'stock.move'
# It seems that it is not necessary any more to
# have the digits= on these 2 fields to fix the bug
# https://github.com/odoo/odoo/pull/10038
# reserved_availability = fields.Float(
# digits=dp.get_precision('Product Unit of Measure'))
# availability = fields.Float(
# digits=dp.get_precision('Product Unit of Measure'))
@api.multi @api.multi
def name_get(self): def name_get(self):
'''name_get of stock_move is important for the reservation of the '''name_get of stock_move is important for the reservation of the
@@ -117,38 +84,27 @@ class StockMove(models.Model):
if line.partner_id: if line.partner_id:
name = line.partner_id.name + ' ' + name name = line.partner_id.name + ' ' + name
if line.date_expected: if line.date_expected:
date_expec_dt = fields.Datetime.from_string(line.date_expected) name = name + ' ' + line.date_expected
name = name + ' ' + fields.Date.to_string(date_expec_dt)
res.append((line.id, name)) res.append((line.id, name))
return res return res
def button_do_unreserve(self): # def button_do_unreserve(self):
for move in self: # for move in self:
move.do_unreserve() # move.do_unreserve()
if move.picking_id: # if move.picking_id:
product = move.product_id # product = move.product_id
self.picking_id.message_post(_( # self.picking_id.message_post(_(
"Product <a href=# data-oe-model=product.product " # "Product <a href=# data-oe-model=product.product "
"data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>") # "data-oe-id=%d>%s</a> qty %s %s <b>unreserved</b>")
% (product.id, product.display_name, # % (product.id, product.display_name,
move.product_qty, move.product_id.uom_id.name)) # move.product_qty, move.product_id.uom_id.name))
ops = self.env['stock.pack.operation'] # ops = self.env['stock.pack.operation']
for smol in move.linked_move_operation_ids: # for smol in move.linked_move_operation_ids:
if smol.operation_id: # if smol.operation_id:
ops += smol.operation_id # ops += smol.operation_id
ops.unlink() # ops.unlink()
class StockIncoterms(models.Model):
_inherit = 'stock.incoterms'
@api.multi
def name_get(self):
res = []
for inco in self:
res.append((inco.id, u'[%s] %s' % (inco.code, inco.name)))
return res
class ProcurementGroup(models.Model): class ProcurementGroup(models.Model):
_inherit = 'procurement.group' _inherit = 'procurement.group'

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
© 2014-2016 Akretion (http://www.akretion.com/) Copyright 2014-2019 Akretion (http://www.akretion.com/)
@author Alexis de Lattre <alexis.delattre@akretion.com> @author Alexis de Lattre <alexis.delattre@akretion.com>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
--> -->
@@ -16,27 +16,15 @@
<field name="backorder_id" position="attributes"> <field name="backorder_id" position="attributes">
<attribute name="attrs">{}</attribute> <attribute name="attrs">{}</attribute>
</field> </field>
<field name="min_date" position="after">
<field name="date_done" states="done"/>
</field>
<field name="partner_id" position="attributes"> <field name="partner_id" position="attributes">
<attribute name="context">{'show_address': 1}</attribute> <attribute name="context">{'show_address': 1}</attribute>
<attribute name="options">{'always_reload': True}</attribute> <attribute name="options">{'always_reload': True}</attribute>
</field> </field>
<!-- Maybe it's usefull to always display stock pack operations...
or maybe only for debugging... I haven't decided yet !
<page string="Operations" position="attributes">
<attribute name="attrs"></attribute>
</page>
-->
<button name="action_cancel" type="object" position="attributes"> <button name="action_cancel" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to cancel this picking?</attribute> <attribute name="confirm">Are you sure you want to cancel this picking?</attribute>
</button> </button>
<!-- This sum is useful to check the 'number of items' to transfer... --> <!-- This sum is useful to check the 'number of items' to transfer... -->
<xpath expr="//field[@name='pack_operation_product_ids']/tree/field[@name='product_qty']" position="attributes"> <xpath expr="//field[@name='move_ids_without_package']/tree/field[@name='product_uom_qty']" position="attributes">
<attribute name="sum">1</attribute>
</xpath>
<xpath expr="//field[@name='pack_operation_product_ids']/tree/field[@name='qty_done']" position="attributes">
<attribute name="sum">1</attribute> <attribute name="sum">1</attribute>
</xpath> </xpath>
</field> </field>
@@ -47,7 +35,7 @@
<field name="model">stock.picking</field> <field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree" /> <field name="inherit_id" ref="stock.vpicktree" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="min_date" position="after"> <field name="scheduled_date" position="after">
<field name="date_done"/> <field name="date_done"/>
</field> </field>
</field> </field>
@@ -58,17 +46,17 @@
<field name="model">stock.picking</field> <field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_internal_search" /> <field name="inherit_id" ref="stock.view_picking_internal_search" />
<field name="arch" type="xml"> <field name="arch" type="xml">
<group expand="0" position="inside"> <filter name="picking_type" position="after">
<filter string="Partner" context="{'group_by': 'partner_id'}"/> <filter string="Partner" name="partner_groupby" context="{'group_by': 'partner_id'}"/>
</group> </filter>
<filter context="{'group_by':'origin'}" position="replace"/> <filter name="origin" position="replace"/>
<filter context="{'group_by':'min_date'}" position="after"> <filter name="expected_date" position="after">
<filter name="date_done" string="Date Done" <filter name="date_done_groupby" string="Date Done"
context="{'group_by': 'date_done:day'}"/> context="{'group_by': 'date_done:day'}"/>
</filter> </filter>
<filter context="{'group_by':'min_date'}" position="attributes"> <filter name="expected_date" position="attributes">
<!-- group per day --> <!-- group per day -->
<attribute name="context">"{'group_by': 'min_date:day'}"</attribute> <attribute name="context">"{'group_by': 'scheduled_date:day'}"</attribute>
</filter> </filter>
</field> </field>
</record> </record>
@@ -84,38 +72,43 @@
</record> </record>
<record id="stock.action_picking_tree_all" model="ir.actions.act_window"> <record id="stock.action_picking_tree_all" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,pivot</field> <!-- add pivot --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record>
<record id="stock.stock_picking_action_picking_type" model="ir.actions.act_window">
<field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree_done" model="ir.actions.act_window"> <record id="stock.action_picking_tree_done" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree_ready" model="ir.actions.act_window"> <record id="stock.action_picking_tree_ready" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree_done_grouped" model="ir.actions.act_window"> <record id="stock.action_picking_tree_done_grouped" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree_waiting" model="ir.actions.act_window"> <record id="stock.action_picking_tree_waiting" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree_late" model="ir.actions.act_window"> <record id="stock.action_picking_tree_late" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree_backorder" model="ir.actions.act_window"> <record id="stock.action_picking_tree_backorder" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<record id="stock.action_picking_tree" model="ir.actions.act_window"> <record id="stock.action_picking_tree" model="ir.actions.act_window">
<field name="view_mode">tree,form,calendar,graph</field> <!-- add graph --> <field name="view_mode">tree,kanban,form,calendar,pivot</field> <!-- add pivot -->
</record> </record>
<!-- Display route in stock moves --> <!-- Display route in stock moves -->
<!--
<record id="view_move_form" model="ir.ui.view"> <record id="view_move_form" model="ir.ui.view">
<field name="name">stock.usability.stock.move.form</field> <field name="name">stock.usability.stock.move.form</field>
<field name="model">stock.move</field> <field name="model">stock.move</field>
@@ -150,7 +143,9 @@
</group> </group>
</field> </field>
</record> </record>
-->
<!--
<record id="view_move_picking_form" model="ir.ui.view"> <record id="view_move_picking_form" model="ir.ui.view">
<field name="name">stock.usability.stock.move.picking.form</field> <field name="name">stock.usability.stock.move.picking.form</field>
<field name="model">stock.move</field> <field name="model">stock.move</field>
@@ -161,7 +156,7 @@
groups="stock.group_stock_user" groups="stock.group_stock_user"
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"/> attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"/>
</field> </field>
<field name="group_id" position="replace"/> <!-- in stock, this field has invisible="1" re-add it below as visible --> <field name="group_id" position="replace"/>
<group name="moved_quants_grp" position="after"> <group name="moved_quants_grp" position="after">
<notebook colspan="2"> <notebook colspan="2">
<page string="Notes" name="notes"> <page string="Notes" name="notes">
@@ -184,6 +179,7 @@
</group> </group>
</field> </field>
</record> </record>
-->
<record id="view_move_picking_tree" model="ir.ui.view"> <record id="view_move_picking_tree" model="ir.ui.view">
<field name="name">stock_usability.src_location.in.picking.form</field> <field name="name">stock_usability.src_location.in.picking.form</field>
@@ -196,13 +192,14 @@
<field name="location_dest_id" position="attributes"> <field name="location_dest_id" position="attributes">
<attribute name="invisible">0</attribute> <attribute name="invisible">0</attribute>
</field> </field>
<!--
<field name="state" position="after"> <field name="state" position="after">
<button type="object" name="button_do_unreserve" string="Unreserve" <button type="object" name="button_do_unreserve" string="Unreserve"
groups="stock.group_stock_user" groups="stock.group_stock_user"
attrs="{'invisible': [('reserved_quant_ids', '=', [])]}" attrs="{'invisible': [('reserved_quant_ids', '=', [])]}"
icon="fa-ban"/> icon="fa-ban"/>
<field name="reserved_quant_ids" invisible="1"/> <field name="reserved_quant_ids" invisible="1"/>
</field> </field> -->
</field> </field>
</record> </record>
@@ -223,20 +220,6 @@
</field> </field>
</record> </record>
<record id="view_pack_operation_lot_form" model="ir.ui.view">
<field name="name">stock_usability.stock.pack.operation.form</field>
<field name="model">stock.pack.operation</field>
<field name="inherit_id" ref="stock.view_pack_operation_lot_form" />
<field name="arch" type="xml">
<field name="product_id" position="after">
<field name="picking_source_location_id" invisible="1"/>
<field name="picking_destination_location_id" invisible="1"/>
<field name="location_id" domain="[('id', 'child_of', picking_source_location_id)]" groups="stock.group_stock_multi_locations"/>
<field name="location_dest_id" domain="[('id', 'child_of', picking_destination_location_id)]" groups="stock.group_stock_multi_locations"/>
</field>
</field>
</record>
<record id="view_warehouse" model="ir.ui.view"> <record id="view_warehouse" model="ir.ui.view">
<field name="name">stock.usability.warehouse.form</field> <field name="name">stock.usability.warehouse.form</field>
<field name="model">stock.warehouse</field> <field name="model">stock.warehouse</field>
@@ -266,7 +249,7 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<filter name="inactive" position="after"> <filter name="inactive" position="after">
<group string="Group By" name="groupby"> <group string="Group By" name="groupby">
<filter name="usage" string="Location Type" <filter name="usage_groupby" string="Location Type"
context="{'group_by': 'usage'}"/> context="{'group_by': 'usage'}"/>
</group> </group>
</filter> </filter>
@@ -314,51 +297,27 @@ should be able to access it. So I add a menu entry under Inventory Control. -->
<attribute name="decoration-info">product_qty &gt; theoretical_qty</attribute> <attribute name="decoration-info">product_qty &gt; theoretical_qty</attribute>
<attribute name="decoration-warning">product_qty &lt; theoretical_qty</attribute> <attribute name="decoration-warning">product_qty &lt; theoretical_qty</attribute>
</xpath> </xpath>
<button name="reset_real_qty" type="object" position="attributes"> <button name="action_reset_product_qty" type="object" position="attributes">
<attribute name="confirm">Are you sure you want to reset all quantities to 0 ?</attribute> <attribute name="confirm">Are you sure you want to reset all quantities to 0 ?</attribute>
</button> </button>
</field> </field>
</record> </record>
<record id="stock_location_route_view_search" model="ir.ui.view">
<field name="name">usability.stock.location.route.search</field>
<field name="model">stock.location.route</field>
<field name="inherit_id" ref="stock.stock_location_route_view_search"/>
<field name="arch" type="xml">
<filter name="inactive" position="before">
<field name="name"/>
</filter>
</field>
</record>
<record id="view_stock_quant_tree" model="ir.ui.view"> <record id="view_stock_quant_tree" model="ir.ui.view">
<field name="name">stock.usability.quant.tree</field> <field name="name">stock.usability.quant.tree</field>
<field name="model">stock.quant</field> <field name="model">stock.quant</field>
<field name="inherit_id" ref="stock.view_stock_quant_tree"/> <field name="inherit_id" ref="stock.view_stock_quant_tree"/>
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="reservation_id" position="attributes"> <field name="quantity" position="attributes">
<attribute name="invisible">0</attribute> <attribute name="sum">1</attribute>
</field> </field>
<field name="qty" position="attributes"> <field name="reserved_quantity" position="attributes">
<attribute name="sum">Total Qty</attribute> <attribute name="sum">1</attribute>
</field> </field>
</field> </field>
</record> </record>
<!--
<record id="view_template_property_form" model="ir.ui.view">
<field name="name">stock.usability.product.template.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.view_template_property_form"/>
<field name="arch" type="xml">
<field name="virtual_available" position="before">
<field name="outgoing_qty"/>
</field>
</field>
</record>
-->
<!-- more detailed stock.move tree view when using the button from product form --> <!-- more detailed stock.move tree view when using the button from product form -->
<!-- TODO TEST <!-- TODO TEST
<record id="stock.act_product_stock_move_open" model="ir.actions.act_window"> <record id="stock.act_product_stock_move_open" model="ir.actions.act_window">
@@ -376,7 +335,7 @@ So I create another "regular" Quants" menu entry -->
</record> </record>
<menuitem id="stock_quant_menu" action="stock_quant_action" <menuitem id="stock_quant_menu" action="stock_quant_action"
parent="stock.menu_warehouse_report" parent="stock.menu_stock_inventory_control"
sequence="135"/> sequence="135"/>
</odoo> </odoo>