[IMP]:Issues-145, Issues-147

This commit is contained in:
Haresh Chavda 2018-11-20 10:37:43 +05:30
parent 32353100ea
commit 4f7a4fd533
12 changed files with 25 additions and 9 deletions

View File

@ -12,7 +12,7 @@ Core mechanisms for the accounting modules. To display the menuitems, install th
'category': 'Accounting',
'website': 'https://flectrahq.com/accounting',
'images' : ['images/accounts.jpeg','images/bank_statement.jpeg','images/cash_register.jpeg','images/chart_of_accounts.jpeg','images/customer_invoice.jpeg','images/journal_entries.jpeg'],
'depends' : ['base_setup', 'product', 'analytic', 'web_planner', 'portal', 'digest'],
'depends' : ['base_setup', 'product', 'analytic', 'web_planner', 'portal', 'digest', 'base_branch_company'],
'data': [
'security/account_security.xml',
'security/ir.model.access.csv',

View File

@ -7,7 +7,7 @@
'version': '1.1',
'website' : 'https://flectrahq.com/accounting',
'category': 'Hidden/Dependency',
'depends' : ['base', 'decimal_precision', 'mail'],
'depends' : ['base', 'decimal_precision', 'mail', 'base_branch_company'],
'description': """
Module for defining analytic accounting object.
===============================================

View File

@ -92,6 +92,19 @@ class Users(models.Model):
_inherit = "res.users"
@api.multi
def read(self, fields=None, load='_classic_read'):
result = super(Users, self).read(fields, load=load)
self.with_context({'check_branch': True}).check_missing_branch()
return result
@api.multi
def check_missing_branch(self):
for user_id in self:
if self._context.get('check_branch', False) and user_id.company_id.branch_id and not user_id.default_branch_id:
user_id.default_branch_id = user_id.company_id.branch_id.id
user_id.branch_ids = [(4, user_id.company_id.branch_id.id)]
@api.model
def branch_default_get(self, user):
if not user:

View File

@ -22,6 +22,7 @@
'web_tour',
'contacts',
'digest',
'base_branch_company'
],
'data': [
'security/crm_security.xml',

View File

@ -19,7 +19,8 @@
'web',
'web_planner',
'web_tour',
'digest'
'digest',
'base_branch_company'
],
'description': "",
'data': [

View File

@ -9,7 +9,7 @@
'sequence': 40,
'summary': 'A module for Scrum implementation',
'depends': [
'project', 'resource'
'project', 'resource', 'base_branch_company'
],
'data': [
'security/ir.model.access.csv',

View File

@ -10,7 +10,7 @@
'summary': 'Purchase Orders, Receipts, Vendor Bills',
'description': "",
'website': 'https://flectrahq.com/purchase',
'depends': ['stock_account'],
'depends': ['stock_account', 'base_branch_company'],
'data': [
'security/purchase_security.xml',
'security/ir.model.access.csv',

View File

@ -13,6 +13,7 @@
'depends': [
'purchase',
'purchase_requisition',
'base_branch_company'
],
'data': [
'security/ir.model.access.csv',

View File

@ -10,7 +10,7 @@
'description': """
This module contains all the common features of Sales Management and eCommerce.
""",
'depends': ['sales_team', 'account', 'portal'],
'depends': ['sales_team', 'account', 'portal', 'base_branch_company'],
'data': [
'security/sale_security.xml',
'security/ir.model.access.csv',

View File

@ -11,7 +11,7 @@ Using this application you can manage Sales Channels with CRM and/or Sales
===========================================================================
""",
'website': 'https://flectrahq.com/page/crm',
'depends': ['base', 'mail'],
'depends': ['base', 'mail', 'base_branch_company'],
'data': ['security/sales_team_security.xml',
'security/ir.model.access.csv',
'data/sales_team_data.xml',

View File

@ -8,7 +8,7 @@
'summary': 'Inventory, Logistics, Warehousing',
'description': "",
'website': 'https://flectrahq.com/page/warehouse',
'depends': ['product', 'barcodes', 'web_planner'],
'depends': ['product', 'barcodes', 'web_planner', 'base_branch_company'],
'category': 'Warehouse',
'sequence': 13,
'demo': [

View File

@ -135,7 +135,7 @@ class Location(models.Model):
('lot_stock_id', 'in', record.ids),
('wh_output_stock_loc_id', 'in', record.ids)])
for warehouse_id in warehouses_ids:
if record.branch_id and record.branch_id != warehouse_id.branch_id:
if record.branch_id and warehouse_id.branch_id and record.branch_id != warehouse_id.branch_id:
raise ValidationError(
_('Configuration Error of Branch:\n'
'The Location Branch (%s) and '