diff --git a/stock_analytic/README.rst b/stock_analytic/README.rst index ce4f6d5189..16b7b1349e 100644 --- a/stock_analytic/README.rst +++ b/stock_analytic/README.rst @@ -9,22 +9,11 @@ Stock Analytic Adds an analytic account in stock move to be able to get analytic information when generating the journal items. -Installation -============ - -To install this module, you need to: - -1. Clone the branch 8.0 of the repository https://github.com/OCA/account-analytic -2. Add the path to this repository in your configuration (addons-path) -3. Update the module list -4. Go to menu *Setting -> Modules -> Local Modules* -5. Search For *Stock Analytic* -6. Install the module Usage ===== -Assigned Stock Move With Analytic Account +To Assign an Analytic Account to a Stock Move ----------------------------------------- You need to: @@ -46,7 +35,7 @@ journal items with following rule: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/87/8.0 + :target: https://runbot.odoo-community.org/runbot/87/9.0 Bug Tracker =========== @@ -68,7 +57,8 @@ Contributors * Mathieu VATEL * Fabio VĂ­lchez * Andhitia Rama -* Michael Viriyananda +* Michael Viriyananda +* Eficent Maintainer ---------- diff --git a/stock_analytic/__openerp__.py b/stock_analytic/__openerp__.py index 6688c15c57..100db37e80 100644 --- a/stock_analytic/__openerp__.py +++ b/stock_analytic/__openerp__.py @@ -6,10 +6,10 @@ { "name": "Stock Analytic", "summary": "Adds an analytic account in stock move", - "version": "8.0.1.0.0", + "version": "9.0.1.0.0", "author": "Julius Network Solutions," - "ClearCorp, OpenSynergy Indonesia, " - "Odoo Community Association (OCA)", + "ClearCorp, OpenSynergy Indonesia," + "Odoo Community Association (OCA)", "website": "http://www.julius.fr/", "category": "Warehouse Management", "license": "AGPL-3", @@ -22,5 +22,4 @@ "views/stock_inventory_views.xml", ], 'installable': True, - 'active': False, } diff --git a/stock_analytic/models/stock.py b/stock_analytic/models/stock.py index ebe38845ee..bf5178480e 100644 --- a/stock_analytic/models/stock.py +++ b/stock_analytic/models/stock.py @@ -22,16 +22,9 @@ class StockQuant(models.Model): @api.model def _prepare_account_move_line(self, move, qty, cost, - credit_account_id, debit_account_id, - context=None): - res = super(StockQuant, - self)._prepare_account_move_line( - move, qty, cost, - credit_account_id, - debit_account_id, - context=context - ) - + credit_account_id, debit_account_id): + res = super(StockQuant, self)._prepare_account_move_line( + move, qty, cost, credit_account_id, debit_account_id) # Add analytic account in debit line if not move.analytic_account_id: return res diff --git a/stock_analytic/tests/test_stock_picking.py b/stock_analytic/tests/test_stock_picking.py index 55ae9f05a3..eeb2b2a12a 100644 --- a/stock_analytic/tests/test_stock_picking.py +++ b/stock_analytic/tests/test_stock_picking.py @@ -15,27 +15,22 @@ def setUp(self): self.product = self.env.ref('product.product_product_4') self.product.update({'valuation': 'real_time'}) - self.product_categ = self.env.ref('product.ipad') - self.valuation_account = self.env.ref('account.stk') - self.stock_account = self.env.ref('account.xfa') - self.stock_journal = self.env.ref('stock_account.stock_journal') - self.analytic_journal = self.env.ref('account.sit') + self.product_categ = self.env.ref('product.product_category_5') + self.valuation_account = self.env.ref( + 'account.data_account_type_expenses') + self.stock_account = self.env.ref('account.data_account_type_revenue') self.analytic_account = self.env.ref( - 'account.analytic_project_1_development') + 'analytic.analytic_agrolait') self.warehouse = self.env.ref('stock.warehouse0') self.location = self.warehouse.lot_stock_id self.dest_location = self.env.ref('stock.stock_location_customers') self.outgoing_picking_type = self.env.ref('stock.picking_type_out') self.incoming_picking_type = self.env.ref('stock.picking_type_in') - self.stock_journal.update({ - 'analytic_journal_id': self.analytic_journal.id - }) - self.product_categ.update({ 'property_stock_valuation_account_id': self.valuation_account.id, - 'property_stock_account_input_categ': self.stock_account.id, - 'property_stock_account_output_categ': self.stock_account.id, + 'property_stock_account_input_categ_id': self.stock_account.id, + 'property_stock_account_output_categ_id': self.stock_account.id, }) def _create_picking( @@ -44,6 +39,8 @@ def _create_picking( picking_data = { 'picking_type_id': picking_type_id.id, 'move_type': 'direct', + 'location_id': location_id.id, + 'location_dest_id': location_dest_id.id, } picking = self.env['stock.picking'].create(picking_data) @@ -55,7 +52,6 @@ def _create_picking( 'location_dest_id': location_dest_id.id, 'date': datetime.now().strftime('%Y-%m-%d %H:%M:%S'), 'date_expected': datetime.now().strftime('%Y-%m-%d %H:%M:%S'), - 'invoice_state': 'none', 'name': self.product.name, 'procure_method': 'make_to_stock', 'product_uom': self.product.uom_id.id, diff --git a/stock_analytic/views/stock_inventory_views.xml b/stock_analytic/views/stock_inventory_views.xml index d92ab1f222..c7aca48bb1 100644 --- a/stock_analytic/views/stock_inventory_views.xml +++ b/stock_analytic/views/stock_inventory_views.xml @@ -1,5 +1,5 @@ - + stock.inventory.form @@ -12,4 +12,4 @@ - + diff --git a/stock_analytic/views/stock_move_views.xml b/stock_analytic/views/stock_move_views.xml index d59f7d1014..46ae95869b 100644 --- a/stock_analytic/views/stock_move_views.xml +++ b/stock_analytic/views/stock_move_views.xml @@ -1,5 +1,5 @@ - + stock.move.picking.form @@ -44,28 +44,6 @@ - - stock.move.tree2 - stock.move - - - - - - - - - - stock.move.tree3 - stock.move - - - - - - - - stock.move.form stock.move @@ -77,4 +55,4 @@ - +