Merge lp:~lin-yu/openobject-addons/elico-7.0 into lp:openobject-addons
- elico-7.0
- Merge into trunk
Proposed by
LIN Yu
Status: | Needs review |
---|---|
Proposed branch: | lp:~lin-yu/openobject-addons/elico-7.0 |
Merge into: | lp:openobject-addons |
Diff against target: |
42456 lines (+40477/-0) 304 files modified
account_invoice_line/__init__.py (+25/-0) account_invoice_line/__openerp__.py (+51/-0) account_invoice_line/account.py (+106/-0) account_invoice_line/account_view.xml (+220/-0) account_invoice_line/i18n/zh_CN.po (+107/-0) account_invoice_line/security/ir.model.access.csv (+2/-0) account_invoice_line/static/description/index.html (+16/-0) account_prepayment/__init__.py (+25/-0) account_prepayment/__openerp__.py (+72/-0) account_prepayment/account.py (+82/-0) account_prepayment/account_view.xml (+46/-0) account_prepayment/i18n/zh_CN.po (+76/-0) account_prepayment/static/description/index.html (+16/-0) base_intercompany/__init__.py (+29/-0) base_intercompany/__openerp__.py (+66/-0) base_intercompany/base_intercompany_demo.xml (+81/-0) base_intercompany/company.py (+154/-0) base_intercompany/company_view.xml (+30/-0) base_intercompany/icops/__init__.py (+1/-0) base_intercompany/icops/order.py (+157/-0) base_intercompany/invoice.py (+198/-0) base_intercompany/invoice_wkf.xml (+14/-0) base_intercompany/purchase.py (+263/-0) base_intercompany/purchase_wkf.xml (+15/-0) base_intercompany/sale.py (+246/-0) base_intercompany/sale_wkf.xml (+14/-0) base_intercompany/security/intercompany_security.xml (+73/-0) base_intercompany/security/ir.model.access.csv (+3/-0) base_intercompany/static/description/index.html (+29/-0) base_intercompany/stock_picking.py (+806/-0) base_intercompany/stock_picking_wkf.xml (+9/-0) base_intercompany/tests/__init__.py (+8/-0) base_intercompany/tests/test_sale.py (+559/-0) delivery_plan/__init__.py (+27/-0) delivery_plan/__openerp__.py (+58/-0) delivery_plan/delivery_report.xml (+73/-0) delivery_plan/i18n/zh_CN.po (+703/-0) delivery_plan/partner.py (+33/-0) delivery_plan/report/__init__.py (+32/-0) delivery_plan/report/delivery_route_print.mako (+110/-0) delivery_plan/report/delivery_route_print.mako.1 (+111/-0) delivery_plan/report/delivery_route_print.py (+39/-0) delivery_plan/report/delivery_route_print.py.bak (+53/-0) delivery_plan/report/delivery_route_print.rml (+243/-0) delivery_plan/report/delivery_route_print.rml.bk (+266/-0) delivery_plan/sale.py (+1182/-0) delivery_plan/security/ir.model.access.csv (+3/-0) delivery_plan/sequence.xml (+18/-0) delivery_plan/static/description/index.html (+40/-0) delivery_plan/stock_view.xml (+694/-0) delivery_plan/wizard/__init__.py (+25/-0) delivery_plan/wizard/stock.py (+503/-0) delivery_plan/wizard/stock_view.xml (+463/-0) delivery_routes/__init__.py (+34/-0) delivery_routes/__openerp__.py (+63/-0) delivery_routes/delivery.py (+660/-0) delivery_routes/delivery_sequence.xml (+21/-0) delivery_routes/delivery_view.xml (+499/-0) delivery_routes/i18n/delivery_routes.pot (+603/-0) delivery_routes/i18n/es_PE.po (+603/-0) delivery_routes/i18n/zh_CN.po (+873/-0) delivery_routes/purchase.py (+33/-0) delivery_routes/purchase_view.xml (+68/-0) delivery_routes/report.xml (+240/-0) delivery_routes/security/delivery_security.xml (+19/-0) delivery_routes/security/ir.model.access.csv (+15/-0) delivery_routes/static/description/index.html (+43/-0) delivery_routes/stock.py (+352/-0) delivery_routes/stock_view.xml (+203/-0) delivery_routes/wizard/__init__.py (+34/-0) delivery_routes/wizard/fill_picking.py (+125/-0) delivery_routes/wizard/fill_picking.xml (+33/-0) delivery_routes/wizard/select_range.py (+47/-0) delivery_routes/wizard/select_range_view.xml (+32/-0) delivery_routes/wizard/stock.py (+46/-0) delivery_routes/wizard/stock_view.xml (+32/-0) gap_analysis/__init__.py (+26/-0) gap_analysis/__openerp__.py (+76/-0) gap_analysis/gap_analysis.py (+467/-0) gap_analysis/gap_analysis.xml (+429/-0) gap_analysis/gap_analysis_demo.xml (+118/-0) gap_analysis/gap_analysis_sequence.xml (+16/-0) gap_analysis/gap_analysis_workflow.xml (+57/-0) gap_analysis/report/__init__.py (+26/-0) gap_analysis/report/gap_analysis_report.py (+41/-0) gap_analysis/report/gap_analysis_report_view.xml (+13/-0) gap_analysis/report/report_webkit_gap_analysis.mako (+90/-0) gap_analysis/security/gap_analysis_rules.xml (+36/-0) gap_analysis/security/ir.model.access.csv (+25/-0) gap_analysis/static/description/index.html (+43/-0) gap_analysis/wizard/__init__.py (+26/-0) gap_analysis/wizard/import_from_sheet.py (+517/-0) gap_analysis/wizard/import_from_tmpl.py (+71/-0) gap_analysis/wizard/import_from_tmpl.xml (+72/-0) gap_analysis_aeroo_report/__init__.py (+26/-0) gap_analysis_aeroo_report/__openerp__.py (+59/-0) gap_analysis_aeroo_report/report/__init__.py (+26/-0) gap_analysis_aeroo_report/report/gap_analysis_report.py (+180/-0) gap_analysis_aeroo_report/report/tasks_list_report.py (+108/-0) gap_analysis_aeroo_report/static/description/index.html (+43/-0) gap_analysis_aeroo_report/wizard/__init__.py (+25/-0) gap_analysis_aeroo_report/wizard/wizard_view.py (+59/-0) gap_analysis_aeroo_report/wizard/wizard_view.xml (+75/-0) gap_analysis_project/__init__.py (+25/-0) gap_analysis_project/__openerp__.py (+50/-0) gap_analysis_project/gap_analysis_project.py (+274/-0) gap_analysis_project/gap_analysis_project.xml (+124/-0) gap_analysis_project/security/ir.model.access.csv (+4/-0) gap_analysis_project/static/description/index.html (+43/-0) gap_analysis_project_long_term/__init__.py (+25/-0) gap_analysis_project_long_term/__openerp__.py (+49/-0) gap_analysis_project_long_term/gap_analysis_project_long_term.py (+217/-0) gap_analysis_project_long_term/gap_analysis_project_long_term.xml (+16/-0) gap_analysis_project_long_term/static/description/index.html (+43/-0) l10n_cn_express_track/__init__.py (+22/-0) l10n_cn_express_track/__openerp__.py (+54/-0) l10n_cn_express_track/express.py (+70/-0) l10n_cn_express_track/express_view.xml (+907/-0) l10n_cn_express_track/static/description/index.html (+21/-0) l10n_cn_fapiao/__init__.py (+24/-0) l10n_cn_fapiao/__openerp__.py (+58/-0) l10n_cn_fapiao/fapiao.py (+70/-0) l10n_cn_fapiao/fapiao_view.xml (+92/-0) l10n_cn_fapiao/static/description/index.html (+27/-0) l10n_cn_fonts/__init__.py (+104/-0) l10n_cn_fonts/__openerp__.py (+41/-0) l10n_cn_fonts/static/description/index.html (+22/-0) l10n_cn_report_invoice/__init__.py (+27/-0) l10n_cn_report_invoice/__openerp__.py (+49/-0) l10n_cn_report_invoice/elico_reports_view.xml (+23/-0) l10n_cn_report_invoice/invoice.py (+48/-0) l10n_cn_report_invoice/report/__init__.py (+26/-0) l10n_cn_report_invoice/report/elico_invoice.rml (+539/-0) l10n_cn_report_invoice/report/invoice.py (+110/-0) l10n_cn_report_invoice/static/description/index.html (+17/-0) l10n_cn_report_purchase/__init__.py (+25/-0) l10n_cn_report_purchase/__openerp__.py (+50/-0) l10n_cn_report_purchase/elico_reports_view.xml (+11/-0) l10n_cn_report_purchase/report/__init__.py (+24/-0) l10n_cn_report_purchase/report/order.py (+132/-0) l10n_cn_report_purchase/report/purchase_order.rml (+366/-0) l10n_cn_report_purchase/report/purchase_po_requisition.rml (+340/-0) l10n_cn_report_purchase/static/description/index.html (+17/-0) l10n_cn_report_sale/__init__.py (+25/-0) l10n_cn_report_sale/__openerp__.py (+48/-0) l10n_cn_report_sale/elico_reports_view.xml (+23/-0) l10n_cn_report_sale/report/__init__.py (+24/-0) l10n_cn_report_sale/report/sale_order.py (+133/-0) l10n_cn_report_sale/report/sale_order_quotation.rml (+368/-0) l10n_cn_report_sale/static/description/index.html (+17/-0) l10n_cn_report_stock/__init__.py (+25/-0) l10n_cn_report_stock/__openerp__.py (+48/-0) l10n_cn_report_stock/elico_reports_view.xml (+24/-0) l10n_cn_report_stock/report/__init__.py (+25/-0) l10n_cn_report_stock/report/elico_picking_in.rml (+380/-0) l10n_cn_report_stock/report/elico_picking_out.rml (+394/-0) l10n_cn_report_stock/report/picking.py (+150/-0) l10n_cn_report_stock/static/description/index.html (+17/-0) move_reports/__init__.py (+26/-0) move_reports/__openerp__.py (+59/-0) move_reports/security/ir.model.access.csv (+2/-0) move_reports/static/description/index.html (+25/-0) move_reports/stock_move_report/__init__.py (+22/-0) move_reports/stock_move_report/stock_move_report.py (+482/-0) move_reports/stock_move_report/stock_move_report_view.xml (+113/-0) mrp_change_rm/__init__.py (+25/-0) mrp_change_rm/__openerp__.py (+52/-0) mrp_change_rm/i18n/zh_CN.po (+166/-0) mrp_change_rm/mrp_view.xml (+89/-0) mrp_change_rm/stock.py (+404/-0) mrp_mo_nopicking/__init__.py (+26/-0) mrp_mo_nopicking/__openerp__.py (+55/-0) mrp_mo_nopicking/i18n/zh_CN.po (+75/-0) mrp_mo_nopicking/mrp.py (+102/-0) mrp_mo_nopicking/mrp_workflow.xml (+43/-0) mrp_move_direct/__init__.py (+25/-0) mrp_move_direct/__openerp__.py (+53/-0) mrp_move_direct/i18n/zh_CN.po (+248/-0) mrp_move_direct/mrp_view.xml (+227/-0) mrp_move_direct/static/description/index.html (+29/-0) mrp_move_direct/stock.py (+714/-0) mrp_wave/__init__.py (+24/-0) mrp_wave/__openerp__.py (+52/-0) mrp_wave/static/description/index.html (+16/-0) mrp_wave/wizard/__init__.py (+25/-0) mrp_wave/wizard/scheduler.py (+1104/-0) mrp_wave/wizard/scheduler.xml (+268/-0) product_bundle/__init__.py (+26/-0) product_bundle/__openerp__.py (+56/-0) product_bundle/product.py (+82/-0) product_bundle/product_view.xml (+28/-0) product_bundle/sale.py (+192/-0) product_bundle/sale_view.xml (+131/-0) product_inventory_warning/__init__.py (+27/-0) product_inventory_warning/__openerp__.py (+53/-0) product_inventory_warning/i18n/zh_CN.po (+315/-0) product_inventory_warning/product.py (+613/-0) product_inventory_warning/product_view.xml (+137/-0) product_inventory_warning/security/ir.model.access.csv (+3/-0) product_inventory_warning/static/description/index.html (+23/-0) product_inventory_warning/wizard/__init__.py (+26/-0) product_inventory_warning/wizard/product_qty.py (+69/-0) product_inventory_warning/wizard/product_qty_view.xml (+32/-0) product_inventory_warning/wizard/product_sfc.py (+80/-0) product_inventory_warning/wizard/product_sfc_view.xml (+62/-0) product_separate_cost/__init__.py (+25/-0) product_separate_cost/__openerp__.py (+47/-0) product_separate_cost/product.py (+108/-0) product_separate_cost/static/description/index.html (+12/-0) product_stock_type/__init__.py (+26/-0) product_stock_type/__openerp__.py (+52/-0) product_stock_type/i18n/zh_CN.po (+93/-0) product_stock_type/product.py (+198/-0) product_stock_type/product_view.xml (+76/-0) product_stock_type/static/description/index.html (+22/-0) product_supplier_info/__init__.py (+23/-0) product_supplier_info/__openerp__.py (+47/-0) product_supplier_info/product.py (+54/-0) product_supplier_info/product_view.xml (+71/-0) product_supplier_info/static/description/index.html (+17/-0) purchase_control_supplier/__init__.py (+25/-0) purchase_control_supplier/__openerp__.py (+46/-0) purchase_control_supplier/i18n/zh_CN.po (+37/-0) purchase_control_supplier/purchase.py (+53/-0) purchase_control_supplier/purchase_view.xml (+44/-0) purchase_control_supplier/static/description/index.html (+20/-0) purchase_po_price/__init__.py (+23/-0) purchase_po_price/__openerp__.py (+42/-0) purchase_po_price/i18n/zh_CN.po (+89/-0) purchase_po_price/purchase.py (+161/-0) purchase_po_price/purchase_view.xml (+64/-0) purchase_po_price/static/description/index.html (+20/-0) purchase_price_control/__init__.py (+25/-0) purchase_price_control/__openerp__.py (+59/-0) purchase_price_control/i18n/zh_CN.po (+247/-0) purchase_price_control/purchase.py (+664/-0) purchase_price_control/purchase_view.xml (+165/-0) purchase_price_control/security/ir.model.access.csv (+3/-0) purchase_price_list_item/__init__.py (+23/-0) purchase_price_list_item/__openerp__.py (+52/-0) purchase_price_list_item/i18n/purchase_price_list_item.po (+33/-0) purchase_price_list_item/purchase.py (+332/-0) purchase_price_list_item/purchase_view.xml (+48/-0) purchase_price_list_item/static/description/index.html (+18/-0) quality_control_elico/__init__.py (+25/-0) quality_control_elico/__openerp__.py (+56/-0) quality_control_elico/i18n/zh_CN.po (+214/-0) quality_control_elico/security/ir.model.access.csv (+18/-0) quality_control_elico/security/qc_security.xml (+15/-0) quality_control_elico/static/description/index.html (+20/-0) quality_control_elico/stock.py (+113/-0) quality_control_elico/stock_view.xml (+80/-0) sale_payment_prepayment/__init__.py (+25/-0) sale_payment_prepayment/__openerp__.py (+47/-0) sale_payment_prepayment/sale_payment_prepayment.py (+50/-0) sale_payment_prepayment/sale_payment_prepayment_view.xml (+31/-0) stock_batch_move/__init__.py (+25/-0) stock_batch_move/__openerp__.py (+51/-0) stock_batch_move/i18n/zh_CN.po (+956/-0) stock_batch_move/i18n/zh_CN.po.old (+677/-0) stock_batch_move/static/description/index.html (+17/-0) stock_batch_move/wizard/__init__.py (+25/-0) stock_batch_move/wizard/stock_batch_move.py (+139/-0) stock_batch_move/wizard/stock_batch_move_view.xml (+35/-0) stock_extra/__init__.py (+25/-0) stock_extra/__openerp__.py (+53/-0) stock_extra/i18n/zh_CN.po (+956/-0) stock_extra/i18n/zh_CN.po.old (+677/-0) stock_extra/security/ir.model.access.csv (+2/-0) stock_extra/static/description/index.html (+23/-0) stock_extra/stock.py (+795/-0) stock_extra/stock_view.xml (+965/-0) stock_fillin_inventory_with_steps/__init__.py (+25/-0) stock_fillin_inventory_with_steps/__openerp__.py (+46/-0) stock_fillin_inventory_with_steps/static/description/index.html (+12/-0) stock_fillin_inventory_with_steps/wizard/__init__.py (+25/-0) stock_fillin_inventory_with_steps/wizard/stock_fill_inventory.py (+137/-0) stock_location_reports/__init__.py (+25/-0) stock_location_reports/__openerp__.py (+49/-0) stock_location_reports/report/__init__.py (+27/-0) stock_location_reports/report/lot_overview.py (+56/-0) stock_location_reports/report/lot_overview.rml (+212/-0) stock_location_reports/report/lot_overview_all.py (+55/-0) stock_location_reports/report/lot_overview_all.rml (+212/-0) stock_location_reports/report/stock_inventory_move.rml (+218/-0) stock_location_reports/report/stock_inventory_move_report.py (+47/-0) stock_location_reports/reports.xml (+11/-0) stock_location_reports/static/description/index.html (+21/-0) stock_qc_warehouse/__init__.py (+27/-0) stock_qc_warehouse/__openerp__.py (+53/-0) stock_qc_warehouse/i18n/zh_CN.po (+214/-0) stock_qc_warehouse/security/ir.model.access.csv (+18/-0) stock_qc_warehouse/security/qc_security.xml (+15/-0) stock_qc_warehouse/stock.py (+112/-0) stock_qc_warehouse/stock_view.xml (+48/-0) stock_with_cost/__init__.py (+25/-0) stock_with_cost/__openerp__.py (+48/-0) stock_with_cost/i18n/zh_CN.po (+956/-0) stock_with_cost/static/description/index.html (+20/-0) stock_with_cost/stock.py (+197/-0) stock_with_cost/stock_view.xml (+130/-0) web_adblock/__init__.py (+21/-0) web_adblock/__openerp__.py (+37/-0) web_adblock/static/src/js/announcement.js (+3/-0) |
To merge this branch: | bzr merge lp:~lin-yu/openobject-addons/elico-7.0 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP Core Team | Pending | ||
Review via email: mp+196656@code.launchpad.net |
Commit message
Description of the change
Add Module l10n_cn_reports (bilingual reports for Sales, Purchase, Stock, Invoice)
Add Module Stock Express Track
Add Module l10n_cn_fapiao
To post a comment you must log in.
- 13. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] Intercompany module
- 14. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] Bug fixing and description
- 15. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] Bug fixing and description
- 16. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] l10n_cn modules
- 17. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] l10n_cn modules
- 18. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] cosmetic on descriptions
- 19. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] cosmetic on descriptions and logos
- 20. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] cosmetic on descriptions and logos
- 21. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] prepayment and sale_payment modules
- 22. By LIN Yu
-
[MERGE] from Augustin
Unmerged revisions
- 22. By LIN Yu
-
[MERGE] from Augustin
- 21. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] prepayment and sale_payment modules
- 20. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] cosmetic on descriptions and logos
- 19. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] cosmetic on descriptions and logos
- 18. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] cosmetic on descriptions
- 17. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] l10n_cn modules
- 16. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] l10n_cn modules
- 15. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] Bug fixing and description
- 14. By <elicoidal <email address hidden>> <email address hidden>
-
[IMP] Bug fixing and description
- 13. By <elicoidal <email address hidden>> <email address hidden>
-
[ADD] Intercompany module
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added directory 'account_invoice_line' |
2 | === added file 'account_invoice_line/__init__.py' |
3 | --- account_invoice_line/__init__.py 1970-01-01 00:00:00 +0000 |
4 | +++ account_invoice_line/__init__.py 2013-12-30 03:21:22 +0000 |
5 | @@ -0,0 +1,25 @@ |
6 | +# -*- coding: utf-8 -*- |
7 | +############################################################################## |
8 | +# |
9 | +# OpenERP, Open Source Management Solution |
10 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
11 | +# Author: Andy Lu <andy.lu@elico-corp.com> |
12 | +# |
13 | +# This program is free software: you can redistribute it and/or modify |
14 | +# it under the terms of the GNU Affero General Public License as |
15 | +# published by the Free Software Foundation, either version 3 of the |
16 | +# License, or (at your option) any later version. |
17 | +# |
18 | +# This program is distributed in the hope that it will be useful, |
19 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | +# GNU Affero General Public License for more details. |
22 | +# |
23 | +# You should have received a copy of the GNU Affero General Public License |
24 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
25 | +# |
26 | +############################################################################## |
27 | + |
28 | +import account |
29 | + |
30 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
31 | \ No newline at end of file |
32 | |
33 | === added file 'account_invoice_line/__openerp__.py' |
34 | --- account_invoice_line/__openerp__.py 1970-01-01 00:00:00 +0000 |
35 | +++ account_invoice_line/__openerp__.py 2013-12-30 03:21:22 +0000 |
36 | @@ -0,0 +1,51 @@ |
37 | +# -*- coding: utf-8 -*- |
38 | +############################################################################## |
39 | +# |
40 | +# OpenERP, Open Source Management Solution |
41 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
42 | +# Author: LIN Yu <lin.yu@elico-corp.com> |
43 | +# |
44 | +# This program is free software: you can redistribute it and/or modify |
45 | +# it under the terms of the GNU Affero General Public License as |
46 | +# published by the Free Software Foundation, either version 3 of the |
47 | +# License, or (at your option) any later version. |
48 | +# |
49 | +# This program is distributed in the hope that it will be useful, |
50 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
51 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
52 | +# GNU Affero General Public License for more details. |
53 | +# |
54 | +# You should have received a copy of the GNU Affero General Public License |
55 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
56 | +# |
57 | +############################################################################## |
58 | + |
59 | +{ |
60 | + 'name': 'Invoice Line', |
61 | + 'version': '1.1', |
62 | + 'category': 'Account', |
63 | + 'sequence': 19, |
64 | + 'summary': 'Invoice line', |
65 | + 'description': """ |
66 | +Invoice Line |
67 | +================================================== |
68 | +* Add Account Invoice Line View |
69 | +* Add Account Invoice Type |
70 | +* Add Several New Fields to Invoice supplier_invoice_number, fapiao_date, partner_ref, reference_type |
71 | + """, |
72 | + 'author': 'Elico Corp', |
73 | + 'website': 'http://www.elico-corp.com', |
74 | + 'images' : [], |
75 | + 'depends': ['account'], |
76 | + 'data': [ |
77 | + 'account_view.xml', |
78 | + 'security/ir.model.access.csv', |
79 | + ], |
80 | + 'test': [], |
81 | + 'demo': [], |
82 | + 'installable': True, |
83 | + 'auto_install': False, |
84 | + 'application': False, |
85 | +} |
86 | + |
87 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
88 | \ No newline at end of file |
89 | |
90 | === added file 'account_invoice_line/account.py' |
91 | --- account_invoice_line/account.py 1970-01-01 00:00:00 +0000 |
92 | +++ account_invoice_line/account.py 2013-12-30 03:21:22 +0000 |
93 | @@ -0,0 +1,106 @@ |
94 | +# -*- coding: utf-8 -*- |
95 | +############################################################################## |
96 | +# |
97 | +# OpenERP, Open Source Management Solution |
98 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
99 | +# Author: Andy Lu <andy.lu@elico-corp.com> |
100 | +# |
101 | +# This program is free software: you can redistribute it and/or modify |
102 | +# it under the terms of the GNU Affero General Public License as |
103 | +# published by the Free Software Foundation, either version 3 of the |
104 | +# License, or (at your option) any later version. |
105 | +# |
106 | +# This program is distributed in the hope that it will be useful, |
107 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
108 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
109 | +# GNU Affero General Public License for more details. |
110 | +# |
111 | +# You should have received a copy of the GNU Affero General Public License |
112 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
113 | +# |
114 | +############################################################################## |
115 | + |
116 | +from osv import osv, fields |
117 | +from tools.translate import _ |
118 | +import openerp.addons.decimal_precision as dp |
119 | +import time |
120 | + |
121 | +class account_invoice_type(osv.osv): |
122 | + _name = "account.invoice.type" |
123 | + _description = "Account Invoice Type" |
124 | + |
125 | + _columns = { |
126 | + 'name': fields.char('Name',size=128, required=True, translate=True), |
127 | + } |
128 | + |
129 | +account_invoice_type() |
130 | + |
131 | +class account_invoice(osv.osv): |
132 | + _inherit = "account.invoice" |
133 | + |
134 | + def _get_reference_type(self, cr, uid, context=None): |
135 | + return [('none', _('Free Reference'))] #, |
136 | + |
137 | + _columns = { |
138 | + 'account_invoice_type': fields.many2one('account.invoice.type', 'Invoice Type'), |
139 | + 'supplier_invoice_number': fields.char('Supplier Inv Ref', size=64, help="The reference of this invoice as provided by the supplier."), |
140 | + 'fapiao_date': fields.date('V.A.T Date', ), |
141 | + 'partner_ref': fields.related('partner_id','ref',type='char', size=64, string='Partner Ref'), |
142 | + 'reference_type': fields.selection(_get_reference_type, 'Payment Reference', |
143 | + required=True, readonly=True, states={'draft':[('readonly',False)]}), |
144 | + } |
145 | +account_invoice() |
146 | + |
147 | +class account_invoice_line(osv.osv): |
148 | + _inherit = "account.invoice.line" |
149 | + |
150 | + def _amount_line_with_tax(self, cr, uid, ids, prop, arg, context=None): |
151 | + res = {} |
152 | + tax_obj = self.pool.get('account.tax') |
153 | + cur_obj = self.pool.get('res.currency') |
154 | + for line in self.browse(cr, uid, ids, context=context): |
155 | + price = line.price_unit * (1-(line.discount or 0.0)/100.0) |
156 | + taxes = tax_obj.compute_all(cr, uid, line.invoice_line_tax_id, price, line.quantity, product=line.product_id, partner=line.invoice_id.partner_id, force_excluded=True) |
157 | + res[line.id] = taxes['total'] |
158 | + if line.invoice_id: |
159 | + cur = line.invoice_id.currency_id |
160 | + res[line.id] = cur_obj.round(cr, uid, cur, res[line.id]) |
161 | + return res |
162 | + |
163 | + _columns = { |
164 | + 'amount_subtotal': fields.function(_amount_line_with_tax, string='Amount (Inc. Tax)', type='float', digits_compute=dp.get_precision('Account')), |
165 | + 'partner_ref': fields.related( |
166 | + 'partner_id', 'ref', |
167 | + type='char', size=64,relation='res.partner', |
168 | + string='Partner Ref',select=1), |
169 | + 'type': fields.related( |
170 | + 'invoice_id', 'type', |
171 | + type='char', size=64,relation='account.invoice', |
172 | + string='Type'), |
173 | + 'number': fields.related( |
174 | + 'invoice_id', 'number', |
175 | + type='char', size=64,relation='account.invoice', |
176 | + string='Number',select=1), |
177 | + 'supplier_invoice_number': fields.related( |
178 | + 'invoice_id', 'supplier_invoice_number', |
179 | + type='char', size=64,relation='account.invoice', |
180 | + string='Supplier Inv Ref',select=1), |
181 | + 'date_invoice': fields.related( |
182 | + 'invoice_id', 'date_invoice', |
183 | + type='date', relation='account.invoice', |
184 | + string='Date Invoice',select=1), |
185 | + 'fapiao_date': fields.related( |
186 | + 'invoice_id', 'fapiao_date', |
187 | + type='date', relation='account.invoice', |
188 | + string='V.A.T Date',select=1), |
189 | + 'state': fields.related( |
190 | + 'invoice_id', 'state', |
191 | + type='char', size=16,relation='account.invoice', |
192 | + string='State'), |
193 | + 'reference': fields.related( |
194 | + 'invoice_id', 'reference', |
195 | + type='char', size=16,relation='account.invoice', |
196 | + string='Reference'), |
197 | + } |
198 | +account_invoice_line() |
199 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
200 | |
201 | === added file 'account_invoice_line/account_view.xml' |
202 | --- account_invoice_line/account_view.xml 1970-01-01 00:00:00 +0000 |
203 | +++ account_invoice_line/account_view.xml 2013-12-30 03:21:22 +0000 |
204 | @@ -0,0 +1,220 @@ |
205 | +<?xml version="1.0" encoding="UTF-8"?> |
206 | +<openerp> |
207 | + <data> |
208 | + |
209 | + |
210 | + <!-- Invoice Line by LY--> |
211 | + |
212 | + <record id="account_invoice_line_tree" model="ir.ui.view"> |
213 | + <field name="name">account_invoice_line_tree</field> |
214 | + <field name="model">account.invoice.line</field> |
215 | + <field name="inherit_id" ref="account.view_invoice_line_tree"/> |
216 | + <field name="arch" type="xml"> |
217 | + |
218 | + <xpath expr="/tree" position="attributes"> |
219 | + <attribute name="create">0</attribute> |
220 | + <attribute name="delete">0</attribute> |
221 | + </xpath> |
222 | + <xpath expr="/tree/field[@name='name']" position="before"> |
223 | + <field name="partner_ref"/> |
224 | + <field name="partner_id"/> |
225 | + <field name="supplier_invoice_number"/> |
226 | + <field name="number"/> |
227 | + <field name="fapiao_date"/> |
228 | + <field name="date_invoice"/> |
229 | + <field name="invoice_id" invisible='1'/> |
230 | + <field name="origin"/> |
231 | + </xpath> |
232 | + <xpath expr="/tree/field[@name='quantity']" position="replace"> |
233 | + <field name="product_id"/> |
234 | + <field name="quantity" sum="Quantity"/> |
235 | + </xpath> |
236 | + <xpath expr="//field[@name='price_subtotal']" position="replace"> |
237 | + <field name="amount_subtotal" sum="Amount"/> |
238 | + <field name="amount_subtotal" sum="Amount(Inc.Tax)"/> |
239 | + <field name="state"/> |
240 | + <field name="reference" string='Reference'/> |
241 | + </xpath> |
242 | + </field> |
243 | + </record> |
244 | + <record id="account_invoice_line_search" model="ir.ui.view"> |
245 | + <field name="name">account.invoice.line.search.elico</field> |
246 | + <field name="model">account.invoice.line</field> |
247 | + <field name="arch" type="xml"> |
248 | + <search string="Search Invoice"> |
249 | + <field name="number" string="Number" filter_domain="['|','|',('number','ilike',self),('supplier_invoice_number','ilike',self),('origin','ilike',self)]"/> |
250 | + <field name="supplier_invoice_number" string="Supplier Invoice Number" /> |
251 | + <field name="partner_id" string="Partner"/> |
252 | + <field name="partner_ref" string="Partner ref"/> |
253 | + <field name="product_id" string="Product" /> |
254 | + <filter icon="terp-go-today" string="Draft" domain="[('state','=','draft')]" help="draft"/> |
255 | + <filter icon="terp-go-today" string="Open" domain="[('state','not in',('done','draft','cancel'))]" help="draft"/> |
256 | + <filter icon="terp-go-today" string="Paid" domain="[('state','=','done')]" help="Paid"/> |
257 | + <filter icon="terp-go-today" string="Cancel" domain="[('state','=','cancel')]" help="Cancel"/> |
258 | + <separator/> |
259 | + <filter icon="terp-go-today" string="Today" domain="[('date_invoice','<=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date_invoice','>=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders processed Today or planned for Today"/> |
260 | + <group expand="0" string="Group By..."> |
261 | + <filter icon="terp-partner" string="Partner" domain="[]" context="{'group_by':'partner_id'}"/> |
262 | + <filter icon="terp-product" string="Product" domain="[]" context="{'group_by':'product_id'}"/> |
263 | + <filter icon="terp-invoice" string="Invoice" domain="[]" context="{'group_by':'invoice_id'}"/> |
264 | + <filter icon="terp-state" string="State" domain="[]" context="{'group_by':'state'}"/> |
265 | + </group> |
266 | + </search> |
267 | + </field> |
268 | + </record> |
269 | + |
270 | + <record id="action_supplier_invoice_line" model="ir.actions.act_window"> |
271 | + <field name="name">Invoice Line</field> |
272 | + <field name="type">ir.actions.act_window</field> |
273 | + <field name="res_model">account.invoice.line</field> |
274 | + <field name="context">{}</field> |
275 | + <field name="domain">[('type','=','in_invoice')]</field> |
276 | + <field name="view_mode">tree</field> |
277 | + <field name="view_id" ref="account.view_invoice_line_tree"/> |
278 | + <field name="search_view_id" ref="account_invoice_line_search"/> |
279 | + <field name="help" type="html"> |
280 | + <p class="oe_view_nocontent_create"> |
281 | + Click to check Invoice Line. |
282 | + </p> |
283 | + </field> |
284 | + </record> |
285 | + <menuitem id="suppler_invoice_line" name="Supplier Invoice Line" parent="account.menu_finance_payables" action="action_supplier_invoice_line" sequence="13"/> |
286 | + |
287 | + |
288 | + <record id="action_customer_invoice_line" model="ir.actions.act_window"> |
289 | + <field name="name">Invoice Line</field> |
290 | + <field name="type">ir.actions.act_window</field> |
291 | + <field name="res_model">account.invoice.line</field> |
292 | + <field name="context">{}</field> |
293 | + <field name="domain">[('type','=','out_invoice')]</field> |
294 | + <field name="view_mode">tree</field> |
295 | + <field name="view_id" ref="account.view_invoice_line_tree"/> |
296 | + <field name="search_view_id" ref="account_invoice_line_search"/> |
297 | + <field name="help" type="html"> |
298 | + |
299 | + <p class="oe_view_nocontent_create"> |
300 | + Click to check Invoice Line. |
301 | + </p> |
302 | + </field> |
303 | + </record> |
304 | + <menuitem id="customer_invoice_line" name="Customer Invoice Line" parent="account.menu_finance_receivables" action="action_customer_invoice_line" sequence="13"/> |
305 | + |
306 | + |
307 | + <!-- |
308 | + Account Invoice |
309 | + --> |
310 | + <record model="ir.ui.view" id="invoice_ait_tree"> |
311 | + <field name="name">account.invoice.ait.tree</field> |
312 | + <field name="model">account.invoice</field> |
313 | + <field name="inherit_id" ref="account.invoice_tree" /> |
314 | + <field name="arch" type="xml"> |
315 | + <xpath expr="//field[@name='partner_id']" position="before"> |
316 | + <field name="partner_ref"/> |
317 | + </xpath> |
318 | + <xpath expr="//field[@name='partner_id']" position="after"> |
319 | + <field name="supplier_invoice_number"/> |
320 | + <field name="fapiao_date"/> |
321 | + </xpath> |
322 | + <xpath expr="//field[@name='state']" position="before"> |
323 | + <field name="account_invoice_type"/> |
324 | + <field name="reference"/> |
325 | + <field name="type" invisible="1"/> |
326 | + </xpath> |
327 | + </field> |
328 | + </record> |
329 | + |
330 | + <record model="ir.ui.view" id="invoice_supplier_ait_form"> |
331 | + <field name="name">account.invoice.supplier.ait.form</field> |
332 | + <field name="model">account.invoice</field> |
333 | + <field name="inherit_id" ref="account.invoice_supplier_form" /> |
334 | + <field name="arch" type="xml"> |
335 | + <xpath expr="//field[@name='supplier_invoice_number']" position="after"> |
336 | + <field name="fapiao_date"/> |
337 | + </xpath> |
338 | + <xpath expr="//field[@name='journal_id']" position="after"> |
339 | + <field name="account_invoice_type"/> |
340 | + </xpath> |
341 | + <xpath expr="//field[@name='price_subtotal']" position="after"> |
342 | + <field name="amount_subtotal"/> |
343 | + </xpath> |
344 | + </field> |
345 | + </record> |
346 | + <record model="ir.ui.view" id="invoice_ait_form"> |
347 | + <field name="name">account.invoice.ait.form</field> |
348 | + <field name="model">account.invoice</field> |
349 | + <field name="inherit_id" ref="account.invoice_form" /> |
350 | + <field name="arch" type="xml"> |
351 | + <xpath expr="//field[@name='account_id']" position="after"> |
352 | + <field name="supplier_invoice_number"/> |
353 | + <field name="fapiao_date"/> |
354 | + </xpath> |
355 | + <xpath expr="//field[@name='fiscal_position']" position="after"> |
356 | + <field name="account_invoice_type"/> |
357 | + </xpath> |
358 | + </field> |
359 | + </record> |
360 | + <record model="ir.ui.view" id="view_account_invoice_ait_filter"> |
361 | + <field name="name">account.invoice.ait.select</field> |
362 | + <field name="model">account.invoice</field> |
363 | + <field name="inherit_id" ref="account.view_account_invoice_filter" /> |
364 | + <field name="arch" type="xml"> |
365 | + <xpath expr="//field[@name='user_id']" position="after"> |
366 | + <field name="partner_ref"/> |
367 | + <field name="supplier_invoice_number"/> |
368 | + <field name="account_invoice_type"/> |
369 | + |
370 | + <filter string="Invoice" icon="terp-partner" domain="[('type','=','in_invoice')]"/> |
371 | + <filter string="Refund" icon="terp-partner" domain="[('type','=','in_refund')]"/> |
372 | + <separator/> |
373 | + </xpath> |
374 | + <xpath expr="//filter[@string='Journal']" position="after"> |
375 | + <filter string="Tax Type" icon="terp-partner" domain="[]" context="{'group_by':'account_invoice_type'}"/> |
376 | + <filter string="Partner Ref" icon="terp-partner" domain="[]" context="{'group_by':'partner_ref'}"/> |
377 | + <filter string="Type" icon="terp-partner" domain="[]" context="{'group_by':'type'}"/> |
378 | + </xpath> |
379 | + </field> |
380 | + </record> |
381 | + |
382 | + |
383 | + <!-- |
384 | + Account Invoice Tax Type |
385 | + --> |
386 | + <record id="view_account_invoice_type" model="ir.ui.view"> |
387 | + <field name="name">account.invoice.type.view</field> |
388 | + <field name="model">account.invoice.type</field> |
389 | + <field name="type">tree</field> |
390 | + <field name="arch" type="xml"> |
391 | + <tree string="invoice type" editable="top"> |
392 | + <field name="name"/> |
393 | + </tree> |
394 | + </field> |
395 | + </record> |
396 | + |
397 | + <record id="action_account_invoice_type" model="ir.actions.act_window"> |
398 | + <field name="name">Account Invoice Type</field> |
399 | + <field name="type">ir.actions.act_window</field> |
400 | + <field name="res_model">account.invoice.type</field> |
401 | + <field name="view_id" ref="view_account_invoice_type"/> |
402 | + <field name="view_type">form</field> |
403 | + <field name="view_mode">tree</field> |
404 | + </record> |
405 | + <!-- Menu --> |
406 | + <menuitem action="action_account_invoice_type" id="menu_account_invoice_type" sequence="4" parent="account.menu_finance_configuration" /> |
407 | + |
408 | + </data> |
409 | + |
410 | + <data noupdate="1"> |
411 | + <record id="ait_normal" model="account.invoice.type"> |
412 | + <field name="name">Normal</field> |
413 | + </record> |
414 | + <record id="ait_13" model="account.invoice.type"> |
415 | + <field name="name">13%</field> |
416 | + </record> |
417 | + <record id="ait_17" model="account.invoice.type"> |
418 | + <field name="name">17%</field> |
419 | + </record> |
420 | + <record id="ait_none" model="account.invoice.type"> |
421 | + <field name="name">None</field> |
422 | + </record> |
423 | + </data> |
424 | +</openerp> |
425 | |
426 | === added directory 'account_invoice_line/i18n' |
427 | === added file 'account_invoice_line/i18n/zh_CN.po' |
428 | --- account_invoice_line/i18n/zh_CN.po 1970-01-01 00:00:00 +0000 |
429 | +++ account_invoice_line/i18n/zh_CN.po 2013-12-30 03:21:22 +0000 |
430 | @@ -0,0 +1,107 @@ |
431 | +# Translation of OpenERP Server. |
432 | +# This file contains the translation of the following modules: |
433 | +# * fc_account_invoice |
434 | +# |
435 | +msgid "" |
436 | +msgstr "" |
437 | +"Project-Id-Version: OpenERP Server 7.0alpha\n" |
438 | +"Report-Msgid-Bugs-To: \n" |
439 | +"POT-Creation-Date: 2013-03-29 02:28+0000\n" |
440 | +"PO-Revision-Date: 2013-03-29 02:28+0000\n" |
441 | +"Last-Translator: <>\n" |
442 | +"Language-Team: \n" |
443 | +"MIME-Version: 1.0\n" |
444 | +"Content-Type: text/plain; charset=UTF-8\n" |
445 | +"Content-Transfer-Encoding: \n" |
446 | +"Plural-Forms: \n" |
447 | + |
448 | +#. module: account |
449 | +#: field:account.invoice,supplier_invoice_number:0 |
450 | +msgid "Supplier Invoice Number" |
451 | +msgstr "增值税普票号码" |
452 | + |
453 | +#. module: account |
454 | +#: code:addons/account/account_invoice.py:92 |
455 | +#, python-format |
456 | +msgid "Free Reference" |
457 | +msgstr "入库说明" |
458 | + |
459 | +#. module: fc_account_invoice |
460 | +#: field:account.invoice,fapiao_date:0 |
461 | +msgid "Fapiao Date" |
462 | +msgstr "增值税开票日期" |
463 | + |
464 | +#. module: fc_account_invoice |
465 | +#: model:account.invoice.type,name:fc_account_invoice.ait_none |
466 | +msgid "None" |
467 | +msgstr "无" |
468 | + |
469 | +#. module: fc_account_invoice |
470 | +#: model:ir.actions.act_window,name:fc_account_invoice.action_account_invoice_type |
471 | +#: model:ir.model,name:fc_account_invoice.model_account_invoice_type |
472 | +#: model:ir.ui.menu,name:fc_account_invoice.menu_account_invoice_type |
473 | +msgid "Account Invoice Type" |
474 | +msgstr "发票税别" |
475 | + |
476 | +#. module: fc_account_invoice |
477 | +#: field:account.invoice.type,name:0 |
478 | +msgid "Name" |
479 | +msgstr "名称" |
480 | + |
481 | +#. module: fc_account_invoice |
482 | +#: model:account.invoice.type,name:fc_account_invoice.ait_13 |
483 | +msgid "13%" |
484 | +msgstr "13%" |
485 | + |
486 | +#. module: fc_account_invoice |
487 | +#: model:account.invoice.type,name:fc_account_invoice.ait_normal |
488 | +msgid "Normal" |
489 | +msgstr "普票" |
490 | + |
491 | +#. module: fc_account_invoice |
492 | +#: model:account.invoice.type,name:fc_account_invoice.ait_17 |
493 | +msgid "17%" |
494 | +msgstr "17%" |
495 | + |
496 | +#. module: fc_account_invoice |
497 | +#: model:ir.model,name:fc_account_invoice.model_stock_picking |
498 | +msgid "Picking List" |
499 | +msgstr "分拣单" |
500 | + |
501 | +#. module: fc_account_invoice |
502 | +#: model:ir.model,name:fc_account_invoice.model_account_invoice_line |
503 | +msgid "Invoice Line" |
504 | +msgstr "发票明细" |
505 | + |
506 | +#. module: fc_account_invoice |
507 | +#: field:account.invoice.line,amount_subtotal:0 |
508 | +msgid "Amount (Inc. Tax)" |
509 | +msgstr "金额(含税)" |
510 | + |
511 | +#. module: fc_account_invoice |
512 | +#: view:account.invoice.type:0 |
513 | +msgid "invoice type" |
514 | +msgstr "发票税别" |
515 | + |
516 | +#. module: fc_account_invoice |
517 | +#: model:ir.model,name:fc_account_invoice.model_account_invoice |
518 | +msgid "Invoice" |
519 | +msgstr "发票" |
520 | + |
521 | +#. module: fc_account_invoice |
522 | +#: view:account.invoice:0 |
523 | +#: field:account.invoice,account_invoice_type:0 |
524 | +msgid "Invoice Type" |
525 | +msgstr "发票税别" |
526 | + |
527 | +#. module: fc_account_invoice |
528 | +#: code:addons/fc_account_invoice/account.py:42 |
529 | +#, python-format |
530 | +msgid "Free Reference" |
531 | +msgstr "入库说明" |
532 | + |
533 | +#. module: fc_account_invoice |
534 | +#: field:account.invoice,partner_ref:0 |
535 | +msgid "Partner Ref" |
536 | +msgstr "编号" |
537 | + |
538 | |
539 | === added directory 'account_invoice_line/security' |
540 | === added file 'account_invoice_line/security/ir.model.access.csv' |
541 | --- account_invoice_line/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
542 | +++ account_invoice_line/security/ir.model.access.csv 2013-12-30 03:21:22 +0000 |
543 | @@ -0,0 +1,2 @@ |
544 | +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
545 | +access_account_invoice_type,account.invoice.type,account_invoice_line.model_account_invoice_type,account.group_account_invoice,1,1,1,1 |
546 | |
547 | === added directory 'account_invoice_line/static' |
548 | === added directory 'account_invoice_line/static/description' |
549 | === added file 'account_invoice_line/static/description/account_invoice_line.png' |
550 | Binary files account_invoice_line/static/description/account_invoice_line.png 1970-01-01 00:00:00 +0000 and account_invoice_line/static/description/account_invoice_line.png 2013-12-30 03:21:22 +0000 differ |
551 | === added file 'account_invoice_line/static/description/index.html' |
552 | --- account_invoice_line/static/description/index.html 1970-01-01 00:00:00 +0000 |
553 | +++ account_invoice_line/static/description/index.html 2013-12-30 03:21:22 +0000 |
554 | @@ -0,0 +1,16 @@ |
555 | +<section class="oe_container"> |
556 | + <div class="oe_row"> |
557 | + <h2 class="oe_slogan">account_invoice_line Module</h2> |
558 | + <h3 class="oe_slogan">Individual Invoices for Each Item Product in Invoices</h3> |
559 | + <h4 class="oe_slogan"><a href="http://www.elico-corp.com">By Elico Corp</a></h4> |
560 | + <p>This module separates each item in the Customer and Supplier invoices into separate invoices. This allows for each of the separate invoices to be categorized by information type (i.e. company, item, V.A.T., account, etc.) enabling easier search and usage of different search filters.</p> |
561 | + <p>This module also adds more fields that can be filled in the Supplier and Customer invoices which includes:<br> - Account<br> - Journal<br> - Supplier Inv. Ref.<br> - V.A.T. Date<br> - Invoice Type </p> |
562 | + <div class="oe_row_img oe_centered oe_mt32"> |
563 | + <img class="oe_picture oe_screenshot" src="account_invoice_line.png"> |
564 | + </div> |
565 | + </div> |
566 | + <div class="oe_row oe_centeralign oe_more_space"> |
567 | + <a href="http://www.elico-corp.com/saas/" class="oe_button oe_big">Start your <span class="oe_emph">free</span> trial</a> |
568 | + </div> |
569 | + <h4 class="oe_slogan">or</h4> |
570 | +</section> |
571 | |
572 | === added directory 'account_invoice_line/static/src' |
573 | === added directory 'account_invoice_line/static/src/img' |
574 | === added file 'account_invoice_line/static/src/img/icon.png' |
575 | Binary files account_invoice_line/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_invoice_line/static/src/img/icon.png 2013-12-30 03:21:22 +0000 differ |
576 | === added directory 'account_prepayment' |
577 | === added file 'account_prepayment/__init__.py' |
578 | --- account_prepayment/__init__.py 1970-01-01 00:00:00 +0000 |
579 | +++ account_prepayment/__init__.py 2013-12-30 03:21:22 +0000 |
580 | @@ -0,0 +1,25 @@ |
581 | +# -*- coding: utf-8 -*- |
582 | +############################################################################## |
583 | +# |
584 | +# OpenERP, Open Source Management Solution |
585 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
586 | +# Author: Andy Lu <andy.lu@elico-corp.com> |
587 | +# |
588 | +# This program is free software: you can redistribute it and/or modify |
589 | +# it under the terms of the GNU Affero General Public License as |
590 | +# published by the Free Software Foundation, either version 3 of the |
591 | +# License, or (at your option) any later version. |
592 | +# |
593 | +# This program is distributed in the hope that it will be useful, |
594 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
595 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
596 | +# GNU Affero General Public License for more details. |
597 | +# |
598 | +# You should have received a copy of the GNU Affero General Public License |
599 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
600 | +# |
601 | +############################################################################## |
602 | + |
603 | +import account |
604 | + |
605 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
606 | \ No newline at end of file |
607 | |
608 | === added file 'account_prepayment/__openerp__.py' |
609 | --- account_prepayment/__openerp__.py 1970-01-01 00:00:00 +0000 |
610 | +++ account_prepayment/__openerp__.py 2013-12-30 03:21:22 +0000 |
611 | @@ -0,0 +1,72 @@ |
612 | +# -*- coding: utf-8 -*- |
613 | +############################################################################## |
614 | +# |
615 | +# OpenERP, Open Source Management Solution |
616 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
617 | +# Author: Elico Corp <contact@elico-corp.com> |
618 | +# |
619 | +# This program is free software: you can redistribute it and/or modify |
620 | +# it under the terms of the GNU Affero General Public License as |
621 | +# published by the Free Software Foundation, either version 3 of the |
622 | +# License, or (at your option) any later version. |
623 | +# |
624 | +# This program is distributed in the hope that it will be useful, |
625 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
626 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
627 | +# GNU Affero General Public License for more details. |
628 | +# |
629 | +# You should have received a copy of the GNU Affero General Public License |
630 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
631 | +# |
632 | +############################################################################## |
633 | + |
634 | +{ |
635 | + 'name': 'Account Prepayment', |
636 | + 'version': '1.0', |
637 | + 'category': 'Account', |
638 | + 'sequence': 19, |
639 | + 'summary': 'Account Prepayment', |
640 | + 'description': """ |
641 | +Prepayment Process with payment wizard |
642 | +================================================== |
643 | +Create the possibility to generate the prepayment directly from the payment wizard: |
644 | +** add the prepayment account in the partner |
645 | + |
646 | +** add a check box in the payment form Prepayment: if checked the prepayment account in the partner will be chosen |
647 | + |
648 | +** Usage for Supplier: |
649 | +Normal Payment (Choose the invoice in the payment form) |
650 | +AP debit 3000 |
651 | +Bank Credit -3000 |
652 | + |
653 | + |
654 | +** Prepayment Move (At money reception, use the payment form with prepayment and select no invoice). It creates: |
655 | +Prepayment debit 1000 |
656 | +Bank Credit -1000 |
657 | + |
658 | +** Create an Invoice |
659 | +AP Credit -3000 |
660 | +Sales Debit 3000 |
661 | + |
662 | +** New Payment (after invoice is created) |
663 | +Use the payment form (no prepayment option and select the invoice and already existing Prepayment move) |
664 | +Prepayment Credit -1000 |
665 | +AP Debit 3000 |
666 | +Bank Credit -2000 |
667 | + |
668 | + """, |
669 | + 'author': 'Elico Corp', |
670 | + 'website': 'http://www.elico-corp.com', |
671 | + 'images' : [], |
672 | + 'depends': ['account', 'account_voucher'], |
673 | + 'data': [ |
674 | + 'account_view.xml', |
675 | + ], |
676 | + 'test': [], |
677 | + 'demo': [], |
678 | + 'installable': True, |
679 | + 'auto_install': False, |
680 | + 'application': False, |
681 | +} |
682 | + |
683 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
684 | |
685 | === added file 'account_prepayment/account.py' |
686 | --- account_prepayment/account.py 1970-01-01 00:00:00 +0000 |
687 | +++ account_prepayment/account.py 2013-12-30 03:21:22 +0000 |
688 | @@ -0,0 +1,82 @@ |
689 | +# -*- coding: utf-8 -*- |
690 | +############################################################################## |
691 | +# |
692 | +# OpenERP, Open Source Management Solution |
693 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
694 | +# Author: Elico Corp <contact@elico-corp.com> |
695 | +# |
696 | +# This program is free software: you can redistribute it and/or modify |
697 | +# it under the terms of the GNU Affero General Public License as |
698 | +# published by the Free Software Foundation, either version 3 of the |
699 | +# License, or (at your option) any later version. |
700 | +# |
701 | +# This program is distributed in the hope that it will be useful, |
702 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
703 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
704 | +# GNU Affero General Public License for more details. |
705 | +# |
706 | +# You should have received a copy of the GNU Affero General Public License |
707 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
708 | +# |
709 | +############################################################################## |
710 | + |
711 | +from osv import osv, fields |
712 | +from tools.translate import _ |
713 | + |
714 | +class res_partner(osv.osv): |
715 | + _inherit = 'res.partner' |
716 | + |
717 | + _columns = { |
718 | + 'property_account_prepayable': fields.property( |
719 | + 'account.account', |
720 | + type='many2one', |
721 | + relation='account.account', |
722 | + string="Account Payable (Prepayment)", |
723 | + view_load=True, |
724 | + domain="[('type', '=', 'payable')]", |
725 | + help="This account will be used instead of the default one as the prepayment payable account for the current partner", |
726 | + required=True), |
727 | + 'property_account_prereceivable': fields.property( |
728 | + 'account.account', |
729 | + type='many2one', |
730 | + relation='account.account', |
731 | + string="Account Receivable (Prepayment)", |
732 | + view_load=True, |
733 | + domain="[('type', '=', 'receivable')]", |
734 | + help="This account will be used instead of the default one as the prepayment receivable account for the current partner", |
735 | + required=True), |
736 | + } |
737 | + |
738 | +class account_voucher(osv.osv): |
739 | + _inherit = "account.voucher" |
740 | + |
741 | + _columns = { |
742 | + 'use_prepayment_account': fields.boolean('Use Prepayment account', help="Check this if you want to input a prepayment on the prepayment accounts."), |
743 | + } |
744 | + _defaults = { |
745 | + 'use_prepayment_account': False, |
746 | + } |
747 | + |
748 | + def writeoff_move_line_get(self, cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=None): |
749 | + line_vals = super(account_voucher, self).writeoff_move_line_get(cr, uid, voucher_id, line_total, move_id, name, company_currency, current_currency, context=context) |
750 | + if line_vals: |
751 | + account_id = False |
752 | + voucher_brw = self.pool.get('account.voucher').browse(cr,uid,voucher_id,context) |
753 | + if voucher_brw.use_prepayment_account: |
754 | + if voucher_brw.payment_option == 'with_writeoff': |
755 | + account_id = voucher_brw.writeoff_acc_id.id |
756 | + elif voucher_brw.type in ('sale', 'receipt'): |
757 | + if not voucher_brw.partner_id.property_account_prereceivable: |
758 | + raise osv.except_osv(_('Unable to validate payment !'), _('Please configure the partner Prereceivable Account at first!')) |
759 | + account_id = voucher_brw.partner_id.property_account_prereceivable.id |
760 | + else: |
761 | + if not voucher_brw.partner_id.property_account_prepayable: |
762 | + raise osv.except_osv(_('Unable to validate payment !'), _('Please configure the partner Prepayable Account at first!')) |
763 | + account_id = voucher_brw.partner_id.property_account_prepayable.id |
764 | + if account_id: |
765 | + line_vals['account_id'] = account_id |
766 | + return line_vals |
767 | +account_voucher() |
768 | + |
769 | + |
770 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
771 | |
772 | === added file 'account_prepayment/account_view.xml' |
773 | --- account_prepayment/account_view.xml 1970-01-01 00:00:00 +0000 |
774 | +++ account_prepayment/account_view.xml 2013-12-30 03:21:22 +0000 |
775 | @@ -0,0 +1,46 @@ |
776 | +<?xml version="1.0" encoding="UTF-8"?> |
777 | +<openerp> |
778 | + <data> |
779 | + |
780 | + <!-- |
781 | + Partners Extension |
782 | + --> |
783 | + <record id="view_partner_preaccount_property_form" model="ir.ui.view"> |
784 | + <field name="name">res.partner.preaccount.property.form.inherit</field> |
785 | + <field name="model">res.partner</field> |
786 | + <field name="priority">3</field> |
787 | + <field name="inherit_id" ref="account.view_partner_property_form"/> |
788 | + <field name="arch" type="xml"> |
789 | + <xpath expr="//field[@name='property_account_receivable']" position="after"> |
790 | + <field name="property_account_prereceivable" groups="account.group_account_invoice" /> |
791 | + </xpath> |
792 | + <xpath expr="//field[@name='property_account_payable']" position="after"> |
793 | + <field name="property_account_prepayable" groups="account.group_account_invoice" /> |
794 | + </xpath> |
795 | + </field> |
796 | + </record> |
797 | + |
798 | + <record model="ir.ui.view" id="view_vendor_prepayment_form"> |
799 | + <field name="name">account.voucher.prepayment.form</field> |
800 | + <field name="model">account.voucher</field> |
801 | + <field name="inherit_id" ref="account_voucher.view_vendor_payment_form" /> |
802 | + <field name="arch" type="xml"> |
803 | + <xpath expr="//field[@name='journal_id']" position="after"> |
804 | + <field name="use_prepayment_account"/> |
805 | + </xpath> |
806 | + </field> |
807 | + </record> |
808 | + |
809 | + <record model="ir.ui.view" id="view_vendor_prereceipt_form"> |
810 | + <field name="name">account.voucher.prereceipt.form</field> |
811 | + <field name="model">account.voucher</field> |
812 | + <field name="inherit_id" ref="account_voucher.view_vendor_receipt_form" /> |
813 | + <field name="arch" type="xml"> |
814 | + <xpath expr="//field[@name='journal_id']" position="after"> |
815 | + <field name="use_prepayment_account"/> |
816 | + </xpath> |
817 | + </field> |
818 | + </record> |
819 | + |
820 | + </data> |
821 | +</openerp> |
822 | |
823 | === added directory 'account_prepayment/i18n' |
824 | === added file 'account_prepayment/i18n/zh_CN.po' |
825 | --- account_prepayment/i18n/zh_CN.po 1970-01-01 00:00:00 +0000 |
826 | +++ account_prepayment/i18n/zh_CN.po 2013-12-30 03:21:22 +0000 |
827 | @@ -0,0 +1,76 @@ |
828 | +# Translation of OpenERP Server. |
829 | +# This file contains the translation of the following modules: |
830 | +# * fc_account_prepayment |
831 | +# |
832 | +msgid "" |
833 | +msgstr "" |
834 | +"Project-Id-Version: OpenERP Server 7.0alpha\n" |
835 | +"Report-Msgid-Bugs-To: \n" |
836 | +"POT-Creation-Date: 2013-03-13 06:33+0000\n" |
837 | +"PO-Revision-Date: 2013-03-13 06:33+0000\n" |
838 | +"Last-Translator: <>\n" |
839 | +"Language-Team: \n" |
840 | +"MIME-Version: 1.0\n" |
841 | +"Content-Type: text/plain; charset=UTF-8\n" |
842 | +"Content-Transfer-Encoding: \n" |
843 | +"Plural-Forms: \n" |
844 | + |
845 | +#. module: fc_account_prepayment |
846 | +#: field:res.partner,property_account_prepayable:0 |
847 | +msgid "Account Prepayable" |
848 | +msgstr "预付科目" |
849 | + |
850 | +#. module: fc_account_prepayment |
851 | +#: code:addons/fc_account_prepayment/account.py:70 |
852 | +#, python-format |
853 | +msgid "Please configure the partner Prereceivable Account at first!" |
854 | +msgstr "请先配置客户预收账款科目!" |
855 | + |
856 | +#. module: fc_account_prepayment |
857 | +#: model:ir.model,name:fc_account_prepayment.model_account_voucher |
858 | +msgid "Accounting Voucher" |
859 | +msgstr "手工凭证" |
860 | + |
861 | +#. module: fc_account_prepayment |
862 | +#: code:addons/fc_account_prepayment/account.py:74 |
863 | +#, python-format |
864 | +msgid "Please configure the partner Prepayable Account at first!" |
865 | +msgstr "请先配置供应商预付账款科目!" |
866 | + |
867 | +#. module: fc_account_prepayment |
868 | +#: help:res.partner,property_account_prereceivable:0 |
869 | +msgid "This account will be used instead of the default one as the prereceivable account for the current partner" |
870 | +msgstr "当前客户的预收账款科目" |
871 | + |
872 | +#. module: fc_account_prepayment |
873 | +#: help:account.voucher,use_prepayment_account:0 |
874 | +msgid "Check this if you receive or pay amounts in advance." |
875 | +msgstr "如果你要创建预收或者预付凭证,请选择此项." |
876 | + |
877 | +#. module: fc_account_prepayment |
878 | +#: code:addons/fc_account_prepayment/account.py:70 |
879 | +#: code:addons/fc_account_prepayment/account.py:74 |
880 | +#, python-format |
881 | +msgid "Unable to validate payment !" |
882 | +msgstr "不能审核该笔支付 !" |
883 | + |
884 | +#. module: fc_account_prepayment |
885 | +#: field:account.voucher,use_prepayment_account:0 |
886 | +msgid "Use Prepayment account" |
887 | +msgstr "使用预付/预收科目" |
888 | + |
889 | +#. module: fc_account_prepayment |
890 | +#: help:res.partner,property_account_prepayable:0 |
891 | +msgid "This account will be used instead of the default one as the prepayable account for the current partner" |
892 | +msgstr "当前供应商的预付账款科目" |
893 | + |
894 | +#. module: fc_account_prepayment |
895 | +#: model:ir.model,name:fc_account_prepayment.model_res_partner |
896 | +msgid "Partner" |
897 | +msgstr "业务伙伴" |
898 | + |
899 | +#. module: fc_account_prepayment |
900 | +#: field:res.partner,property_account_prereceivable:0 |
901 | +msgid "Account Prereceivable" |
902 | +msgstr "预收科目" |
903 | + |
904 | |
905 | === added directory 'account_prepayment/static' |
906 | === added directory 'account_prepayment/static/description' |
907 | === added file 'account_prepayment/static/description/account_invoice_line1.png' |
908 | Binary files account_prepayment/static/description/account_invoice_line1.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/description/account_invoice_line1.png 2013-12-30 03:21:22 +0000 differ |
909 | === added file 'account_prepayment/static/description/account_invoice_line2.png' |
910 | Binary files account_prepayment/static/description/account_invoice_line2.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/description/account_invoice_line2.png 2013-12-30 03:21:22 +0000 differ |
911 | === added file 'account_prepayment/static/description/index.html' |
912 | --- account_prepayment/static/description/index.html 1970-01-01 00:00:00 +0000 |
913 | +++ account_prepayment/static/description/index.html 2013-12-30 03:21:22 +0000 |
914 | @@ -0,0 +1,16 @@ |
915 | +<section class="oe_container"> |
916 | + <div class="oe_row"> |
917 | + <h2 class="oe_slogan">account_prepayment Module</h2> |
918 | + <h3 class="oe_slogan">Prepayment Account for Customers and <br>Usage of Prepayment Account for Payments in Purchase Order</h3> |
919 | + <h4 class="oe_slogan"><a href="http://www.elico-corp.com">By Elico Corp</a></h4> |
920 | + <p>This module allows for creation of prepayment accounts for Customers. This module also allows for payment to Suppliers in Purchase Orders to be deducted from the Prepayment Accounts instead of just other normal payment accounts. </p> |
921 | + <div class="oe_row_img oe_centered oe_mt32"> |
922 | + <img class="oe_picture oe_screenshot" src="account_invoice_line1.png"> |
923 | + <img class="oe_picture oe_screenshot" src="account_invoice_line2.png"> |
924 | + </div> |
925 | + </div> |
926 | + <div class="oe_row oe_centeralign oe_more_space"> |
927 | + <a href="http://www.elico-corp.com/saas/" class="oe_button oe_big">Start your <span class="oe_emph">free</span> trial</a> |
928 | + </div> |
929 | + <h4 class="oe_slogan">or</h4> |
930 | +</section> |
931 | |
932 | === added directory 'account_prepayment/static/src' |
933 | === added directory 'account_prepayment/static/src/img' |
934 | === added file 'account_prepayment/static/src/img/icon.png' |
935 | Binary files account_prepayment/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and account_prepayment/static/src/img/icon.png 2013-12-30 03:21:22 +0000 differ |
936 | === added directory 'base_intercompany' |
937 | === added file 'base_intercompany/__init__.py' |
938 | --- base_intercompany/__init__.py 1970-01-01 00:00:00 +0000 |
939 | +++ base_intercompany/__init__.py 2013-12-30 03:21:22 +0000 |
940 | @@ -0,0 +1,29 @@ |
941 | +# -*- coding: utf-8 -*- |
942 | +############################################################################## |
943 | +# |
944 | +# OpenERP, Open Source Management Solution |
945 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
946 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> |
947 | +# Eric Caudal <eric.caudal@elico-corp.com> |
948 | +# |
949 | +# This program is free software: you can redistribute it and/or modify |
950 | +# it under the terms of the GNU Affero General Public License as |
951 | +# published by the Free Software Foundation, either version 3 of the |
952 | +# License, or (at your option) any later version. |
953 | +# |
954 | +# This program is distributed in the hope that it will be useful, |
955 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
956 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
957 | +# GNU Affero General Public License for more details. |
958 | +# |
959 | +# You should have received a copy of the GNU Affero General Public License |
960 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
961 | +# |
962 | +############################################################################## |
963 | + |
964 | +import company |
965 | +import sale |
966 | +import purchase |
967 | +# import stock_picking |
968 | + |
969 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
970 | |
971 | === added file 'base_intercompany/__openerp__.py' |
972 | --- base_intercompany/__openerp__.py 1970-01-01 00:00:00 +0000 |
973 | +++ base_intercompany/__openerp__.py 2013-12-30 03:21:22 +0000 |
974 | @@ -0,0 +1,66 @@ |
975 | +# -*- coding: utf-8 -*- |
976 | +############################################################################## |
977 | +# |
978 | +# OpenERP, Open Source Management Solution |
979 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
980 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> |
981 | +# Eric Caudal <eric.caudal@elico-corp.com> |
982 | +# |
983 | +# This program is free software: you can redistribute it and/or modify |
984 | +# it under the terms of the GNU Affero General Public License as |
985 | +# published by the Free Software Foundation, either version 3 of the |
986 | +# License, or (at your option) any later version. |
987 | +# |
988 | +# This program is distributed in the hope that it will be useful, |
989 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
990 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
991 | +# GNU Affero General Public License for more details. |
992 | +# |
993 | +# You should have received a copy of the GNU Affero General Public License |
994 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
995 | +# |
996 | +############################################################################## |
997 | + |
998 | +{ |
999 | + 'name': 'Base Inter-Company', |
1000 | + 'version': '1.0', |
1001 | + 'author': 'Elico Corp', |
1002 | + 'website': 'http://www.elico-corp.com', |
1003 | + 'summary': '', |
1004 | + 'description': """ |
1005 | +Inter-Company Processing (ICOPS) |
1006 | +This module is designed to manage Inter-company Process (ICOPS) and allow 2 companies to create objects in each other: |
1007 | +- When a PO to company B is created in company A, it creates automatically a SO in company B |
1008 | +- When a SO to company B is created in company A, it creates automatically a PO in company B |
1009 | +- Update PO from/to SO |
1010 | +- Confirm SO for PO and vice versa |
1011 | +- It is generic enough to allow intercompany process companies in cascade |
1012 | +- it can be uni-directional/bi-directional (eg SO in company A creates PO in company B and when the PO is validated in company B it validate the SO in company A). |
1013 | + |
1014 | +Works fine with SO/PO |
1015 | +Under construction: Sales invoice/Purchase invoice and Stock Moves |
1016 | +Blueprint: https://blueprints.launchpad.net/multi-company/+spec/icops |
1017 | + |
1018 | + |
1019 | + """, |
1020 | + 'depends': ['base', 'sale', 'stock', |
1021 | + 'sale_stock', 'purchase', 'account_cancel', |
1022 | + 'multi_company', ], |
1023 | + 'category': 'Sale', |
1024 | + 'sequence': 10, |
1025 | + 'demo': ['base_intercompany_demo.xml'], |
1026 | + 'data': [ |
1027 | + 'company_view.xml', |
1028 | + 'sale_wkf.xml', |
1029 | + 'purchase_wkf.xml', |
1030 | + #'stock_picking_wkf.xml', |
1031 | + 'security/intercompany_security.xml', |
1032 | + 'security/ir.model.access.csv'], |
1033 | + 'test': [], |
1034 | + 'installable': True, |
1035 | + 'application': False, |
1036 | + 'auto_install': False, |
1037 | + 'css': [], |
1038 | +} |
1039 | + |
1040 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1041 | |
1042 | === added file 'base_intercompany/base_intercompany_demo.xml' |
1043 | --- base_intercompany/base_intercompany_demo.xml 1970-01-01 00:00:00 +0000 |
1044 | +++ base_intercompany/base_intercompany_demo.xml 2013-12-30 03:21:22 +0000 |
1045 | @@ -0,0 +1,81 @@ |
1046 | +<?xml version="1.0" encoding="utf-8"?> |
1047 | +<openerp> |
1048 | + <data noupdate="0"> |
1049 | + <record id="partner_icops1" model="res.partner"> |
1050 | + <field name="name">ICOPS User 1</field> |
1051 | + <field name="company_id" ref="base.main_company"/> |
1052 | + <field name="customer" eval="False"/> |
1053 | + <field name="email">icops1@example.com</field> |
1054 | + </record> |
1055 | + |
1056 | + <record id="user_icops1" model="res.users"> |
1057 | + <field name="partner_id" ref="partner_icops1"/> |
1058 | + <field name="login">icops1</field> |
1059 | + <field name="password">icops1</field> |
1060 | + <field name="signature">-- |
1061 | +Mr Icops 1</field> |
1062 | + <field name="company_id" ref="base.main_company"/> |
1063 | + <field name="company_ids" eval="[(6,0,[ref('base.main_company')])]" /> |
1064 | + <field name="groups_id" eval="[(6,0,[ref('base.group_user'), ref('base.group_partner_manager'), ref('base.group_sale_manager'), ref('purchase.group_purchase_manager'), ref('group_intercompany_user')])]"/> |
1065 | + </record> |
1066 | + <record id="partner_icops2" model="res.partner"> |
1067 | + <field name="name">ICOPS User 2</field> |
1068 | + <field name="company_id" ref="multi_company.res_company_oerp_be"/> |
1069 | + <field name="customer" eval="False"/> |
1070 | + <field name="email">icops2@example.com</field> |
1071 | + </record> |
1072 | + |
1073 | + <record id="user_icops2" model="res.users"> |
1074 | + <field name="partner_id" ref="partner_icops2"/> |
1075 | + <field name="login">icops2</field> |
1076 | + <field name="password">icops2</field> |
1077 | + <field name="signature">-- |
1078 | +Mr Icops 2</field> |
1079 | + <field name="company_id" ref="multi_company.res_company_oerp_be"/> |
1080 | + <field name="company_ids" eval="[(6,0,[ref('multi_company.res_company_oerp_be')])]" /> |
1081 | + <field name="groups_id" eval="[(6,0,[ref('base.group_user'), ref('base.group_partner_manager'), ref('base.group_sale_manager'), ref('purchase.group_purchase_manager'), ref('group_intercompany_user')])]"/> |
1082 | + </record> |
1083 | + <record id="stock_location_shop_icops_1" model="stock.location"> |
1084 | + <field model="res.partner" name="partner_id" ref="partner_icops1" /> |
1085 | + <field name="company_id" ref="base.main_company"/> |
1086 | + <field name="location_id" ref="stock.stock_location_locations"/> |
1087 | + <field name="usage">internal</field> |
1088 | + <field eval="1" name="active"/> |
1089 | + <field name="name">Icops 1 shop</field> |
1090 | + </record> |
1091 | + <record id="stock_warehouse_shop_icops_1" model="stock.warehouse"> |
1092 | + <field name="lot_output_id" ref="stock_location_shop_icops_1"/> |
1093 | + <field name="name">Icops 1 Warehouse</field> |
1094 | + <field name="lot_stock_id" ref="stock_location_shop_icops_1"/> |
1095 | + <field model="res.partner" name="partner_id" ref="partner_icops1" /> |
1096 | + <field name="company_id" ref="base.main_company"/> |
1097 | + <field name="lot_input_id" ref="stock_location_shop_icops_1"/> |
1098 | + </record> |
1099 | + <record id="sale_shop_icops_1" model="sale.shop"> |
1100 | + <field name="name">Icops 1 sale shop</field> |
1101 | + <field model="account.payment.term" name="payment_default_id" search="[]"/> |
1102 | + <field name="warehouse_id" ref="stock_warehouse_shop_icops_1"/> |
1103 | + </record> |
1104 | + <record id="stock_location_shop_icops_2" model="stock.location"> |
1105 | + <field model="res.partner" name="partner_id" ref="partner_icops2" /> |
1106 | + <field name="company_id" ref="multi_company.res_company_oerp_be"/> |
1107 | + <field name="location_id" ref="stock.stock_location_locations"/> |
1108 | + <field name="usage">internal</field> |
1109 | + <field eval="1" name="active"/> |
1110 | + <field name="name">Icops 2 shop</field> |
1111 | + </record> |
1112 | + <record id="stock_warehouse_shop_icops_2" model="stock.warehouse"> |
1113 | + <field name="lot_output_id" ref="stock_location_shop_icops_2"/> |
1114 | + <field name="name">Icops 2 Warehouse</field> |
1115 | + <field name="lot_stock_id" ref="stock_location_shop_icops_2"/> |
1116 | + <field model="res.partner" name="partner_id" ref="partner_icops2" /> |
1117 | + <field name="company_id" ref="multi_company.res_company_oerp_be"/> |
1118 | + <field name="lot_input_id" ref="stock_location_shop_icops_2"/> |
1119 | + </record> |
1120 | + <record id="sale_shop_icops_2" model="sale.shop"> |
1121 | + <field name="name">Icops 2 sale shop</field> |
1122 | + <field model="account.payment.term" name="payment_default_id" search="[]"/> |
1123 | + <field name="warehouse_id" ref="stock_warehouse_shop_icops_2"/> |
1124 | + </record> |
1125 | + </data> |
1126 | +</openerp> |
1127 | \ No newline at end of file |
1128 | |
1129 | === added file 'base_intercompany/company.py' |
1130 | --- base_intercompany/company.py 1970-01-01 00:00:00 +0000 |
1131 | +++ base_intercompany/company.py 2013-12-30 03:21:22 +0000 |
1132 | @@ -0,0 +1,154 @@ |
1133 | +# -*- coding: utf-8 -*- |
1134 | +############################################################################## |
1135 | +# |
1136 | +# OpenERP, Open Source Management Solution |
1137 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
1138 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> |
1139 | +# Eric Caudal <eric.caudal@elico-corp.com> |
1140 | +# |
1141 | +# This program is free software: you can redistribute it and/or modify |
1142 | +# it under the terms of the GNU Affero General Public License as |
1143 | +# published by the Free Software Foundation, either version 3 of the |
1144 | +# License, or (at your option) any later version. |
1145 | +# |
1146 | +# This program is distributed in the hope that it will be useful, |
1147 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1148 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1149 | +# GNU Affero General Public License for more details. |
1150 | +# |
1151 | +# You should have received a copy of the GNU Affero General Public License |
1152 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1153 | +# |
1154 | +############################################################################## |
1155 | + |
1156 | +from openerp.osv import orm, fields |
1157 | + |
1158 | + |
1159 | +class res_intercompany(orm.Model): |
1160 | + _name = "res.intercompany" |
1161 | + _description = "Inter-Company" |
1162 | + |
1163 | + def get_intercompany(self, cr, uid, obj_id, |
1164 | + obj_class_name, obj_name, context=None): |
1165 | + """ |
1166 | + get company from and to |
1167 | + """ |
1168 | + |
1169 | + assert isinstance(obj_id, int) or isinstance(obj_id, long) |
1170 | + obj = self.pool.get(obj_class_name).browse( |
1171 | + cr, |
1172 | + uid, |
1173 | + obj_id, |
1174 | + context=None) |
1175 | + company = obj.company_id |
1176 | + ic_uid_ids = None |
1177 | + company_to_ids = [] |
1178 | + for ic in company.intercompany_ids: |
1179 | + if ic.obj2obj == obj_name: |
1180 | + company_to_ids.append(ic.company_to.id) |
1181 | + ic_uid_ids = ic.intercompany_uid.id |
1182 | + if company.intercompany_ids: |
1183 | + ic_uid_ids = company.intercompany_ids[0].intercompany_uid.id |
1184 | + return obj.company_id.id, company_to_ids, ic_uid_ids |
1185 | + |
1186 | + def _check_intercompany_user(self, cr, uid, ids, context=None): |
1187 | + for ic in self.browse(cr, uid, ids, context=context): |
1188 | + if not ic.intercompany_uid: |
1189 | + return False |
1190 | + return True |
1191 | + |
1192 | + _columns = { |
1193 | + 'company_from': fields.many2one('res.company', 'Company From', |
1194 | + required=True, ondelete='cascade'), |
1195 | + 'company_to': fields.many2one('res.company', 'Company', required=True, |
1196 | + ondelete='cascade'), |
1197 | + 'obj2obj': fields.selection( |
1198 | + [('so2po', 'SO to PO'), |
1199 | + ('po2so', 'PO to SO'), |
1200 | + ('is2do', 'IS to DO'), |
1201 | + ('do2is', 'DO to IS'), |
1202 | + ('ci2si', 'CI to SI'), |
1203 | + ('si2ci', 'SI to CI')], |
1204 | + string="Relation", required=True), |
1205 | + 'status': fields.selection( |
1206 | + [('draft', 'On Creation'), |
1207 | + ('confirm', 'On Confirmation'), |
1208 | + ('cancel', 'On Cancel'), |
1209 | + ('unlink', 'On Deletion')], |
1210 | + string='Status', required=True), |
1211 | + 'direction': fields.selection( |
1212 | + [('bidirectional', 'Bidirectional'), |
1213 | + ('regular', 'Regular'), |
1214 | + ('inverse', 'Inverse')], |
1215 | + 'Modification Direction', required=True), |
1216 | + 'auto_confirm': fields.boolean('Automatic Confirm'), |
1217 | + 'intercompany_uid': fields.related( |
1218 | + 'company_to', 'intercompany_uid', type='many2one', |
1219 | + relation='res.users', readonly=True, string='IC User'), |
1220 | + } |
1221 | + _defaults = { |
1222 | + 'auto_confirm': lambda *a: True, |
1223 | + 'direction': lambda *a: 'bidirectional', |
1224 | + } |
1225 | + |
1226 | + _constraints = [ |
1227 | + (_check_intercompany_user, 'Please set IC user for the Company first', |
1228 | + ['intercompany_uid']) |
1229 | + ] |
1230 | + |
1231 | + def check_need_create_intercompany_object( |
1232 | + self, cr, uid, company_from, company_to, o2o_field_name, |
1233 | + node=None, return_list_type=False): |
1234 | + """ @company_from |
1235 | + @company_to |
1236 | + @o2o_field_name file name.Example, so2po po2so ,,,, |
1237 | + @node value of o2o_field_name , draft, confirm |
1238 | + @return_list_type, the return type is list or boolean |
1239 | + """ |
1240 | + |
1241 | + if type(company_to) != list: |
1242 | + company_to = [company_to] |
1243 | + |
1244 | + intercompany_ids = self.search( |
1245 | + cr, uid, |
1246 | + [('company_from', '=', company_from), |
1247 | + ('company_to', 'in', company_to), |
1248 | + ('obj2obj', '=', o2o_field_name), |
1249 | + ('status', '=', node)]) |
1250 | + if return_list_type: |
1251 | + return intercompany_ids |
1252 | + else: |
1253 | + return intercompany_ids and True or False |
1254 | + |
1255 | + def check_need_automatic_confirm( |
1256 | + self, cr, uid, company_from, company_to, |
1257 | + o2o_field_name, node=None, return_list_type=False): |
1258 | + """ |
1259 | + check is need to automatic confirm internal company object |
1260 | + """ |
1261 | + intercompany_ids = self.search( |
1262 | + cr, uid, |
1263 | + [('company_from', '=', company_from), |
1264 | + ('company_to', '=', company_to), |
1265 | + (o2o_field_name, '=', node), |
1266 | + ('auto_confirm', '=', True)]) |
1267 | + return intercompany_ids and True or False |
1268 | + |
1269 | + |
1270 | +class res_company(orm.Model): |
1271 | + _inherit = "res.company" |
1272 | + |
1273 | + _columns = { |
1274 | + 'intercompany_ids': fields.one2many( |
1275 | + 'res.intercompany', 'company_from', 'Inter-Company Setup'), |
1276 | + 'intercompany_uid': fields.many2one( |
1277 | + 'res.users', 'IC User', |
1278 | + required=True, |
1279 | + domain="[('company_id', '=', id)]", |
1280 | + help="User to create update unlink IC records"), |
1281 | + 'intercompany_shop_id': fields.many2one( |
1282 | + 'sale.shop', 'IC Default location', |
1283 | + domain="[('company_id', '=', id)]") |
1284 | + } |
1285 | + |
1286 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1287 | |
1288 | === added file 'base_intercompany/company_view.xml' |
1289 | --- base_intercompany/company_view.xml 1970-01-01 00:00:00 +0000 |
1290 | +++ base_intercompany/company_view.xml 2013-12-30 03:21:22 +0000 |
1291 | @@ -0,0 +1,30 @@ |
1292 | +<?xml version="1.0" encoding="utf-8"?> |
1293 | +<openerp> |
1294 | + <data> |
1295 | + <record id="inherit_view_intercompany_form" model="ir.ui.view"> |
1296 | + <field name="name">res.intercompany.form</field> |
1297 | + <field name="model">res.company</field> |
1298 | + <field name="inherit_id" ref="base.view_company_form"/> |
1299 | + <field name="arch" type="xml"> |
1300 | + <xpath expr="//page[@string='Configuration']" position="before"> |
1301 | + <page string="InterCompany" groups="base.group_multi_company"> |
1302 | + <group string="Intercompany"> |
1303 | + <field name="intercompany_uid" /> |
1304 | + <field name="intercompany_shop_id" /> |
1305 | + <field name="intercompany_ids"> |
1306 | + <tree editable="bottom"> |
1307 | + <field name="company_to"/> |
1308 | + <field name='intercompany_uid'/> |
1309 | + <field name="obj2obj"/> |
1310 | + <field name="status" /> |
1311 | + <field name="direction"/> |
1312 | + <field name="auto_confirm"/> |
1313 | + </tree> |
1314 | + </field> |
1315 | + </group> |
1316 | + </page> |
1317 | + </xpath> |
1318 | + </field> |
1319 | + </record> |
1320 | + </data> |
1321 | +</openerp> |
1322 | |
1323 | === added directory 'base_intercompany/icops' |
1324 | === added file 'base_intercompany/icops/__init__.py' |
1325 | --- base_intercompany/icops/__init__.py 1970-01-01 00:00:00 +0000 |
1326 | +++ base_intercompany/icops/__init__.py 2013-12-30 03:21:22 +0000 |
1327 | @@ -0,0 +1,1 @@ |
1328 | +import order |
1329 | |
1330 | === added file 'base_intercompany/icops/order.py' |
1331 | --- base_intercompany/icops/order.py 1970-01-01 00:00:00 +0000 |
1332 | +++ base_intercompany/icops/order.py 2013-12-30 03:21:22 +0000 |
1333 | @@ -0,0 +1,157 @@ |
1334 | +from openerp import SUPERUSER_ID |
1335 | +from openerp.osv import osv |
1336 | +from openerp.tools.translate import _ |
1337 | +from openerp import netsvc |
1338 | + |
1339 | + |
1340 | +class icops_order(object): |
1341 | + |
1342 | + def __init__(self, obj): |
1343 | + self.obj = obj |
1344 | + self.obj2obj_1 = 'so2po' |
1345 | + self.obj2obj_2 = 'po2so' |
1346 | + self.attr_id_1 = 'purchase_id' |
1347 | + self.attr_id_2 = 'sale_id' |
1348 | + self.name_2 = 'purchase.order' |
1349 | + self.confirm = 'purchase_confirm' |
1350 | + if self.obj._name == 'purchase.order': |
1351 | + self.confirm = 'order_confirm' |
1352 | + self.obj2obj_1 = 'po2so' |
1353 | + self.obj2obj_2 = 'so2po' |
1354 | + self.name_2 = 'sale.order' |
1355 | + self.attr_id_1 = 'sale_id' |
1356 | + self.attr_id_2 = 'purchase_id' |
1357 | + self.order_pool = self.obj.pool.get(self.name_2) |
1358 | + |
1359 | + def create_intercompany(self, cr, uid, ids, node='draft', context=None): |
1360 | + ic_pool = self.obj.pool.get('res.intercompany') |
1361 | + company_from, company_to, ic_uid = ic_pool.get_intercompany( |
1362 | + cr, uid, ids[0], self.obj._name, self.obj2obj_1, context=context) |
1363 | + if ic_pool.check_need_create_intercompany_object( |
1364 | + cr, uid, company_from, company_to, self.obj2obj_1, node): |
1365 | + self._create_intercompany( |
1366 | + cr, uid, ids[0], company_to, ic_uid, context=context) |
1367 | + return True |
1368 | + |
1369 | + def _create_intercompany( |
1370 | + self, cr, uid, id, company_to, ic_uid, context=None): |
1371 | + if isinstance(company_to, list): |
1372 | + company_to = company_to[0] |
1373 | + context = context or {} |
1374 | + order = self.obj.read(cr, uid, id, ['partner_id'], context=context) |
1375 | + company = self.obj.pool.get('res.company').read( |
1376 | + cr, ic_uid, company_to, ['partner_id'], context=context) |
1377 | + if order['partner_id'] != company['partner_id']: |
1378 | + return None |
1379 | + order_data = self.obj._prepare_IC( |
1380 | + cr, uid, id, company_to, |
1381 | + ic_uid, context=context) |
1382 | + if not 'is_locked' in context: |
1383 | + order_pool = self.obj.pool.get(self.name_2) |
1384 | + res = order_pool.create(cr, ic_uid, order_data, context=context) |
1385 | + data = {self.attr_id_1: res} |
1386 | + self.obj.write( |
1387 | + cr, uid, id, data, context=context) |
1388 | + |
1389 | + return res |
1390 | + |
1391 | + def action(self, cr, uid, ids, values=None, state='draft', context=None): |
1392 | + if not isinstance(ids, list): |
1393 | + ids = [ids] |
1394 | + for order in self.obj.read( |
1395 | + cr, uid, ids, |
1396 | + ['company_id', self.attr_id_1], context=context): |
1397 | + if not self.attr_id_1 in order: |
1398 | + continue |
1399 | + if values and 'state' in values: |
1400 | + if values['state'] == 'cancel': |
1401 | + state = 'cancel' |
1402 | + elif values['state'] == 'confirmed': |
1403 | + return |
1404 | + company_pool = self.obj.pool.get('res.company') |
1405 | + company = company_pool.read( |
1406 | + cr, uid, order['company_id'][0], |
1407 | + ['intercompany_ids'], context=context) |
1408 | + self.loop( |
1409 | + cr, uid, order['id'], company['intercompany_ids'], 'regular', |
1410 | + self.obj2obj_1, state, context) |
1411 | + company = None |
1412 | + if not order[self.attr_id_1]: |
1413 | + continue |
1414 | + obj = self.obj.pool.get(self.name_2).read( |
1415 | + cr, SUPERUSER_ID, order[self.attr_id_1][0], |
1416 | + ['company_id'], context=context) |
1417 | + if not obj: |
1418 | + continue |
1419 | + company = company_pool.read( |
1420 | + cr, SUPERUSER_ID, obj['company_id'][0], |
1421 | + ['intercompany_uid', 'intercompany_ids'], context=context) |
1422 | + ic_uid = company['intercompany_uid'][0] |
1423 | + self.loop( |
1424 | + cr, ic_uid, obj['id'], |
1425 | + company['intercompany_ids'], 'inverse', self.obj2obj_2, |
1426 | + state, context=context) |
1427 | + return True |
1428 | + |
1429 | + def loop( |
1430 | + self, cr, uid, id, icops_ids, |
1431 | + direction, obj2obj, state, context=None): |
1432 | + |
1433 | + order_pool = self.obj.pool.get(self.name_2) |
1434 | + opposite_direction = 'inverse' if direction == 'regular' else 'regular' |
1435 | + icops_pool = self.obj.pool.get('res.intercompany') |
1436 | + ic_att = ['obj2obj', 'status', 'intercompany_uid', 'direction', |
1437 | + 'company_to'] |
1438 | + for ic in icops_pool.read(cr, uid, icops_ids, ic_att, context=context): |
1439 | + if ic['obj2obj'] != obj2obj or ic['status'] != state: |
1440 | + continue |
1441 | + |
1442 | + ic_uid = ic['intercompany_uid'][0] |
1443 | + ic_order_ids = order_pool.search( |
1444 | + cr, ic_uid, |
1445 | + [(self.attr_id_2, '=', id)], context=context) |
1446 | + ic_order_id = ic_order_ids and ic_order_ids[0] |
1447 | + if((ic['direction'] == direction |
1448 | + or ic['direction'] == 'bidirectional') |
1449 | + or |
1450 | + ('force_update' in context)): |
1451 | + context['is_external'] = True |
1452 | + if state == 'draft': |
1453 | + data = self.obj._prepare_IC( |
1454 | + cr, uid, id, ic['company_to'][0], ic_uid, |
1455 | + context=context) |
1456 | + obj = order_pool.read(cr, ic_uid, ic_order_id, ['state'], |
1457 | + context=context) |
1458 | + try: |
1459 | + if not isinstance(obj, dict): |
1460 | + continue |
1461 | + if obj['state'] == "progress" and 'order_line' in data: |
1462 | + data.pop('order_line') |
1463 | + except: |
1464 | + pass |
1465 | + order_pool.write( |
1466 | + cr, ic_uid, ic_order_id, data, context=context) |
1467 | + elif state == 'cancel': |
1468 | + |
1469 | + try: |
1470 | + order_pool.action_cancel( |
1471 | + cr, ic_uid, [ic_order_id], context=context) |
1472 | + except: |
1473 | + continue |
1474 | + elif state == 'confirm': |
1475 | + if self.obj._name == 'purchase.order': |
1476 | + order_pool.action_wait( |
1477 | + cr, ic_uid, [ic_order_id], context=context) |
1478 | + continue |
1479 | + order_pool.wkf_confirm_order( |
1480 | + cr, ic_uid, [ic_order_id], context=context) |
1481 | + elif state == 'unlink': |
1482 | + order_pool.unlink( |
1483 | + cr, SUPERUSER_ID, ic_order_id, context=context) |
1484 | + |
1485 | + elif(not 'is_external' in context and |
1486 | + ic['direction'] == opposite_direction): |
1487 | + raise osv.except_osv( |
1488 | + _('Error!'), |
1489 | + _('You can\'t edit this %s mode quotation' |
1490 | + % opposite_direction)) |
1491 | |
1492 | === added file 'base_intercompany/invoice.py' |
1493 | --- base_intercompany/invoice.py 1970-01-01 00:00:00 +0000 |
1494 | +++ base_intercompany/invoice.py 2013-12-30 03:21:22 +0000 |
1495 | @@ -0,0 +1,198 @@ |
1496 | +# -*- coding: utf-8 -*- |
1497 | +############################################################################## |
1498 | +# |
1499 | +# OpenERP, Open Source Management Solution |
1500 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
1501 | +# Jon Chow <jon.chow@elico-corp.com> |
1502 | +# |
1503 | +# This program is free software: you can redistribute it and/or modify |
1504 | +# it under the terms of the GNU Affero General Public License as |
1505 | +# published by the Free Software Foundation, either version 3 of the |
1506 | +# License, or (at your option) any later version. |
1507 | +# |
1508 | +# This program is distributed in the hope that it will be useful, |
1509 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1510 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1511 | +# GNU Affero General Public License for more details. |
1512 | +# |
1513 | +# You should have received a copy of the GNU Affero General Public License |
1514 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1515 | +# |
1516 | +############################################################################## |
1517 | + |
1518 | +from openerp.osv import osv, fields |
1519 | +from openerp import SUPERUSER_ID |
1520 | + |
1521 | + |
1522 | +class account_invoice(osv.osv): |
1523 | + _inherit = "account.invoice" |
1524 | + _name = "account.invoice" |
1525 | + |
1526 | + _columns = { |
1527 | + 'is_locked': fields.boolean('Locked for Intercompany'), |
1528 | + 'ic_create': fields.boolean('Intercompany Invoice generated'), |
1529 | + 'invoice_ic_id': fields.many2one('account.invoice', 'Invoice'), |
1530 | + } |
1531 | + |
1532 | + def get_from_to_company(self, cr, uid, ids, context=None): |
1533 | + """ get company from and to """ |
1534 | + assert len(ids) == 1 |
1535 | + cr.execute(""" |
1536 | + SELECT |
1537 | + inv.company_id AS from_c, cmp.id AS to_c |
1538 | + FROM account_invoice AS inv |
1539 | + LEFT JOIN res_partner as part ON (inv.partner_id = part.id) |
1540 | + LEFT JOIN res_company as cmp ON (part.id = cmp.partner_id ) |
1541 | + WHERE inv.id=%s """, (ids[0],), |
1542 | + ) |
1543 | + return cr.fetchone() |
1544 | + |
1545 | + def need_to_create_intercompany_invoice(self, cr, uid, ids, o2o_field_name=None, node=None, context=None): |
1546 | + """ |
1547 | + @o2o_field_name |
1548 | + @node, draft' or 'confirm', res.intercompany.so2po value , |
1549 | + return boolean |
1550 | + """ |
1551 | + company_from, company_to = self.get_from_to_company(cr, uid, ids, context=context) |
1552 | + need = self.pool.get('res.intercompany').check_need_create_intercompany_object(cr, uid, company_from, company_to, o2o_field_name, node) |
1553 | + return need |
1554 | + |
1555 | + def action_draft(self, cr, uid, ids, context=None): |
1556 | + """ |
1557 | + Picking wkf Draft action, |
1558 | + Use Administrator operate intercompany action |
1559 | + """ |
1560 | + assert len(ids) == 1 |
1561 | + self.action_intercompany(cr, SUPERUSER_ID, ids, node='draft', context=context) |
1562 | + return True |
1563 | + |
1564 | + def action_intercompany(self, cr, uid, ids, node=None, context=None): |
1565 | + """ |
1566 | + if CI, create SI |
1567 | + if SI, create CI |
1568 | + @node, draft or confirm, |
1569 | + """ |
1570 | + assert len(ids) == 1 |
1571 | + cr.execute(""" SELECT type FROM account_invoice WHERE id=%s """,(ids[0],)) |
1572 | + invoice_type = cr.fetchone()[0] |
1573 | + |
1574 | + if invoice_type in ['in_invoice', 'out_invoice']: |
1575 | + #if type=in, check is2do, type=out, |
1576 | + o2o_field_name = invoice_type=='in_invoice' and 'ci2si' or 'si2ci' |
1577 | + if self.need_to_create_intercompany_invoice(cr, uid, ids, o2o_field_name, node=node, context=context): |
1578 | + self.create_intercompany_invoice(cr, uid, ids, self_type=invoice_type, context=None) |
1579 | + |
1580 | + def create_intercompany_invoice(self, cr, uid, ids, self_type=None, context=None): |
1581 | + invoice = self.browse(cr, uid, ids[0]) |
1582 | + company_from, company_to = self.get_from_to_company(cr, uid, ids, context=context) |
1583 | + data = self.prepare_intercompany_invoice(cr, uid, invoice, company_to, context=context) |
1584 | + invoice_id = self.create(cr, uid, data, context=context) |
1585 | + return invoice_id |
1586 | + |
1587 | + def prepare_intercompany_invoice(self, cr, uid, invoice, company_to,context=None): |
1588 | + """ prepare intercompany invoice data |
1589 | + @invoice, browse of account.invoice |
1590 | + @company_to, intercompany_invoice company_id |
1591 | + return {}, data of create invoice |
1592 | + """ |
1593 | + line_pool = self.pool.get('account.invoice.line') |
1594 | + journal_pool = self.pool.get('account.journal') |
1595 | + period_pool = self.pool.get('account.period') |
1596 | + part = invoice.company_id.partner_id |
1597 | + |
1598 | + #Invoice Type and acc_id |
1599 | + hash = { |
1600 | + 'in_invoice': {'create_type':'out_invoice', 'value_reference_name':'property_account_payable' }, |
1601 | + 'out_invoice':{'create_type':'in_invoice' , 'value_reference_name':'property_account_receivable' } |
1602 | + } |
1603 | + acc_id = part.property_account_receivable.id |
1604 | + cr.execute("SELECT value_reference FROM ir_property WHERE name=%s AND res_id='res.partner,%s' AND company_id=%s",(hash[invoice.type]['value_reference_name'],part.id,company_to, )) |
1605 | + prop = cr.fetchone() |
1606 | + if prop and prop[0]: |
1607 | + acc_id = prop[0].split('account.account,')[1] |
1608 | + |
1609 | + #Invoice Journal |
1610 | + type2journal = {'out_invoice': 'sale', 'in_invoice': 'purchase', 'out_refund': 'sale_refund', 'in_refund': 'purchase_refund'} |
1611 | + res = journal_pool.search(cr, uid, [('type', '=', type2journal.get(hash[invoice.type]['create_type'], 'sale')), ('company_id', '=', company_to)], limit=1) |
1612 | + journal_id = res and res[0] or False |
1613 | + # We assume periods in Inter-companies have the same code. |
1614 | + period_ids = period_pool.search(cr, uid, [('code', '=', invoice.period_id.code), ('company_id', '=', company_to)], limit=1) |
1615 | + period_id = period_ids and period_ids[0] or False |
1616 | + |
1617 | + lines_data=[(5,)] |
1618 | + for invoice_line in invoice.invoice_line: |
1619 | + data_line = { |
1620 | + # invoice_id: , |
1621 | + 'name': invoice_line.name, |
1622 | + 'origin': invoice_line.origin, |
1623 | + 'sequence': invoice_line.sequence, |
1624 | + 'uos_id': invoice_line.uos_id and invoice_line.uos_id.id or False, |
1625 | + 'product_id': invoice_line.product_id and invoice_line.product_id.id or False, |
1626 | + 'account_id': acc_id, |
1627 | + 'price_unit': invoice_line.price_unit, |
1628 | + 'quantity': invoice_line.quantity, |
1629 | + 'discount': invoice_line.discount, |
1630 | + 'company_id': company_to, |
1631 | + } |
1632 | + lines_data.append( (0, 0, data_line) ) |
1633 | + |
1634 | + invoice_data = { |
1635 | + 'name': invoice.name, |
1636 | + 'origin': invoice.number and 'IC:' + str(invoice.number) or '', |
1637 | + 'supplier_invoice_number': invoice.supplier_invoice_number, |
1638 | + 'type': hash[invoice.type]['create_type'], |
1639 | + 'reference': invoice.reference, |
1640 | + 'reference_type': invoice.reference_type, |
1641 | + 'comment': invoice.comment, |
1642 | + 'date_invoice': invoice.date_invoice, |
1643 | + 'date_due': invoice.date_due, |
1644 | + 'partner_id': part.id, |
1645 | + 'payment_term': invoice.payment_term and invoice.payment_term.id or False, |
1646 | + 'period_id': period_id, |
1647 | + 'account_id': acc_id, |
1648 | + 'journal_id': journal_id, |
1649 | + 'company_id': company_to , |
1650 | + 'invoice_ic_id': invoice.id, |
1651 | + 'is_locked': True, |
1652 | + 'ic_create': True, |
1653 | + 'invoice_line': lines_data, |
1654 | + #'currency_id': invoice.currency_id and invoice.currency_id.id or False, |
1655 | + } |
1656 | + return invoice_data |
1657 | + |
1658 | + def write(self, cr, uid, ids, values, context=None): |
1659 | + res = super(account_invoice, self).write(cr, uid, ids, values, context=context) |
1660 | + if type(ids) != list: |
1661 | + ids = [ids] |
1662 | + self.update_intercompany_invoice(cr, uid, ids, context=None) |
1663 | + return res |
1664 | + |
1665 | + def unlink(self, cr, uid, ids, context=None): |
1666 | + res = super(account_invoice, self).unlink(cr, uid, ids, context=context) |
1667 | + if type(ids) != type([]): |
1668 | + ids = [ids] |
1669 | + |
1670 | + for inv_id in ids: |
1671 | + inv_ic_ids = self.search(cr, uid, [('invoice_ic_id','=',inv_id)], context=context) |
1672 | + if inv_ic_ids: |
1673 | + self.unlink(cr, uid, inv_ic_ids, context=context) |
1674 | + return res |
1675 | + |
1676 | + def update_intercompany_invoice(self, cr, uid, ids, context=None): |
1677 | + for invoice in self.browse(cr, uid, ids, context): |
1678 | + invoice_ic_id = self.search(cr, uid, [('invoice_ic_id','=',invoice.id )]) |
1679 | + if invoice_ic_id: |
1680 | + company_from, company_to = self.get_from_to_company(cr, uid, [invoice.id,] ,context=context) |
1681 | + data = self.prepare_intercompany_invoice(cr, uid, invoice, company_to, context=context) |
1682 | + self.write(cr, uid, invoice_ic_id, data) |
1683 | + return True |
1684 | + |
1685 | + def invoice_validate(self, cr, uid, ids, context=None): |
1686 | + res = super(account_invoice, self).invoice_validate(cr, uid, ids, context=context) |
1687 | + if res: |
1688 | + self.action_intercompany(cr, uid, ids, node='confirm', context=context) |
1689 | + return res |
1690 | + |
1691 | +account_invoice() |
1692 | + |
1693 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1694 | \ No newline at end of file |
1695 | |
1696 | === added file 'base_intercompany/invoice_wkf.xml' |
1697 | --- base_intercompany/invoice_wkf.xml 1970-01-01 00:00:00 +0000 |
1698 | +++ base_intercompany/invoice_wkf.xml 2013-12-30 03:21:22 +0000 |
1699 | @@ -0,0 +1,14 @@ |
1700 | +<?xml version="1.0" encoding="UTF-8"?> |
1701 | +<openerp> |
1702 | +<data> |
1703 | + |
1704 | +<!-- add the action_draft to invoice WKF. jon.chow#elico-corp.com Aug 23, 2013--> |
1705 | +<record id="account.act_draft" model="workflow.activity"> |
1706 | + <field name="kind">function</field> |
1707 | + <field name="action">action_draft()</field> |
1708 | +</record> |
1709 | + |
1710 | + |
1711 | + |
1712 | +</data> |
1713 | +</openerp> |
1714 | \ No newline at end of file |
1715 | |
1716 | === added file 'base_intercompany/purchase.py' |
1717 | --- base_intercompany/purchase.py 1970-01-01 00:00:00 +0000 |
1718 | +++ base_intercompany/purchase.py 2013-12-30 03:21:22 +0000 |
1719 | @@ -0,0 +1,263 @@ |
1720 | +# -*- coding: utf-8 -*- |
1721 | +############################################################################## |
1722 | +# |
1723 | +# OpenERP, Open Source Management Solution |
1724 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
1725 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> |
1726 | +# Eric Caudal <eric.caudal@elico-corp.com> |
1727 | +# |
1728 | +# This program is free software: you can redistribute it and/or modify |
1729 | +# it under the terms of the GNU Affero General Public License as |
1730 | +# published by the Free Software Foundation, either version 3 of the |
1731 | +# License, or (at your option) any later version. |
1732 | +# |
1733 | +# This program is distributed in the hope that it will be useful, |
1734 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1735 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1736 | +# GNU Affero General Public License for more details. |
1737 | +# |
1738 | +# You should have received a copy of the GNU Affero General Public License |
1739 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1740 | +# |
1741 | +############################################################################## |
1742 | + |
1743 | +from openerp import SUPERUSER_ID |
1744 | +from openerp.osv import fields, orm, osv |
1745 | +from openerp.tools.translate import _ |
1746 | +from openerp import netsvc |
1747 | +from icops.order import icops_order |
1748 | +from openerp import netsvc |
1749 | + |
1750 | + |
1751 | +class purchase_order(orm.Model): |
1752 | + _inherit = 'purchase.order' |
1753 | + _columns = { |
1754 | + 'is_locked': fields.boolean('Locked for Intercompany'), |
1755 | + 'ic_create': fields.boolean('Intercompany PO generated'), |
1756 | + 'sale_id': fields.many2one('sale.order', 'Sales Order'), |
1757 | + } |
1758 | + |
1759 | + _sql_constraints = [( |
1760 | + 'sale_id_unique', 'unique(sale_id)', |
1761 | + 'Sale Id already exists')] |
1762 | + |
1763 | + def action_draft(self, cr, uid, ids, context=None): |
1764 | + """ |
1765 | + function of wkf active draft, |
1766 | + intercompany action operate by Administrator |
1767 | + SUPERUSER_ID used to search, browse kinds of object. |
1768 | + but not used of create, write anything |
1769 | + """ |
1770 | + |
1771 | + assert len(ids) == 1 |
1772 | + context = context or {} |
1773 | + order = self.read(cr, uid, ids[0], ['sale_id']) |
1774 | + if order['sale_id']: |
1775 | + context['is_locked'] = True |
1776 | + context['is_external'] = True |
1777 | + icops = icops_order(self) |
1778 | + icops.create_intercompany(cr, uid, ids, |
1779 | + node='draft', context=context) |
1780 | + return True |
1781 | + |
1782 | + def write(self, cr, uid, ids, values, context=None): |
1783 | + if not isinstance(ids, list): |
1784 | + ids = [ids] |
1785 | + context = context or {} |
1786 | + |
1787 | + res = super(purchase_order, self).write( |
1788 | + cr, uid, ids, values, context=context) |
1789 | + if 'is_locked' not in context: |
1790 | + if 'is_external' in context: |
1791 | + context['is_locked'] = True |
1792 | + icops = icops_order(self) |
1793 | + try: |
1794 | + icops.action( |
1795 | + cr, uid, ids, values, context=context) |
1796 | + except: |
1797 | + raise |
1798 | + return res |
1799 | + |
1800 | + def unlink(self, cr, uid, ids, context=None): |
1801 | + if not isinstance(ids, list): |
1802 | + ids = [ids] |
1803 | + context = context or {} |
1804 | + if 'is_locked' not in context: |
1805 | + if 'is_external' in context: |
1806 | + context['is_locked'] = True |
1807 | + icops = icops_order(self) |
1808 | + try: |
1809 | + icops.action(cr, uid, ids, state="unlink", |
1810 | + context=context) |
1811 | + except: |
1812 | + raise |
1813 | + |
1814 | + return super(purchase_order, self).unlink( |
1815 | + cr, uid, ids, context=context) |
1816 | + |
1817 | + def action_cancel(self, cr, uid, ids, context=None): |
1818 | + wf_service = netsvc.LocalService("workflow") |
1819 | + for purchase in self.browse(cr, uid, ids, context=context): |
1820 | + for pick in purchase.picking_ids: |
1821 | + if pick.state not in ('draft', 'cancel'): |
1822 | + raise osv.except_osv( |
1823 | + _('Unable to cancel this purchase order.'), |
1824 | + _('First cancel all receptions related\ |
1825 | + to this purchase order.')) |
1826 | + for pick in purchase.picking_ids: |
1827 | + wf_service.trg_validate( |
1828 | + uid, 'stock.picking', pick.id, 'button_cancel', cr) |
1829 | + for inv in purchase.invoice_ids: |
1830 | + if inv and inv.state not in ('cancel', 'draft'): |
1831 | + raise osv.except_osv( |
1832 | + _('Unable to cancel this purchase order.'), |
1833 | + _('You must first cancel all receptions related to \ |
1834 | + this purchase order.')) |
1835 | + if inv: |
1836 | + wf_service.trg_validate( |
1837 | + uid, 'account.invoice', inv.id, 'invoice_cancel', cr) |
1838 | + self.write(cr, uid, ids, {'state': 'cancel'}, context=context) |
1839 | + |
1840 | + for (id, name) in self.name_get(cr, uid, ids): |
1841 | + wf_service.trg_validate( |
1842 | + uid, 'purchase.order', id, 'purchase_cancel', cr) |
1843 | + return True |
1844 | + |
1845 | + def _prepare_IC(self, cr, uid, id, |
1846 | + company_to, ic_uid, context=None): |
1847 | + """ |
1848 | + according the PO and company_to, prepare the SO data, |
1849 | + It can be used to create or update SO record. |
1850 | + @po SO browse record |
1851 | + @company_to company_id |
1852 | + @ic_uid |
1853 | + return { }, value of SO data |
1854 | + """ |
1855 | + if isinstance(company_to, list): |
1856 | + company_to = company_to[0] |
1857 | + order = self.read(cr, uid, id, ['name', 'company_id', 'order_line', |
1858 | + 'state']) |
1859 | + company_pool = self.pool.get('res.company') |
1860 | + company = company_pool.read( |
1861 | + cr, uid, order['company_id'][0], ['partner_id']) |
1862 | + partner_pool = self.pool.get('res.partner') |
1863 | + customer = partner_pool.read( |
1864 | + cr, ic_uid, company['partner_id'][0], |
1865 | + ['property_product_pricelist', |
1866 | + 'property_account_position', |
1867 | + 'property_payment_term', |
1868 | + 'user_id']) |
1869 | + |
1870 | + addr = partner_pool.address_get(cr, uid, [customer['id']], |
1871 | + ['delivery', 'invoice', 'contact']) |
1872 | + |
1873 | + pricelist = (customer['property_product_pricelist'][0] |
1874 | + if customer['property_product_pricelist'] |
1875 | + else False) |
1876 | + |
1877 | + fiscal_position = (customer['property_account_position'][0] |
1878 | + if customer['property_account_position'] |
1879 | + else False) |
1880 | + payment_term = (customer['property_payment_term'][0] |
1881 | + if customer['property_payment_term'] |
1882 | + else False) |
1883 | + |
1884 | + salesman = customer['user_id'][0] if customer['user_id'] else ic_uid |
1885 | + company = company_pool.read( |
1886 | + cr, ic_uid, company_to, ['intercompany_shop_id']) |
1887 | + |
1888 | + if not 'intercompany_shop_id' in company: |
1889 | + raise osv.except_osv( |
1890 | + _('Error!'), |
1891 | + _('There is no default shop for the destination company!')) |
1892 | + |
1893 | + shop_id = company['intercompany_shop_id'][0] |
1894 | + sol_datas = [(5,)] |
1895 | + pol_pool = self.pool.get('purchase.order.line') |
1896 | + i = 0 |
1897 | + for line in pol_pool.read( |
1898 | + cr, uid, order['order_line'], |
1899 | + ['name', 'ic_pol_id', 'product_qty', |
1900 | + 'product_id', 'product_uom', 'price_unit', |
1901 | + 'state']): |
1902 | + line_data = (0, 0, { |
1903 | + #'order_id': so_id, |
1904 | + 'name': line['name'], |
1905 | + 'ic_pol_id': line['id'], |
1906 | + 'product_uom_qty': line['product_qty'], |
1907 | + 'product_id': line['product_id'][0], |
1908 | + 'product_uom': line['product_uom'][0], |
1909 | + 'price_unit': line['price_unit'] |
1910 | + }) |
1911 | + sol_datas.append(line_data) |
1912 | + state = "draft" if order['state'] != "approved" else "progress" |
1913 | + so_data = { |
1914 | + 'partner_id': customer['id'], |
1915 | + 'pricelist_id': pricelist, |
1916 | + 'partner_invoice_id': addr['invoice'], |
1917 | + # 'partner_order_id': addr['contact'], |
1918 | + 'partner_shipping_id': addr['delivery'], |
1919 | + 'payment_term': payment_term, |
1920 | + 'fiscal_position': fiscal_position, |
1921 | + 'user_id': salesman, |
1922 | + 'purchase_id': order['id'], |
1923 | + 'ic_create': True, |
1924 | + 'shop_id': shop_id, |
1925 | + 'origin': 'IC:' + str(order['name']), |
1926 | + 'order_line': sol_datas, |
1927 | + 'state': state |
1928 | + } |
1929 | + if 'is_external' in context: |
1930 | + so_data = { |
1931 | + 'order_line': sol_datas, |
1932 | + 'state': state |
1933 | + } |
1934 | + |
1935 | + return so_data |
1936 | + |
1937 | + def copy(self, cr, uid, id, default=None, context=None): |
1938 | + if not default: |
1939 | + default = {} |
1940 | + default.update({ |
1941 | + 'sale_id': None |
1942 | + }) |
1943 | + return super(purchase_order, self).copy(cr, uid, id, default, context) |
1944 | + |
1945 | + def wkf_confirm_order(self, cr, uid, ids, context=None): |
1946 | + if not isinstance(ids, list): |
1947 | + ids = [ids] |
1948 | + context = context or {} |
1949 | + if 'is_external' not in context: |
1950 | + icops = icops_order(self) |
1951 | + try: |
1952 | + icops.action( |
1953 | + cr, uid, ids, state='confirm', context=context) |
1954 | + except: |
1955 | + raise |
1956 | + todo = [] |
1957 | + sol_pool = self.pool.get('sale.order.line') |
1958 | + for po in self.read(cr, uid, ids, ['order_line']): |
1959 | + if not po['order_line']: |
1960 | + raise osv.except_osv(_('Error!'), _( |
1961 | + 'You cannot confirm a purchase order without any\ |
1962 | + purchase order line.')) |
1963 | + for line in sol_pool.read(cr, uid, po['order_line'], ['state']): |
1964 | + if line['state'] == 'draft': |
1965 | + todo.append(line.id) |
1966 | + |
1967 | + self.pool.get('purchase.order.line').action_confirm( |
1968 | + cr, uid, todo, context) |
1969 | + for id in ids: |
1970 | + self.write( |
1971 | + cr, uid, [id], {'state': 'confirmed', 'validator': uid}, |
1972 | + context=context) |
1973 | + return True |
1974 | + |
1975 | + |
1976 | +class purchase_order_line(orm.Model): |
1977 | + _inherit = 'purchase.order.line' |
1978 | + _columns = { |
1979 | + 'ic_sol_id': fields.many2one('sale.order.line', 'IC SOL'), |
1980 | + } |
1981 | + |
1982 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1983 | |
1984 | === added file 'base_intercompany/purchase_wkf.xml' |
1985 | --- base_intercompany/purchase_wkf.xml 1970-01-01 00:00:00 +0000 |
1986 | +++ base_intercompany/purchase_wkf.xml 2013-12-30 03:21:22 +0000 |
1987 | @@ -0,0 +1,15 @@ |
1988 | +<?xml version="1.0" encoding="UTF-8"?> |
1989 | +<openerp> |
1990 | + <data> |
1991 | + <!-- purchase order wkf draft action jon.chow#elico-corp.com Aug 8, 2013--> |
1992 | + <record id="purchase.act_draft" model="workflow.activity"> |
1993 | + <field name="wkf_id" ref="purchase.purchase_order"/> |
1994 | + <field name="kind">function</field> |
1995 | + <field name="action">action_draft()</field> |
1996 | + </record> |
1997 | + <record id="purchase.act_cancel" model="workflow.activity"> |
1998 | + <field name="action">action_cancel()</field> |
1999 | + </record> |
2000 | + |
2001 | + </data> |
2002 | +</openerp> |
2003 | |
2004 | === added file 'base_intercompany/sale.py' |
2005 | --- base_intercompany/sale.py 1970-01-01 00:00:00 +0000 |
2006 | +++ base_intercompany/sale.py 2013-12-30 03:21:22 +0000 |
2007 | @@ -0,0 +1,246 @@ |
2008 | +# -*- coding: utf-8 -*- |
2009 | +############################################################################## |
2010 | +# |
2011 | +# OpenERP, Open Source Management Solution |
2012 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
2013 | +# Augustin Cisterne-Kaas <augustin.cisterne-kaaas@elico-corp.com> |
2014 | +# Eric Caudal <eric.caudal@elico-corp.com> |
2015 | +# |
2016 | +# This program is free software: you can redistribute it and/or modify |
2017 | +# it under the terms of the GNU Affero General Public License as |
2018 | +# published by the Free Software Foundation, either version 3 of the |
2019 | +# License, or (at your option) any later version. |
2020 | +# |
2021 | +# This program is distributed in the hope that it will be useful, |
2022 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2023 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2024 | +# GNU Affero General Public License for more details. |
2025 | +# |
2026 | +# You should have received a copy of the GNU Affero General Public License |
2027 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2028 | +# |
2029 | +############################################################################## |
2030 | + |
2031 | +from openerp.osv import fields, orm, osv |
2032 | +from openerp.tools.translate import _ |
2033 | +from icops.order import icops_order |
2034 | +from openerp import SUPERUSER_ID |
2035 | +from openerp import netsvc |
2036 | +from collections import namedtuple |
2037 | + |
2038 | + |
2039 | +class sale_order(orm.Model): |
2040 | + _inherit = 'sale.order' |
2041 | + _columns = { |
2042 | + 'is_locked': fields.boolean('Locked for Intercompany'), |
2043 | + 'ic_create': fields.boolean('Intercompany SO generated'), |
2044 | + 'purchase_id': fields.many2one('purchase.order', 'Purchase Order'), |
2045 | + } |
2046 | + |
2047 | + _sql_constraints = [( |
2048 | + 'purchase_id_unique', 'unique(purchase_id)', |
2049 | + 'Purchase Id already exists')] |
2050 | + |
2051 | + def action_draft(self, cr, uid, ids, context=None): |
2052 | + """ |
2053 | + SO wkf Draft action, |
2054 | + Use Administrator operate intercompany action |
2055 | + """ |
2056 | + assert len(ids) == 1 |
2057 | + if context is None: |
2058 | + context = {} |
2059 | + order = self.browse(cr, SUPERUSER_ID, ids[0], context=context) |
2060 | + if order.purchase_id: |
2061 | + if order.purchase_id: |
2062 | + context['is_locked'] = True |
2063 | + context['is_external'] = True |
2064 | + icops = icops_order(self) |
2065 | + icops.create_intercompany(cr, uid, ids, context=context) |
2066 | + return True |
2067 | + |
2068 | + def write(self, cr, uid, ids, values, context=None): |
2069 | + if not isinstance(ids, list): |
2070 | + ids = [ids] |
2071 | + context = context or {} |
2072 | + res = super(sale_order, self).write( |
2073 | + cr, uid, ids, values, context=context) |
2074 | + if 'is_locked' not in context: |
2075 | + if 'is_external' in context: |
2076 | + context['is_locked'] = True |
2077 | + icops = icops_order(self) |
2078 | + try: |
2079 | + icops.action(cr, uid, ids, values, |
2080 | + context=context) |
2081 | + except: |
2082 | + raise |
2083 | + return res |
2084 | + |
2085 | + def unlink(self, cr, uid, ids, context=None): |
2086 | + if not isinstance(ids, list): |
2087 | + ids = [ids] |
2088 | + if not isinstance(context, dict): |
2089 | + context = {} |
2090 | + if 'is_locked' not in context: |
2091 | + if 'is_external' in context: |
2092 | + context['is_locked'] = True |
2093 | + icops = icops_order(self) |
2094 | + try: |
2095 | + icops.action(cr, uid, ids, state="unlink", |
2096 | + context=context) |
2097 | + except: |
2098 | + raise |
2099 | + return super(sale_order, self).unlink( |
2100 | + cr, uid, ids, context=context) |
2101 | + |
2102 | + def action_cancel(self, cr, uid, ids, context=None): |
2103 | + wf_service = netsvc.LocalService("workflow") |
2104 | + context = context or {} |
2105 | + sale_order_line_obj = self.pool.get('sale.order.line') |
2106 | + for sale in self.browse(cr, uid, ids, context=context): |
2107 | + for inv in sale.invoice_ids: |
2108 | + if inv.state not in ('draft', 'cancel'): |
2109 | + raise osv.except_osv( |
2110 | + _('Cannot cancel this sales order!'), |
2111 | + _('First cancel all invoices attached\ |
2112 | + to this sales order.')) |
2113 | + for r in self.read(cr, uid, ids, ['invoice_ids']): |
2114 | + for inv in r['invoice_ids']: |
2115 | + wf_service.trg_validate( |
2116 | + uid, 'account.invoice', inv, 'invoice_cancel', cr) |
2117 | + sale_order_line_obj.write( |
2118 | + cr, uid, [l.id for l in sale.order_line], |
2119 | + {'state': 'cancel'}) |
2120 | + self.write(cr, uid, ids, {'state': 'cancel'}, context=context) |
2121 | + return True |
2122 | + |
2123 | + def action_wait(self, cr, uid, ids, context=None): |
2124 | + if not isinstance(ids, list): |
2125 | + ids = [ids] |
2126 | + context = context or {} |
2127 | + if 'is_external' not in context: |
2128 | + icops = icops_order(self) |
2129 | + try: |
2130 | + icops.action( |
2131 | + cr, uid, ids, state='confirm', context=context) |
2132 | + except: |
2133 | + raise |
2134 | + return super(sale_order, self).action_wait( |
2135 | + cr, uid, ids, context=context) |
2136 | + |
2137 | + def _prepare_IC(self, cr, uid, id, |
2138 | + company_to, ic_uid, context=None): |
2139 | + |
2140 | + """ |
2141 | + prepare the intercompany PO data, |
2142 | + it can be used to create or update PO record |
2143 | + @ so SO browse record |
2144 | + @ company_to company_id |
2145 | + @ic_uid Internal company user id |
2146 | + """ |
2147 | + if isinstance(company_to, list): |
2148 | + company_to = company_to[0] |
2149 | + # to avoid many SQL requests |
2150 | + OrderStruct = namedtuple('OrderStruct', 'company_id') |
2151 | + CompanyStruct = namedtuple('CompanyStruct', 'security_lead') |
2152 | + LineStruct = namedtuple('LineStruct', 'delay') |
2153 | + |
2154 | + order = self.read(cr, uid, id, |
2155 | + ['order_line', 'date_order', 'company_id', |
2156 | + 'state', 'name']) |
2157 | + company_pool = self.pool.get('res.company') |
2158 | + company = company_pool.read( |
2159 | + cr, uid, order['company_id'][0], ['partner_id', 'security_lead']) |
2160 | + |
2161 | + fake_company_obj = CompanyStruct( |
2162 | + security_lead=company['security_lead'] or 0) |
2163 | + fake_so_obj = OrderStruct(company_id=fake_company_obj) |
2164 | + supplier = self.pool.get('res.partner').read( |
2165 | + cr, ic_uid, company['partner_id'][0], |
2166 | + ['property_product_pricelist_purchase', |
2167 | + 'property_account_position', |
2168 | + 'property_supplier_payment_term']) |
2169 | + pricelist = (supplier['property_product_pricelist_purchase'][0] |
2170 | + if supplier['property_product_pricelist_purchase'] |
2171 | + else False) |
2172 | + |
2173 | + fiscal_position = (supplier['property_account_position'][0] |
2174 | + if supplier['property_account_position'] |
2175 | + else False) |
2176 | + payment_term = (supplier['property_supplier_payment_term'][0] |
2177 | + if supplier['property_supplier_payment_term'] |
2178 | + else False) |
2179 | + |
2180 | + company = company_pool.read( |
2181 | + cr, ic_uid, company_to, ['intercompany_shop_id']) |
2182 | + intercompany_shop = self.pool.get('sale.shop').read( |
2183 | + cr, ic_uid, company['intercompany_shop_id'][0], ['warehouse_id']) |
2184 | + warehouse = self.pool.get('stock.warehouse').read( |
2185 | + cr, ic_uid, intercompany_shop['warehouse_id'][0], ['lot_stock_id']) |
2186 | + |
2187 | + if not 'lot_stock_id' in warehouse: |
2188 | + raise osv.except_osv( |
2189 | + _('Error!'), |
2190 | + _('prepare_intercompany_po_data,not found location_id')) |
2191 | + |
2192 | + location_id = warehouse['lot_stock_id'][0] |
2193 | + polines_data = [(5,)] |
2194 | + sol_pool = self.pool.get('sale.order.line') |
2195 | + for line in sol_pool.read( |
2196 | + cr, uid, order['order_line'], |
2197 | + ['name', 'product_uom_qty', 'product_id', 'product_uom', |
2198 | + 'price_unit', 'delay']): |
2199 | + |
2200 | + fake_line_obj = LineStruct(delay=line['delay']) |
2201 | + date_planned = self._get_date_planned( |
2202 | + cr, uid, fake_so_obj, |
2203 | + fake_line_obj, |
2204 | + order['date_order'], context=context) |
2205 | + pol_data = (0, 0, { |
2206 | + 'ic_sol_id': line['id'], |
2207 | + 'name': line['name'], |
2208 | + 'product_qty': line['product_uom_qty'], |
2209 | + 'product_id': line['product_id'][0], |
2210 | + 'product_uom': line['product_uom'][0], |
2211 | + 'price_unit': line['price_unit'], |
2212 | + 'date_planned': date_planned, |
2213 | + }) |
2214 | + polines_data.append(pol_data) |
2215 | + company_id = company_to |
2216 | + state = "draft" if order['state'] != "progress" else "approved" |
2217 | + po_data = { |
2218 | + 'partner_id': supplier['id'], |
2219 | + 'pricelist_id': pricelist, |
2220 | + 'payment_term_id': payment_term, |
2221 | + 'fiscal_position': fiscal_position, |
2222 | + 'sale_id': order['id'], |
2223 | + 'ic_create': True, |
2224 | + 'company_id': company['id'], |
2225 | + 'location_id': location_id, |
2226 | + 'origin': 'IC:' + str(order['name']), |
2227 | + 'order_line': polines_data, |
2228 | + 'state': state |
2229 | + } |
2230 | + if 'is_external' in context: |
2231 | + po_data = { |
2232 | + 'order_line': polines_data, |
2233 | + 'state': state |
2234 | + } |
2235 | + |
2236 | + return po_data |
2237 | + |
2238 | + def copy(self, cr, uid, id, default=None, context=None): |
2239 | + if not default: |
2240 | + default = {} |
2241 | + default.update({ |
2242 | + 'purchase_id': None |
2243 | + }) |
2244 | + return super(sale_order, self).copy(cr, uid, id, default, context) |
2245 | + |
2246 | + |
2247 | +class sale_order_line(orm.Model): |
2248 | + _inherit = 'sale.order.line' |
2249 | + _columns = { |
2250 | + 'ic_pol_id': fields.many2one('purchase.order.line', |
2251 | + 'Intercompany PO Line'), |
2252 | + } |
2253 | +#vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2254 | |
2255 | === added file 'base_intercompany/sale_wkf.xml' |
2256 | --- base_intercompany/sale_wkf.xml 1970-01-01 00:00:00 +0000 |
2257 | +++ base_intercompany/sale_wkf.xml 2013-12-30 03:21:22 +0000 |
2258 | @@ -0,0 +1,14 @@ |
2259 | +<?xml version="1.0" encoding="UTF-8"?> |
2260 | +<openerp> |
2261 | + <data> |
2262 | + <!-- action draft Activity --> |
2263 | + <record id="sale.act_draft" model="workflow.activity"> |
2264 | + <field name="wkf_id" ref="sale.wkf_sale"/> |
2265 | + <field name="kind">function</field> |
2266 | + <field name="action">action_draft()</field> |
2267 | + </record> |
2268 | + <record id="sale.act_cancel" model="workflow.activity"> |
2269 | + <field name="action">action_cancel()</field> |
2270 | + </record> |
2271 | + </data> |
2272 | +</openerp> |
2273 | \ No newline at end of file |
2274 | |
2275 | === added directory 'base_intercompany/security' |
2276 | === added file 'base_intercompany/security/intercompany_security.xml' |
2277 | --- base_intercompany/security/intercompany_security.xml 1970-01-01 00:00:00 +0000 |
2278 | +++ base_intercompany/security/intercompany_security.xml 2013-12-30 03:21:22 +0000 |
2279 | @@ -0,0 +1,73 @@ |
2280 | +<?xml version="1.0" encoding="utf-8"?> |
2281 | +<openerp> |
2282 | + <!-- Groups --> |
2283 | + <data noupdate="1"> |
2284 | + <record id="group_intercompany_user" model="res.groups"> |
2285 | + <field name="name">InterCompany User</field> |
2286 | + <field name="users" eval="[(4, ref('base.user_root'))]"/> |
2287 | + </record> |
2288 | + <record id="group_intercompany_manager" model="res.groups"> |
2289 | + <field name="name">InterCompany Manager</field> |
2290 | + <field name="implied_ids" eval="[(4, ref('group_intercompany_user'))]"/> |
2291 | + <field name="users" eval="[(4, ref('base.user_root'))]"/> |
2292 | + </record> |
2293 | + </data> |
2294 | + |
2295 | + <!-- Rules --> |
2296 | + <data noupdate="1"> |
2297 | + <record id="sale_order_intercompany" model="ir.rule"> |
2298 | + <field name="name">IC Sales Orders</field> |
2299 | + <field ref="sale.model_sale_order" name="model_id"/> |
2300 | + <field name="domain_force">[(1,'=',1)]</field> |
2301 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2302 | + </record> |
2303 | + <record id="sale_order_line_intercompany" model="ir.rule"> |
2304 | + <field name="name">IC Sales Order Lines</field> |
2305 | + <field ref="sale.model_sale_order_line" name="model_id"/> |
2306 | + <field name="domain_force">[(1,'=',1)]</field> |
2307 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2308 | + </record> |
2309 | + <record id="purchase_order_intercompany" model="ir.rule"> |
2310 | + <field name="name">IC Purchase Orders</field> |
2311 | + <field ref="purchase.model_purchase_order" name="model_id"/> |
2312 | + <field name="domain_force">[(1,'=',1)]</field> |
2313 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2314 | + </record> |
2315 | + <record id="purchase_order_line_intercompany" model="ir.rule"> |
2316 | + <field name="name">IC Purchase Order Lines</field> |
2317 | + <field ref="purchase.model_purchase_order_line" name="model_id"/> |
2318 | + <field name="domain_force">[(1,'=',1)]</field> |
2319 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2320 | + </record> |
2321 | + <record id="stock_picking_in_intercompany" model="ir.rule"> |
2322 | + <field name="name">IC Picking IN</field> |
2323 | + <field ref="stock.model_stock_picking_in" name="model_id"/> |
2324 | + <field name="domain_force">[(1,'=',1)]</field> |
2325 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2326 | + </record> |
2327 | + <record id="stock_picking_out_intercompany" model="ir.rule"> |
2328 | + <field name="name">IC Picking OUT</field> |
2329 | + <field ref="stock.model_stock_picking_out" name="model_id"/> |
2330 | + <field name="domain_force">[(1,'=',1)]</field> |
2331 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2332 | + </record> |
2333 | + <record id="stock_move_intercompany" model="ir.rule"> |
2334 | + <field name="name">IC Stock Moves</field> |
2335 | + <field ref="stock.model_stock_move" name="model_id"/> |
2336 | + <field name="domain_force">[(1,'=',1)]</field> |
2337 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2338 | + </record> |
2339 | + <record id="account_invoice_intercompany" model="ir.rule"> |
2340 | + <field name="name">IC Invoices</field> |
2341 | + <field ref="account.model_account_invoice" name="model_id"/> |
2342 | + <field name="domain_force">[(1,'=',1)]</field> |
2343 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2344 | + </record> |
2345 | + <record id="account_invoice_line_intercompany" model="ir.rule"> |
2346 | + <field name="name">IC Invoice Lines</field> |
2347 | + <field ref="account.model_account_invoice_line" name="model_id"/> |
2348 | + <field name="domain_force">[(1,'=',1)]</field> |
2349 | + <field name="groups" eval="[(4, ref('group_intercompany_user'))]"/> |
2350 | + </record> |
2351 | + </data> |
2352 | +</openerp> |
2353 | \ No newline at end of file |
2354 | |
2355 | === added file 'base_intercompany/security/ir.model.access.csv' |
2356 | --- base_intercompany/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
2357 | +++ base_intercompany/security/ir.model.access.csv 2013-12-30 03:21:22 +0000 |
2358 | @@ -0,0 +1,3 @@ |
2359 | +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
2360 | +access_intercompany_user,intercompany.user,model_res_intercompany,base.group_user,1,0,0,0 |
2361 | +access_intercompany_manager,intercompany.manager,model_res_intercompany,group_intercompany_manager,1,1,1,1 |
2362 | |
2363 | === added directory 'base_intercompany/static' |
2364 | === added directory 'base_intercompany/static/description' |
2365 | === added file 'base_intercompany/static/description/Intercompany_setup.png' |
2366 | Binary files base_intercompany/static/description/Intercompany_setup.png 1970-01-01 00:00:00 +0000 and base_intercompany/static/description/Intercompany_setup.png 2013-12-30 03:21:22 +0000 differ |
2367 | === added file 'base_intercompany/static/description/index.html' |
2368 | --- base_intercompany/static/description/index.html 1970-01-01 00:00:00 +0000 |
2369 | +++ base_intercompany/static/description/index.html 2013-12-30 03:21:22 +0000 |
2370 | @@ -0,0 +1,29 @@ |
2371 | +<section class="oe_container"> |
2372 | + <div class="oe_row"> |
2373 | + <h2 class="oe_slogan">base_intercompany</h2> |
2374 | + <h3 class="oe_slogan">Inter-Company Processing (ICOPS) <br></h3> |
2375 | + <h4 class="oe_slogan"><a href="http://www.elico-corp.com">By Elico Corp</a></h4> |
2376 | + <p> |
2377 | + |
2378 | +This module is designed to manage Inter-company Process (ICOPS) and allow 2 companies to create objects in each other:<br> |
2379 | +- When a PO to company B is created in company A, it creates automatically a SO in company B<br> |
2380 | +- When a SO to company B is created in company A, it creates automatically a PO in company B<br> |
2381 | +- Update PO from/to SO<br> |
2382 | +- Confirm SO for PO and vice versa<br> |
2383 | +- It is generic enough to allow intercompany process companies in cascade<br> |
2384 | +- it can be uni-directional/bi-directional (eg SO in company A creates PO in company B and when the PO is validated in company B it validate the SO in company A).</br> |
2385 | +</br> |
2386 | +Works fine with SO/PO<br> |
2387 | +Under construction: Sales invoice/Purchase invoice and Stock Moves<br> |
2388 | +TODO: demo data to be improved and tests <br> |
2389 | +Blueprint: https://blueprints.launchpad.net/multi-company/+spec/icops<br> |
2390 | +</p> |
2391 | + <div class="oe_row_img oe_centered oe_mt32"> |
2392 | + <img class="oe_picture oe_screenshot" src="Intercompany_setup.png"> |
2393 | + </div> |
2394 | + </div> |
2395 | + <div class="oe_row oe_centeralign oe_more_space"> |
2396 | + <a href="http://www.elico-corp.com/saas/" class="oe_button oe_big">Start your <span class="oe_emph">free</span> trial</a> |
2397 | + </div> |
2398 | + <h4 class="oe_slogan">or</h4> |
2399 | +</section> |
2400 | |
2401 | === added directory 'base_intercompany/static/src' |
2402 | === added directory 'base_intercompany/static/src/img' |
2403 | === added file 'base_intercompany/static/src/img/icon.png' |
2404 | Binary files base_intercompany/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and base_intercompany/static/src/img/icon.png 2013-12-30 03:21:22 +0000 differ |
2405 | === added file 'base_intercompany/stock_picking.py' |
2406 | --- base_intercompany/stock_picking.py 1970-01-01 00:00:00 +0000 |
2407 | +++ base_intercompany/stock_picking.py 2013-12-30 03:21:22 +0000 |
2408 | @@ -0,0 +1,806 @@ |
2409 | +# -*- coding: utf-8 -*- |
2410 | +############################################################################## |
2411 | +# |
2412 | +# OpenERP, Open Source Management Solution |
2413 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
2414 | +# Jon Chow <jon.chow@elico-corp.com> |
2415 | +# |
2416 | +# This program is free software: you can redistribute it and/or modify |
2417 | +# it under the terms of the GNU Affero General Public License as |
2418 | +# published by the Free Software Foundation, either version 3 of the |
2419 | +# License, or (at your option) any later version. |
2420 | +# |
2421 | +# This program is distributed in the hope that it will be useful, |
2422 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2423 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2424 | +# GNU Affero General Public License for more details. |
2425 | +# |
2426 | +# You should have received a copy of the GNU Affero General Public License |
2427 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2428 | +# |
2429 | +############################################################################## |
2430 | + |
2431 | +# from openerp import SUPERUSER_ID, netsvc |
2432 | +# from openerp.osv import fields, osv |
2433 | +# from openerp.tools.translate import _ |
2434 | + |
2435 | + |
2436 | +# class stock_move(osv.osv): |
2437 | +# _inherit = 'stock.move' |
2438 | +# _name = 'stock.move' |
2439 | + |
2440 | +# def _default_location_source(self, cr, uid, context=None): |
2441 | +# """ |
2442 | +# Gets default address of partner for source location |
2443 | +# @return: Address id or False |
2444 | +# """ |
2445 | +# context = context or {} |
2446 | +# mod_pool = self.pool.get('ir.model.data') |
2447 | +# picking_type = context.get('picking_type') |
2448 | +# location_id = False |
2449 | + |
2450 | +# if context.get('move_line', []): |
2451 | +# try: |
2452 | +# location_id = context['move_line'][0][2]['location_id'] |
2453 | +# except: |
2454 | +# pass |
2455 | +# elif context.get('address_in_id', False): |
2456 | +# part_obj_add = self.pool.get('res.partner').browse( |
2457 | +# cr, uid, context['address_in_id'], context=context) |
2458 | +# if part_obj_add: |
2459 | +# location_id = part_obj_add.property_stock_supplier.id |
2460 | +# else: |
2461 | +# location_xml_id = False |
2462 | +# if picking_type == 'in': |
2463 | +# location_xml_id = 'stock_location_suppliers' |
2464 | +# location_model, location_id = mod_pool.get_object_reference( |
2465 | +# cr, uid, 'stock', location_xml_id) |
2466 | +# elif picking_type == 'internal': |
2467 | +# location_xml_id = 'stock_location_stock' |
2468 | +# location_model, location_id = mod_pool.get_object_reference( |
2469 | +# cr, uid, 'stock', location_xml_id) |
2470 | +# else: |
2471 | +# company_id = self.pool.get('res.users').browse( |
2472 | +# cr, uid, uid, context=context).company_id.id |
2473 | +# cr.execute(""" |
2474 | +# SELECT |
2475 | +# id |
2476 | +# FROM |
2477 | +# stock_location |
2478 | +# WHERE |
2479 | +# company_id=%s AND name = 'Stock' |
2480 | +# """, (company_id,)) |
2481 | +# location_id = cr.fetchone()[0] |
2482 | +# return location_id |
2483 | + |
2484 | +# def _default_location_destination(self, cr, uid, context=None): |
2485 | +# """ |
2486 | +# Gets default address of partner for destination location |
2487 | +# @return: Address id or False |
2488 | +# """ |
2489 | + |
2490 | +# context = context or {} |
2491 | +# mod_pool = self.pool.get('ir.model.data') |
2492 | +# picking_type = context.get('picking_type') |
2493 | +# location_id = False |
2494 | + |
2495 | +# if context.get('move_line', []): |
2496 | +# if context['move_line'][0]: |
2497 | +# if isinstance(context['move_line'][0], (tuple, list)): |
2498 | +# location_id = (context['move_line'][0][2] |
2499 | +# and context['move_line'][0][2].get( |
2500 | +# 'location_dest_id', False) |
2501 | +# ) |
2502 | +# else: |
2503 | +# move_list = self.pool.get('stock.move').read( |
2504 | +# cr, uid, context['move_line'][0], ['location_dest_id']) |
2505 | +# location_id = (move_list |
2506 | +# and move_list['location_dest_id'][0] |
2507 | +# or False) |
2508 | +# elif context.get('address_out_id', False): |
2509 | +# property_out = self.pool.get('res.partner').browse( |
2510 | +# cr, uid, context['address_out_id'], |
2511 | +# context).property_stock_customer |
2512 | +# location_id = property_out and property_out.id or False |
2513 | +# else: |
2514 | +# location_xml_id = False |
2515 | +# if picking_type == 'internal': |
2516 | +# location_xml_id = 'stock_location_stock' |
2517 | +# location_model, location_id = mod_pool.get_object_reference( |
2518 | +# cr, uid, 'stock', location_xml_id) |
2519 | +# elif picking_type == 'out': |
2520 | +# location_xml_id = 'stock_location_customers' |
2521 | +# location_model, location_id = mod_pool.get_object_reference( |
2522 | +# cr, uid, 'stock', location_xml_id) |
2523 | +# else: |
2524 | +# company_id = self.pool.get('res.users').browse( |
2525 | +# cr, uid, uid, context=context).company_id.id |
2526 | +# cr.execute(""" |
2527 | +# SELECT |
2528 | +# id |
2529 | +# FROM |
2530 | +# stock_location |
2531 | +# WHERE |
2532 | +# company_id=%s AND name = 'Stock' |
2533 | +# """, (company_id,)) |
2534 | +# location_id = cr.fetchone()[0] |
2535 | +# return location_id |
2536 | + |
2537 | +# _defaults = { |
2538 | +# 'location_id': _default_location_source, |
2539 | +# 'location_dest_id': _default_location_destination, |
2540 | +# } |
2541 | + |
2542 | +# stock_move() |
2543 | + |
2544 | + |
2545 | +# class stock_picking(osv.osv): |
2546 | +# _inherit = 'stock.picking' |
2547 | +# _name = 'stock.picking' |
2548 | + |
2549 | +# _columns = { |
2550 | +# 'is_locked': fields.boolean('Locked for Intercompany'), |
2551 | +# 'ic_create': fields.boolean('Intercompany Picking generated'), |
2552 | +# 'picking_ic_id': fields.many2one('stock.picking', 'Stock Picking'), |
2553 | +# } |
2554 | + |
2555 | +# def get_intercompany(self, cr, uid, id, context=None): |
2556 | +# """ |
2557 | +# Return company_from company_to |
2558 | +# """ |
2559 | + |
2560 | +# assert isinstance(id, int) or isinstance(id, long) |
2561 | +# cr.execute(""" |
2562 | +# SELECT |
2563 | +# pick.company_id AS from_c, cmp.id AS to_c, cmp.intercompany_uid |
2564 | +# FROM |
2565 | +# stock_picking AS pick |
2566 | +# LEFT JOIN res_partner AS part ON (pick.partner_id=part.id) |
2567 | +# LEFT JOIN res_company AS cmp ON (part.id=cmp.partner_id) |
2568 | +# WHERE |
2569 | +# pick.id=%s |
2570 | +# """, (id,)) |
2571 | +# return cr.fetchone() |
2572 | + |
2573 | +# def need_to_create_intercompany_picking( |
2574 | +# self, cr, uid, ids, o2o_field_name=None, node=None, context=None): |
2575 | +# """ |
2576 | +# @o2o_field_name |
2577 | +# @node, draft' or 'confirm', res.intercompany.so2po value, |
2578 | +# """ |
2579 | + |
2580 | +# intercompany_obj = self.pool.get('res.intercompany') |
2581 | +# cf, ct, ic_uid = self.get_intercompany(cr, uid, ids[0], |
2582 | +# context=context) |
2583 | +# return intercompany_obj.check_need_create_intercompany_object( |
2584 | +# cr, uid, cf, ct, o2o_field_name, node) |
2585 | + |
2586 | +# def action_draft(self, cr, uid, ids, context=None): |
2587 | +# """ |
2588 | +# Picking wkf Draft action, |
2589 | +# Use Administrator operate intercompany action |
2590 | +# """ |
2591 | + |
2592 | +# assert len(ids) == 1 |
2593 | +# self.action_intercompany(cr, SUPERUSER_ID, ids, |
2594 | +# node='draft', context=context) |
2595 | +# return True |
2596 | + |
2597 | +# def action_confirm(self, cr, uid, ids, context=None): |
2598 | +# """ |
2599 | +# Action confirm include intercompany action |
2600 | +# """ |
2601 | + |
2602 | +# res = super(stock_picking, self).action_confirm(cr, uid, ids, |
2603 | +# context=context) |
2604 | +# if res: |
2605 | +# self.action_intercompany(cr, uid, ids, node='confirm', |
2606 | +# context=context) |
2607 | +# return res |
2608 | + |
2609 | +# def action_cancel(self, cr, uid, ids, context=None): |
2610 | +# """ |
2611 | +# """ |
2612 | + |
2613 | +# res = super(stock_picking, self).action_cancel(cr, uid, ids, |
2614 | +# context=context) |
2615 | +# wkf_service = netsvc.LocalService("workflow") |
2616 | + |
2617 | +# if res: |
2618 | +# for pick_id in ids: |
2619 | +# ic_uid = self.get_intercompany(cr, uid, pick_id)[2] |
2620 | +# pick_ic_ids = self.search(cr, uid, |
2621 | +# [('picking_ic_id', '=', pick_id)] |
2622 | +# ) |
2623 | +# for pick_ic_id in pick_ic_ids: |
2624 | +# wkf_service.trg_validate(ic_uid, 'stock.picking', |
2625 | +# pick_ic_id, 'button_cancel', cr) |
2626 | + |
2627 | +# return res |
2628 | + |
2629 | +# def action_intercompany(self, cr, uid, ids, node=None, context=None): |
2630 | +# """ |
2631 | +# @node, draft or confirm |
2632 | +# """ |
2633 | + |
2634 | +# assert len(ids) == 1 |
2635 | +# cr.execute("SELECT type FROM stock_picking WHERE id=%s", (ids[0],)) |
2636 | +# pick_type = cr.fetchone()[0] |
2637 | + |
2638 | +# if pick_type in ['in', 'out']: |
2639 | +# o2o_field_name = pick_type == 'in' and 'is2do' or 'do2is' |
2640 | +# if self.need_to_create_intercompany_picking( |
2641 | +# cr, uid, ids, o2o_field_name, node=node, context=context): |
2642 | +# self.create_intercompany_picking( |
2643 | +# cr, uid, ids, self_type=pick_type, context=None) |
2644 | + |
2645 | +# def create_intercompany_picking(self, cr, uid, |
2646 | +# ids, self_type, context=None): |
2647 | +# """ |
2648 | +# prepare out and prepare in is similar, but don to merger it, |
2649 | +# @self_type, self.type |
2650 | +# """ |
2651 | + |
2652 | +# pick = self.browse(cr, uid, ids[0]) |
2653 | +# cf, ct, ic_uid = self.get_intercompany(cr, uid, ids[0], |
2654 | +# context=context) |
2655 | +# picking_pool = (self_type == 'in' |
2656 | +# and self.pool.get('stock.picking.out') |
2657 | +# or self.pool.get('stock.picking.in')) |
2658 | + |
2659 | +# if self_type == 'in': |
2660 | +# picking_data = self.prepare_intercompany_picking_out_data( |
2661 | +# cr, uid, pick, ct, ic_uid, context=context) |
2662 | +# elif self_type == 'out': |
2663 | +# picking_data = self.prepare_intercompany_picking_in_data( |
2664 | +# cr, uid, pick, ct, ic_uid, context=context) |
2665 | + |
2666 | +# return picking_pool.create(cr, ic_uid, picking_data, context=context) |
2667 | + |
2668 | +# def prepare_intercompany_picking_out_data( |
2669 | +# self, cr, uid, pick_in, company_to, ic_uid, context=None): |
2670 | +# """ |
2671 | +# prepare the picking.out data |
2672 | +# @pick_in browse record of stock.picking, type == in |
2673 | +# @company_to the company_id of this picking.out record |
2674 | +# """ |
2675 | + |
2676 | +# context = context or {} |
2677 | +# # context for to create stock.move, count the location |
2678 | +# context.update({'picking_type': 'out'}) |
2679 | +# part_pool = self.pool.get('res.partner') |
2680 | +# customer = part_pool.browse(cr, ic_uid, |
2681 | +# pick_in.company_id.partner_id.id) |
2682 | + |
2683 | +# location_id = False |
2684 | +# cr.execute(""" |
2685 | +# SELECT |
2686 | +# id |
2687 | +# FROM |
2688 | +# stock_location |
2689 | +# WHERE |
2690 | +# company_id=%s |
2691 | +# AND name='Stock' |
2692 | +# """, (company_to,)) |
2693 | +# location = cr.fetchone() |
2694 | +# if location and location[0]: |
2695 | +# location_id = location[0] |
2696 | +# location_dest_id = (customer.property_stock_customer |
2697 | +# and customer.property_stock_customer.id |
2698 | +# or False) |
2699 | + |
2700 | +# if (not location_dest_id or not location_id): |
2701 | +# raise osv.except_osv( |
2702 | +# _('Error!'), |
2703 | +# _("""prepare_intercompany_picking_out_data location%s |
2704 | +# location_dest%s""" |
2705 | +# % (location_id, location_dest_id))) |
2706 | + |
2707 | +# move_lines_data = [(5,)] |
2708 | +# for move_line in pick_in.move_lines: |
2709 | +# line_data = { |
2710 | +# #'picking_id': ic_id, |
2711 | +# 'name': move_line.name, |
2712 | +# 'product_qty': move_line.product_qty, |
2713 | +# 'product_id': move_line.product_id.id, |
2714 | +# 'product_uom': move_line.product_uom.id, |
2715 | +# 'price_unit': move_line.price_unit, |
2716 | +# 'price_currency_id': (move_line.price_currency_id |
2717 | +# and move_line.price_currency_id.id |
2718 | +# or False), |
2719 | +# 'location_id': location_id, |
2720 | +# 'location_dest_id': location_dest_id, |
2721 | +# 'company_id': company_to, |
2722 | +# } |
2723 | +# move_lines_data.append((0, 0, line_data)) |
2724 | + |
2725 | +# picking_data = { |
2726 | +# 'partner_id': customer.id, |
2727 | +# 'picking_ic_id': pick_in.id, |
2728 | +# 'is_locked': True, |
2729 | +# 'ic_create': True, |
2730 | +# 'company_id': company_to, |
2731 | +# 'type': 'out', |
2732 | +# 'origin': 'IC:' + pick_in.name, |
2733 | +# 'move_lines': move_lines_data, |
2734 | +# 'magento_bind_ids': False, |
2735 | +# 'related_backorder_ids': False, |
2736 | +# } |
2737 | +# return picking_data |
2738 | + |
2739 | +# def prepare_intercompany_picking_in_data( |
2740 | +# self, cr, uid, pick_out, company_to, ic_uid, context=None): |
2741 | +# """ |
2742 | +# prepare the picking.out data |
2743 | +# @pick_out browse record of stock.picking, type == in |
2744 | +# @company_to the company_id of this picking.out record |
2745 | +# """ |
2746 | +# context = context or {} |
2747 | +# #context for to create stock.move, count the location |
2748 | +# context.update({'picking_type': 'in'}) |
2749 | +# part_pool = self.pool.get('res.partner') |
2750 | +# supplier = part_pool.browse(cr, ic_uid, |
2751 | +# pick_out.company_id.partner_id.id) |
2752 | + |
2753 | +# location_id = (supplier.property_stock_supplier |
2754 | +# and supplier.property_stock_supplier.id |
2755 | +# or False) |
2756 | +# location_dest_id = False |
2757 | +# cr.execute(""" |
2758 | +# SELECT |
2759 | +# id |
2760 | +# FROM |
2761 | +# stock_location |
2762 | +# WHERE |
2763 | +# company_id=%s |
2764 | +# AND name='Stock' |
2765 | +# """, (company_to,)) |
2766 | +# location = cr.fetchone() |
2767 | +# if location and location[0]: |
2768 | +# location_dest_id = location[0] |
2769 | + |
2770 | +# if (not location_dest_id or not location_id): |
2771 | +# raise osv.except_osv( |
2772 | +# _('Error!'), |
2773 | +# _('''prepare_intercompany_picking_in_data |
2774 | +# location%s location_dest%s''' |
2775 | +# % (location_id, location_dest_id))) |
2776 | + |
2777 | +# move_lines_data = [(5,)] |
2778 | +# for move_line in pick_out.move_lines: |
2779 | +# line_data = { |
2780 | +# #'picking_id': ic_id, |
2781 | +# 'name': move_line.name, |
2782 | +# 'product_qty': move_line.product_qty, |
2783 | +# 'product_id': move_line.product_id.id, |
2784 | +# 'product_uom': move_line.product_uom.id, |
2785 | +# 'price_unit': move_line.price_unit, |
2786 | +# 'price_currency_id': (move_line.price_currency_id |
2787 | +# and move_line.price_currency_id.id |
2788 | +# or False), |
2789 | +# 'location_id': location_id, |
2790 | +# 'location_dest_id': location_dest_id, |
2791 | +# 'company_id': company_to, |
2792 | +# } |
2793 | +# move_lines_data.append((0, 0, line_data)) |
2794 | + |
2795 | +# picking_data = { |
2796 | +# 'partner_id': supplier.id, |
2797 | +# 'picking_ic_id': pick_out.id, |
2798 | +# 'is_locked': True, |
2799 | +# 'ic_create': True, |
2800 | +# 'company_id': company_to, |
2801 | +# 'type': 'in', |
2802 | +# 'origin': 'IC:' + pick_out.name, |
2803 | +# 'move_lines': move_lines_data, |
2804 | +# 'magento_bind_ids': False, |
2805 | +# 'related_backorder_ids': False, |
2806 | +# } |
2807 | +# return picking_data |
2808 | + |
2809 | +# stock_picking() |
2810 | + |
2811 | + |
2812 | +# class stock_picking_in(osv.osv): |
2813 | +# _inherit = 'stock.picking.in' |
2814 | +# _name = 'stock.picking.in' |
2815 | + |
2816 | +# _columns = { |
2817 | +# 'is_locked': fields.boolean('Locked for Intercompany'), |
2818 | +# 'ic_create': fields.boolean('Intercompany Picking generated'), |
2819 | +# 'picking_ic_id': fields.many2one('stock.picking', 'Stock Picking'), |
2820 | +# } |
2821 | + |
2822 | +# def get_intercompany(self, cr, uid, id, context=None): |
2823 | +# """ |
2824 | +# get company from and to |
2825 | +# """ |
2826 | + |
2827 | +# assert isinstance(id, int) or isinstance(id, long) |
2828 | +# cr.execute(""" |
2829 | +# SELECT |
2830 | +# pick.company_id AS from_c, cmp.id AS to_c,cmp.intercompany_uid |
2831 | +# FROM |
2832 | +# stock_picking AS pick |
2833 | +# LEFT JOIN res_partner AS part ON (pick.partner_id=part.id) |
2834 | +# LEFT JOIN res_company AS cmp ON (part.id=cmp.partner_id) |
2835 | +# WHERE pick.id=%s |
2836 | +# """, (id,)) |
2837 | +# return cr.fetchone() |
2838 | + |
2839 | +# #this function is same as the stock.picking function, |
2840 | +# #when modify this function of stock.picking , |
2841 | +# #copy and replace this. |
2842 | +# def prepare_IC_pick_out(self, cr, uid, pick_in, company_to, |
2843 | +# ic_uid, context=None): |
2844 | +# """ |
2845 | +# prepare the picking.out data |
2846 | +# @pick_in browse record of stock.picking, type == in |
2847 | +# @company_to the company_id of this picking.out record |
2848 | +# """ |
2849 | + |
2850 | +# context = context or {} |
2851 | +# # context for to create stock.move, count the location |
2852 | +# context.update({'picking_type': 'out'}) |
2853 | +# part_pool = self.pool.get('res.partner') |
2854 | +# customer = part_pool.browse(cr, ic_uid, |
2855 | +# pick_in.company_id.partner_id.id) |
2856 | +# location_id = False |
2857 | +# cr.execute(""" |
2858 | +# SELECT |
2859 | +# id |
2860 | +# FROM |
2861 | +# stock_location |
2862 | +# WHERE company_id=%s |
2863 | +# AND name='Stock' |
2864 | +# """, (company_to,)) |
2865 | + |
2866 | +# location = cr.fetchone() |
2867 | +# if location and location[0]: |
2868 | +# location_id = location[0] |
2869 | +# location_dest_id = (customer.property_stock_customer |
2870 | +# and customer.property_stock_customer.id |
2871 | +# or False) |
2872 | + |
2873 | +# if (not location_dest_id or not location_id): |
2874 | +# raise osv.except_osv( |
2875 | +# _('Error!'), |
2876 | +# _('''prepare_intercompany_picking_out_data |
2877 | +# location%s location_dest%s''' |
2878 | +# % (location_id, location_dest_id))) |
2879 | + |
2880 | +# move_lines_data = [(5,)] |
2881 | +# for move_line in pick_in.move_lines: |
2882 | +# line_data = { |
2883 | +# #'picking_id': ic_id, |
2884 | +# 'name': move_line.name, |
2885 | +# 'product_qty': move_line.product_qty, |
2886 | +# 'product_id': move_line.product_id.id, |
2887 | +# 'product_uom': move_line.product_uom.id, |
2888 | +# 'price_unit': move_line.price_unit, |
2889 | +# 'price_currency_id': (move_line.price_currency_id |
2890 | +# and move_line.price_currency_id.id |
2891 | +# or False), |
2892 | +# 'location_id': location_id, |
2893 | +# 'location_dest_id': location_dest_id, |
2894 | +# 'company_id': company_to, |
2895 | +# } |
2896 | +# move_lines_data.append((0, 0, line_data)) |
2897 | + |
2898 | +# picking_data = { |
2899 | +# 'partner_id': customer.id, |
2900 | +# 'picking_ic_id': pick_in.id, |
2901 | +# 'is_locked': True, |
2902 | +# 'ic_create': True, |
2903 | +# 'company_id': company_to, |
2904 | +# 'type': 'out', |
2905 | +# 'origin': 'IC:' + pick_in.name, |
2906 | +# 'move_lines': move_lines_data, |
2907 | +# 'magento_bind_ids': False, |
2908 | +# 'related_backorder_ids': False, |
2909 | +# } |
2910 | +# return picking_data |
2911 | + |
2912 | +# def write(self, cr, uid, ids, values, context=None, |
2913 | +# ban_update_out=False, ban_inverse_out=False): |
2914 | +# """ |
2915 | +# @need_update_out |
2916 | +# auto: according the IC set,return True or False |
2917 | +# True update_intercompany_picking_out |
2918 | +# False no update_intercompany_picking_out |
2919 | +# @need_inverse_out |
2920 | +# like need_update_out |
2921 | +# """ |
2922 | +# print """>>>>picking in write ids:%s ban_update_out%s, |
2923 | +# ban_inverse_out%s |
2924 | +# """ % (ids, ban_update_out, ban_inverse_out) |
2925 | +# if isinstance(ids, int) or isinstance(ids, long): |
2926 | +# ids = [ids] |
2927 | +# res = super(stock_picking_in, self).write(cr, uid, ids, |
2928 | +# values, context=context) |
2929 | + |
2930 | +# if res and not ban_update_out: |
2931 | +# self.update_IC_pick_out(cr, SUPERUSER_ID, ids, context=context) |
2932 | +# if res and not ban_inverse_out: |
2933 | +# self.inverse_IC_pick_out(cr, SUPERUSER_ID, ids, context=context) |
2934 | +# return res |
2935 | + |
2936 | +# def update_IC_pick_out(self, cr, uid, ids, context=None): |
2937 | +# """ |
2938 | +# """ |
2939 | +# out_pool = self.pool.get('stock.picking.out') |
2940 | +# ic_pool = self.pool.get('res.intercompany') |
2941 | + |
2942 | +# for pick_in in self.browse(cr, uid, ids, context): |
2943 | +# out_id = out_pool.search( |
2944 | +# cr, uid, [('picking_ic_id', '=', pick_in.id)]) |
2945 | +# if out_id: |
2946 | +# cf, ct, ic_uid = self.get_intercompany(cr, uid, pick_in.id, |
2947 | +# context=context) |
2948 | +# modify_mode = ic_pool.get_modify_model(cr, uid, cf, |
2949 | +# ct, 'is2do',) |
2950 | +# if modify_mode in ['regular', 'bidirectional']: |
2951 | +# p_out_data = self.prepare_IC_pick_out( |
2952 | +# cr, uid, pick_in, ct, ic_uid, context=context) |
2953 | +# out_pool.write(cr, ic_uid, out_id, |
2954 | +# p_out_data, ban_inverse_in=True) |
2955 | +# return True |
2956 | + |
2957 | +# def inverse_IC_pick_out(self, cr, uid, ids, context=None): |
2958 | +# """ |
2959 | +# """ |
2960 | +# pick_out_pool = self.pool.get('stock.picking.out') |
2961 | +# intercompany_pool = self.pool.get('res.intercompany') |
2962 | + |
2963 | +# for pick_in in self.browse(cr, uid, ids, context=context): |
2964 | +# pick_out = pick_in.picking_ic_id |
2965 | +# if pick_out: |
2966 | +# company_from, company_to = pick_out_pool.get_intercompany( |
2967 | +# cr, uid, pick_out.id)[0:2] |
2968 | +# modify_mode = intercompany_pool.get_modify_model( |
2969 | +# cr, uid, company_from, company_to, 'do2is',) |
2970 | +# if modify_mode in ['inverse', 'bidirectional']: |
2971 | + |
2972 | +# lines_data = [(5,)] |
2973 | +# #TODO, all location is the same ? |
2974 | +# #or how to make sure the location? |
2975 | +# location_id = pick_out.move_lines[0].location_id.id |
2976 | +# dest_id = pick_out.move_lines[0].location_dest_id.id |
2977 | + |
2978 | +# for in_line in pick_in.move_lines: |
2979 | +# data = (0, 0, { |
2980 | +# 'name': in_line.name, |
2981 | +# 'product_qty': in_line.product_qty, |
2982 | +# 'product_id': in_line.product_id.id, |
2983 | +# 'product_uom': in_line.product_uom.id, |
2984 | +# 'price_unit': in_line.price_unit, |
2985 | +# 'price_currency_id': ( |
2986 | +# in_line.price_currency_id |
2987 | +# and in_line.price_currency_id.id |
2988 | +# or False), |
2989 | +# 'location_id': location_id, |
2990 | +# 'location_dest_id': dest_id, |
2991 | +# 'company_id': pick_out.company_id.id, |
2992 | +# }) |
2993 | +# lines_data.append(data) |
2994 | + |
2995 | +# pick_out_pool.write(cr, uid, pick_out.id, |
2996 | +# {'move_lines': lines_data}, |
2997 | +# ban_update_in=True) |
2998 | +# return True |
2999 | + |
3000 | +# def unlink(self, cr, uid, ids, context=None): |
3001 | +# res = super(stock_picking_in, self).unlink(cr, uid, ids, |
3002 | +# context=context) |
3003 | +# if isinstance(ids, int) or isinstance(ids, long): |
3004 | +# ids = [ids] |
3005 | + |
3006 | +# pick_out_pool = self.pool.get('stock.picking.out') |
3007 | +# for pick_in_id in ids: |
3008 | +# pick_out_ids = pick_out_pool.search( |
3009 | +# cr, uid, |
3010 | +# [('picking_ic_id', '=', pick_in_id)], |
3011 | +# context=context) |
3012 | +# if pick_out_ids: |
3013 | +# pick_out_pool.unlink(cr, uid, pick_out_ids, context=context) |
3014 | +# return res |
3015 | + |
3016 | +# stock_picking_in() |
3017 | + |
3018 | + |
3019 | +# class stock_picking_out(osv.osv): |
3020 | +# _inherit = 'stock.picking.out' |
3021 | +# _name = 'stock.picking.out' |
3022 | + |
3023 | +# _columns = { |
3024 | +# 'is_locked': fields.boolean('Locked for Intercompany'), |
3025 | +# 'ic_create': fields.boolean('Intercompany Picking generated'), |
3026 | +# 'picking_ic_id': fields.many2one('stock.picking', 'Stock Picking'), |
3027 | +# } |
3028 | + |
3029 | +# def get_intercompany(self, cr, uid, id, context=None): |
3030 | +# """ |
3031 | +# get company from and to |
3032 | +# """ |
3033 | + |
3034 | +# assert isinstance(id, int) or isinstance(id, long) |
3035 | +# cr.execute(""" |
3036 | +# SELECT |
3037 | +# pick.company_id AS from_c, cmp.id AS to_c, cmp.intercompany_uid |
3038 | +# FROM stock_picking AS pick |
3039 | +# LEFT JOIN res_partner AS part ON (pick.partner_id=part.id) |
3040 | +# LEFT JOIN res_company AS cmp ON (part.id=cmp.partner_id) |
3041 | +# WHERE pick.id=%s |
3042 | +# """, (id,)) |
3043 | +# return cr.fetchone() |
3044 | + |
3045 | +# def write(self, cr, uid, ids, values, context=None, |
3046 | +# ban_update_in=False, ban_inverse_in=False): |
3047 | +# """ |
3048 | +# """ |
3049 | + |
3050 | +# res = super(stock_picking_out, self).write(cr, uid, ids, |
3051 | +# values, context=context) |
3052 | +# if isinstance(ids, int) or isinstance(ids, long): |
3053 | +# ids = [ids] |
3054 | +# if res and not ban_update_in: |
3055 | +# self.update_IC_pick_in(cr, SUPERUSER_ID, ids, context=context) |
3056 | +# if res and not ban_inverse_in: |
3057 | +# self.inverse_IC_pick_in(cr, SUPERUSER_ID, ids, context=context) |
3058 | + |
3059 | +# return res |
3060 | + |
3061 | +# def update_IC_pick_in(self, cr, uid, ids, context=None): |
3062 | +# pick_in_obj = self.pool.get('stock.picking.in') |
3063 | +# ic_pool = self.pool.get('res.intercompany') |
3064 | + |
3065 | +# for pick_out in self.browse(cr, uid, ids, context): |
3066 | +# pick_in_id = pick_in_obj.search( |
3067 | +# cr, uid, [('picking_ic_id', '=', pick_out.id)]) |
3068 | +# if pick_in_id: |
3069 | +# cf, ct, ic_uid = self.get_intercompany(cr, uid, pick_out.id, |
3070 | +# context=context) |
3071 | +# modify_mode = ic_pool.get_modify_model(cr, uid, cf, ct, |
3072 | +# 'do2is',) |
3073 | +# if modify_mode in ['regular', 'bidirectional']: |
3074 | +# p_in_data = self.prepare_intercompany_picking_in_data( |
3075 | +# cr, uid, pick_out, ct, ic_uid, context=context) |
3076 | +# pick_in_obj.write(cr, ic_uid, pick_in_id, p_in_data, |
3077 | +# ban_inverse_out=True) |
3078 | +# return True |
3079 | + |
3080 | +# def inverse_IC_pick_in(self, cr, uid, ids, context=None): |
3081 | +# """ |
3082 | +# """ |
3083 | + |
3084 | +# pick_in_pool = self.pool.get('stock.picking.in') |
3085 | +# intercompany_pool = self.pool.get('res.intercompany') |
3086 | + |
3087 | +# for pick_out in self.browse(cr, uid, ids, context=context): |
3088 | +# pick_in = pick_out.picking_ic_id |
3089 | +# if pick_in: |
3090 | +# cf, ct = pick_in_pool.get_intercompany(cr, uid, |
3091 | +# pick_in.id)[0:2] |
3092 | +# modify_mode = intercompany_pool.get_modify_model(cr, uid, cf, |
3093 | +# ct, 'is2do',) |
3094 | +# if modify_mode in ['inverse', 'bidirectional']: |
3095 | +# lines_data = [(5,)] |
3096 | +# #TODO, all location is the same ? |
3097 | +# #or how to make sure the location? |
3098 | +# location_id = pick_in.move_lines[0].location_id.id |
3099 | +# dest_id = pick_in.move_lines[0].location_dest_id.id |
3100 | + |
3101 | +# for out_line in pick_out.move_lines: |
3102 | +# data = (0, 0, { |
3103 | +# 'picking_id': pick_in.id, |
3104 | +# 'name': out_line.name, |
3105 | +# 'product_qty': out_line.product_qty, |
3106 | +# 'product_id': out_line.product_id.id, |
3107 | +# 'product_uom': out_line.product_uom.id, |
3108 | +# 'price_unit': out_line.price_unit, |
3109 | +# 'price_currency_id': ( |
3110 | +# out_line.price_currency_id |
3111 | +# and out_line.price_currency_id.id |
3112 | +# or False), |
3113 | +# 'location_id': location_id, |
3114 | +# 'location_dest_id': dest_id, |
3115 | +# 'company_id': pick_in.company_id.id, |
3116 | +# }) |
3117 | +# lines_data.append(data) |
3118 | +# #pick_in_uid = pick_in.create_uid or |
3119 | +# #pick_in.company_id.itercompany_uid |
3120 | +# pick_in_pool.write(cr, uid, pick_in.id, |
3121 | +# {'move_lines': lines_data}, |
3122 | +# ban_update_out=True) |
3123 | +# return True |
3124 | + |
3125 | +# def unlink(self, cr, uid, ids, context=None): |
3126 | +# res = super(stock_picking_out, self).unlink(cr, uid, ids, |
3127 | +# context=context) |
3128 | +# if isinstance(ids, int) or isinstance(ids, long): |
3129 | +# ids = [ids] |
3130 | + |
3131 | +# pick_in_pool = self.pool.get('stock.picking.in') |
3132 | +# for pick_out_id in ids: |
3133 | +# pick_in_ids = pick_in_pool.search( |
3134 | +# cr, uid, [('picking_ic_id', '=', pick_out_id)], |
3135 | +# context=context) |
3136 | +# if pick_in_ids: |
3137 | +# pick_in_pool.unlink(cr, uid, pick_in_ids, context=context) |
3138 | +# return res |
3139 | + |
3140 | +# #this function is same as stock.picking, |
3141 | +# #when modify that, copy and replace this |
3142 | +# def prepare_intercompany_picking_in_data( |
3143 | +# self, cr, uid, pick_out, company_to, ic_uid, context=None): |
3144 | +# """ |
3145 | +# prepare the picking.out data |
3146 | +# @pick_out browse record of stock.picking, type == in |
3147 | +# @company_to the company_id of this picking.out record |
3148 | +# """ |
3149 | + |
3150 | +# context = context or {} |
3151 | +# # context for to create stock.move, count the location |
3152 | +# context.update({'picking_type': 'in'}) |
3153 | +# part_pool = self.pool.get('res.partner') |
3154 | +# supplier_id = pick_out.company_id.partner_id.id |
3155 | +# supplier = part_pool.browse(cr, ic_uid, supplier_id) |
3156 | + |
3157 | +# location_id = (supplier.property_stock_supplier |
3158 | +# and supplier.property_stock_supplier.id |
3159 | +# or False) |
3160 | +# location_dest_id = False |
3161 | +# cr.execute(""" |
3162 | +# SELECT |
3163 | +# id |
3164 | +# FROM |
3165 | +# stock_location |
3166 | +# WHERE company_id=%s |
3167 | +# AND name='Stock' |
3168 | +# """, (company_to,)) |
3169 | +# location = cr.fetchone() |
3170 | +# if location and location[0]: |
3171 | +# location_dest_id = location[0] |
3172 | + |
3173 | +# if (not location_dest_id or not location_id): |
3174 | +# raise osv.except_osv( |
3175 | +# _('Error!'), |
3176 | +# _('''prepare_intercompany_picking_in_data |
3177 | +# location%s location_dest%s''' |
3178 | +# % (location_id, location_dest_id))) |
3179 | + |
3180 | +# move_lines_data = [(5,)] |
3181 | +# for move_line in pick_out.move_lines: |
3182 | +# line_data = { |
3183 | +# #'picking_id': ic_id, |
3184 | +# 'name': move_line.name, |
3185 | +# 'product_qty': move_line.product_qty, |
3186 | +# 'product_id': move_line.product_id.id, |
3187 | +# 'product_uom': move_line.product_uom.id, |
3188 | +# 'price_unit': move_line.price_unit, |
3189 | +# 'price_currency_id': (move_line.price_currency_id |
3190 | +# and move_line.price_currency_id.id |
3191 | +# or False), |
3192 | +# 'location_id': location_id, |
3193 | +# 'location_dest_id': location_dest_id, |
3194 | +# 'company_id': company_to, |
3195 | +# } |
3196 | +# move_lines_data.append((0, 0, line_data)) |
3197 | + |
3198 | +# picking_data = { |
3199 | +# 'partner_id': supplier.id, |
3200 | +# 'picking_ic_id': pick_out.id, |
3201 | +# 'is_locked': True, |
3202 | +# 'ic_create': True, |
3203 | +# 'company_id': company_to, |
3204 | +# 'type': 'in', |
3205 | +# 'origin': 'IC:' + pick_out.name, |
3206 | +# 'move_lines': move_lines_data, |
3207 | +# 'magento_bind_ids': False, |
3208 | +# 'related_backorder_ids': False, |
3209 | +# } |
3210 | +# return picking_data |
3211 | + |
3212 | +# stock_picking_out() |
3213 | + |
3214 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3215 | |
3216 | === added file 'base_intercompany/stock_picking_wkf.xml' |
3217 | --- base_intercompany/stock_picking_wkf.xml 1970-01-01 00:00:00 +0000 |
3218 | +++ base_intercompany/stock_picking_wkf.xml 2013-12-30 03:21:22 +0000 |
3219 | @@ -0,0 +1,9 @@ |
3220 | +<?xml version="1.0" encoding="UTF-8"?> |
3221 | +<openerp> |
3222 | + <data> |
3223 | + <record id="stock.act_draft" model="workflow.activity"> |
3224 | + <field name="kind">function</field> |
3225 | + <field name="action">action_draft()</field> |
3226 | + </record> |
3227 | + </data> |
3228 | +</openerp> |
3229 | \ No newline at end of file |
3230 | |
3231 | === added directory 'base_intercompany/tests' |
3232 | === added file 'base_intercompany/tests/__init__.py' |
3233 | --- base_intercompany/tests/__init__.py 1970-01-01 00:00:00 +0000 |
3234 | +++ base_intercompany/tests/__init__.py 2013-12-30 03:21:22 +0000 |
3235 | @@ -0,0 +1,8 @@ |
3236 | +import test_sale |
3237 | + |
3238 | +fast_suite = [ |
3239 | +] |
3240 | + |
3241 | +checks = [ |
3242 | + # test_sale |
3243 | +] |
3244 | |
3245 | === added file 'base_intercompany/tests/test_sale.py' |
3246 | --- base_intercompany/tests/test_sale.py 1970-01-01 00:00:00 +0000 |
3247 | +++ base_intercompany/tests/test_sale.py 2013-12-30 03:21:22 +0000 |
3248 | @@ -0,0 +1,559 @@ |
3249 | +import mock |
3250 | +import unittest2 |
3251 | +from datetime import datetime, timedelta |
3252 | + |
3253 | +import openerp |
3254 | +import openerp.tests.common as common |
3255 | +from openerp.osv import osv |
3256 | + |
3257 | +DB = common.DB |
3258 | +ADMIN_USER_ID = common.ADMIN_USER_ID |
3259 | + |
3260 | + |
3261 | +class test_icops_sale(common.TransactionCase): |
3262 | + |
3263 | + def setUp(self): |
3264 | + super(test_icops_sale, self).setUp() |
3265 | + # get super user |
3266 | + self.m = self.registry('ir.model.data') |
3267 | + self.user_pool = self.registry('res.users') |
3268 | + self.super_user = self.user_pool.browse(self.cr, self.uid, self.uid) |
3269 | + # creates companies |
3270 | + self.company_1 = self.m.get_object( |
3271 | + self.cr, self.uid, 'base', 'main_company') |
3272 | + |
3273 | + self.company_2 = self.m.get_object( |
3274 | + self.cr, self.uid, 'multi_company', 'res_company_oerp_be') |
3275 | + |
3276 | + self.user_1 = self.m.get_object( |
3277 | + self.cr, self.uid, 'base_intercompany', 'user_icops1') |
3278 | + |
3279 | + self.user_2 = self.m.get_object( |
3280 | + self.cr, self.uid, 'base_intercompany', 'user_icops2') |
3281 | + |
3282 | + self.shop_1 = self.m.get_object( |
3283 | + self.cr, self.uid, 'base_intercompany', |
3284 | + 'sale_shop_icops_1') |
3285 | + |
3286 | + self.shop_2 = self.m.get_object( |
3287 | + self.cr, self.uid, 'base_intercompany', |
3288 | + 'sale_shop_icops_2') |
3289 | + |
3290 | + company_pool = self.registry('res.company') |
3291 | + company_pool.write( |
3292 | + self.cr, self.uid, self.company_1.id, |
3293 | + {'intercompany_uid': self.user_1.id, |
3294 | + 'intercompany_shop_id': self.shop_1.id}) |
3295 | + |
3296 | + company_pool.write( |
3297 | + self.cr, self.uid, self.company_2.id, |
3298 | + {'intercompany_uid': self.user_2.id, |
3299 | + 'intercompany_shop_id': self.shop_2.id}) |
3300 | + |
3301 | + self.icops_pool = self.registry('res.intercompany') |
3302 | + self.so_pool = self.registry('sale.order') |
3303 | + self.po_pool = self.registry('purchase.order') |
3304 | + |
3305 | + def test_01_so_creates_po(self): |
3306 | + |
3307 | + self.icops_pool.create( |
3308 | + self.cr, self.uid, |
3309 | + {'company_from': self.company_1.id, |
3310 | + 'company_to': self.company_2.id, |
3311 | + 'obj2obj': 'so2po', |
3312 | + 'status': 'draft', |
3313 | + 'direction': 'regular'}) |
3314 | + sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3315 | + 'partner_id': self.company_2.partner_id.id, |
3316 | + 'partner_invoice_id': self.company_2.partner_id.id, |
3317 | + 'partner_shipping_id': self.company_2.partner_id.id, |
3318 | + 'shop_id': self.shop_1.id, |
3319 | + 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3320 | + 'pricelist_id': self.user_1.property_product_pricelist.id |
3321 | + }) |
3322 | + so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3323 | + self.assertTrue(so.purchase_id.id) |
3324 | + po = self.po_pool.browse(self.cr, self.uid, so.purchase_id.id) |
3325 | + self.assertIsNotNone(po.id) |
3326 | + self.assertEqual(so.purchase_id.id, po.id) |
3327 | + self.assertEqual(po.sale_id.id, so.id) |
3328 | + |
3329 | + def test_02_creates_normal_so(self): |
3330 | + |
3331 | + self.icops_pool.create( |
3332 | + self.cr, self.uid, |
3333 | + {'company_from': self.company_1.id, |
3334 | + 'company_to': self.company_2.id, |
3335 | + 'obj2obj': 'so2po', |
3336 | + 'status': 'draft', |
3337 | + 'direction': 'regular'}) |
3338 | + sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3339 | + 'partner_id': self.company_1.partner_id.id, |
3340 | + 'partner_invoice_id': self.company_1.partner_id.id, |
3341 | + 'partner_shipping_id': self.company_1.partner_id.id, |
3342 | + 'shop_id': self.shop_1.id, |
3343 | + 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3344 | + 'pricelist_id': self.user_1.property_product_pricelist.id |
3345 | + }) |
3346 | + so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3347 | + |
3348 | + self.assertFalse(so.purchase_id.id) |
3349 | + |
3350 | + def test_03_so_creates_po_updates_so_line_regular(self): |
3351 | + product = self.m.get_object( |
3352 | + self.cr, self.uid, 'product', 'product_product_1') |
3353 | + self.icops_pool.create( |
3354 | + self.cr, self.uid, |
3355 | + {'company_from': self.company_1.id, |
3356 | + 'company_to': self.company_2.id, |
3357 | + 'obj2obj': 'so2po', |
3358 | + 'status': 'draft', |
3359 | + 'direction': 'regular'}) |
3360 | + sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3361 | + 'partner_id': self.company_2.partner_id.id, |
3362 | + 'partner_invoice_id': self.company_2.partner_id.id, |
3363 | + 'partner_shipping_id': self.company_2.partner_id.id, |
3364 | + 'shop_id': self.shop_1.id, |
3365 | + 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3366 | + 'pricelist_id': self.user_1.property_product_pricelist.id |
3367 | + }) |
3368 | + so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3369 | + |
3370 | + po = so.purchase_id |
3371 | + self.assertEqual(so.order_line, po.order_line) |
3372 | + sol = [(0, False, { |
3373 | + 'product_uos_qty': 1, 'product_id': product.id, |
3374 | + 'product_uom': 1, 'price_unit': 885, |
3375 | + 'product_uom_qty': 1, 'th_weight': 0, 'product_uos': False, |
3376 | + 'tax_id': [[6, False, []]], |
3377 | + 'name': product.name})] |
3378 | + self.so_pool.write( |
3379 | + self.cr, self.user_1.id, so.id, {'order_line': sol}) |
3380 | + so = self.so_pool.browse( |
3381 | + self.cr, self.user_1.id, so.id) |
3382 | + |
3383 | + self.assertEqual(len(so.order_line), 1) |
3384 | + |
3385 | + po = self.po_pool.browse( |
3386 | + self.cr, self.user_2.id, po.id) |
3387 | + self.assertEqual( |
3388 | + so.order_line[0].product_id, po.order_line[0].product_id) |
3389 | + self.assertEqual( |
3390 | + so.order_line[0].product_uom_qty, po.order_line[0].product_qty) |
3391 | + |
3392 | + def test_04_so_creates_po_updates_so_line_inverse(self): |
3393 | + product = self.m.get_object( |
3394 | + self.cr, self.uid, 'product', 'product_product_1') |
3395 | + self.icops_pool.create( |
3396 | + self.cr, self.uid, |
3397 | + {'company_from': self.company_1.id, |
3398 | + 'company_to': self.company_2.id, |
3399 | + 'obj2obj': 'so2po', |
3400 | + 'status': 'draft', |
3401 | + 'direction': 'inverse'}) |
3402 | + sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3403 | + 'partner_id': self.company_2.partner_id.id, |
3404 | + 'partner_invoice_id': self.company_2.partner_id.id, |
3405 | + 'partner_shipping_id': self.company_2.partner_id.id, |
3406 | + 'shop_id': self.shop_1.id, |
3407 | + 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3408 | + 'pricelist_id': self.user_1.property_product_pricelist.id |
3409 | + }) |
3410 | + so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3411 | + |
3412 | + po = so.purchase_id |
3413 | + self.assertEqual(so.order_line, po.order_line) |
3414 | + sol = [(0, False, { |
3415 | + 'product_uos_qty': 1, 'product_id': product.id, |
3416 | + 'product_uom': 1, 'price_unit': 885, |
3417 | + 'product_uom_qty': 1, 'th_weight': 0, 'product_uos': False, |
3418 | + 'tax_id': [[6, False, []]], |
3419 | + 'name': product.name})] |
3420 | + |
3421 | + self.assertEqual(len(so.order_line), 0) |
3422 | + a = None |
3423 | + with self.assertRaises(osv.except_osv): |
3424 | + a = self.so_pool.write( |
3425 | + self.cr, self.user_1.id, so.id, {'order_line': sol}) |
3426 | + |
3427 | + so = self.so_pool.browse( |
3428 | + self.cr, self.user_1.id, so.id) |
3429 | + |
3430 | + self.assertEqual(len(so.order_line), 0) |
3431 | + |
3432 | + pol = [(0, False, { |
3433 | + 'product_id': product.id, |
3434 | + 'name': product.name, |
3435 | + 'date_planned': '10/20/2013', |
3436 | + 'product_qty': 1, |
3437 | + 'price_unit': 885, |
3438 | + 'product_uom': 1, |
3439 | + 'tax_id': [[6, False, []]] |
3440 | + })] |
3441 | + self.po_pool.write( |
3442 | + self.cr, self.user_2.id, po.id, {'order_line': pol}) |
3443 | + |
3444 | + so = self.so_pool.browse( |
3445 | + self.cr, self.user_1.id, so.id) |
3446 | + |
3447 | + self.assertEqual(len(so.order_line), 1) |
3448 | + |
3449 | + po = self.po_pool.browse( |
3450 | + self.cr, self.user_2.id, po.id) |
3451 | + self.assertEqual( |
3452 | + so.order_line[0].product_id, po.order_line[0].product_id) |
3453 | + self.assertEqual( |
3454 | + so.order_line[0].product_uom_qty, po.order_line[0].product_qty) |
3455 | + |
3456 | + # def test_05_so_creates_po_updates_so_line_bidirectional(self): |
3457 | + # product = self.m.get_object( |
3458 | + # self.cr, self.uid, 'product', 'product_product_1') |
3459 | + # self.icops_pool.create( |
3460 | + # self.cr, self.uid, |
3461 | + # {'company_from': self.company_1.id, |
3462 | + # 'company_to': self.company_2.id, |
3463 | + # 'obj2obj': 'so2po', |
3464 | + # 'status': 'draft', |
3465 | + # 'direction': 'bidirectional'}) |
3466 | + # sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3467 | + # 'partner_id': self.company_2.partner_id.id, |
3468 | + # 'partner_invoice_id': self.company_2.partner_id.id, |
3469 | + # 'partner_shipping_id': self.company_2.partner_id.id, |
3470 | + # 'shop_id': self.shop_1.id, |
3471 | + # 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3472 | + # 'pricelist_id': self.user_1.property_product_pricelist.id |
3473 | + # }) |
3474 | + # so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3475 | + |
3476 | + # po = so.purchase_id |
3477 | + # self.assertEqual(so.order_line, po.order_line) |
3478 | + # sol = [(0, False, { |
3479 | + # 'product_uos_qty': 1, 'product_id': product.id, |
3480 | + # 'product_uom': 1, 'price_unit': 885, |
3481 | + # 'product_uom_qty': 1, 'th_weight': 0, 'product_uos': False, |
3482 | + # 'tax_id': [[6, False, []]], |
3483 | + # 'name': product.name})] |
3484 | + # self.so_pool.write( |
3485 | + # self.cr, self.user_1.id, so.id, {'order_line': sol}) |
3486 | + # so = self.so_pool.browse( |
3487 | + # self.cr, self.user_1.id, so.id) |
3488 | + |
3489 | + # self.assertEqual(len(so.order_line), 1) |
3490 | + |
3491 | + # po = self.po_pool.browse( |
3492 | + # self.cr, self.user_2.id, po.id) |
3493 | + |
3494 | + # self.assertEqual( |
3495 | + # so.order_line[0].product_id, po.order_line[0].product_id) |
3496 | + # self.assertEqual( |
3497 | + # so.order_line[0].product_uom_qty, po.order_line[0].product_qty) |
3498 | + |
3499 | + # self.assertEqual(po.order_line[0].product_qty, 1) |
3500 | + # pol = [(1, po.order_line[0].id, { |
3501 | + # 'product_qty': 2, |
3502 | + # })] |
3503 | + # self.po_pool.write( |
3504 | + # self.cr, self.user_2.id, po.id, {'order_line': pol}) |
3505 | + |
3506 | + # so = self.so_pool.browse( |
3507 | + # self.cr, self.user_1.id, so.id) |
3508 | + |
3509 | + # self.assertEqual(len(so.order_line), 1) |
3510 | + |
3511 | + # po = self.po_pool.browse( |
3512 | + # self.cr, self.user_2.id, po.id) |
3513 | + # self.assertEqual( |
3514 | + # so.order_line[0].product_id, po.order_line[0].product_id) |
3515 | + # self.assertEqual( |
3516 | + # so.order_line[0].product_uom_qty, po.order_line[0].product_qty) |
3517 | + # self.assertEqual(so.order_line[0].product_uom_qty, 2) |
3518 | + |
3519 | + # def test_06_delete_so(self): |
3520 | + |
3521 | + # sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3522 | + # 'partner_id': self.company_2.partner_id.id, |
3523 | + # 'partner_invoice_id': self.company_2.partner_id.id, |
3524 | + # 'partner_shipping_id': self.company_2.partner_id.id, |
3525 | + # 'shop_id': self.shop_1.id, |
3526 | + # 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3527 | + # 'pricelist_id': self.user_1.property_product_pricelist.id |
3528 | + # }) |
3529 | + # result = self.so_pool.unlink(self.cr, self.user_1.id, sale_id) |
3530 | + # self.assertTrue(result) |
3531 | + |
3532 | + def test_07_so_deletes_po(self): |
3533 | + |
3534 | + self.icops_pool.create( |
3535 | + self.cr, self.uid, |
3536 | + {'company_from': self.company_1.id, |
3537 | + 'company_to': self.company_2.id, |
3538 | + 'obj2obj': 'so2po', |
3539 | + 'status': 'draft', |
3540 | + 'direction': 'regular'}) |
3541 | + |
3542 | + self.icops_pool.create( |
3543 | + self.cr, self.uid, |
3544 | + {'company_from': self.company_1.id, |
3545 | + 'company_to': self.company_2.id, |
3546 | + 'obj2obj': 'so2po', |
3547 | + 'status': 'unlink', |
3548 | + 'direction': 'regular'}) |
3549 | + |
3550 | + sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3551 | + 'partner_id': self.company_2.partner_id.id, |
3552 | + 'partner_invoice_id': self.company_2.partner_id.id, |
3553 | + 'partner_shipping_id': self.company_2.partner_id.id, |
3554 | + 'shop_id': self.shop_1.id, |
3555 | + 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3556 | + 'pricelist_id': self.user_1.property_product_pricelist.id |
3557 | + }) |
3558 | + so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3559 | + |
3560 | + po_ids = self.po_pool.search( |
3561 | + self.cr, self.uid, [('sale_id', '=', so.id)]) |
3562 | + |
3563 | + self.assertEqual(len(po_ids), 1) |
3564 | + |
3565 | + self.so_pool.unlink( |
3566 | + self.cr, self.user_1.id, so.id) |
3567 | + |
3568 | + po_ids = self.po_pool.search( |
3569 | + self.cr, self.user_2.id, [('sale_id', '=', so.id)]) |
3570 | + self.assertEqual(len(po_ids), 0) |
3571 | + |
3572 | + def test_07_so_deletes_po_inverse(self): |
3573 | + |
3574 | + self.icops_pool.create( |
3575 | + self.cr, self.uid, |
3576 | + {'company_from': self.company_1.id, |
3577 | + 'company_to': self.company_2.id, |
3578 | + 'obj2obj': 'so2po', |
3579 | + 'status': 'draft', |
3580 | + 'direction': 'regular'}) |
3581 | + |
3582 | + self.icops_pool.create( |
3583 | + self.cr, self.uid, |
3584 | + {'company_from': self.company_1.id, |
3585 | + 'company_to': self.company_2.id, |
3586 | + 'obj2obj': 'so2po', |
3587 | + 'status': 'unlink', |
3588 | + 'direction': 'inverse'}) |
3589 | + |
3590 | + sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3591 | + 'partner_id': self.company_2.partner_id.id, |
3592 | + 'partner_invoice_id': self.company_2.partner_id.id, |
3593 | + 'partner_shipping_id': self.company_2.partner_id.id, |
3594 | + 'shop_id': self.shop_1.id, |
3595 | + 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3596 | + 'pricelist_id': self.user_1.property_product_pricelist.id |
3597 | + }) |
3598 | + so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3599 | + |
3600 | + po_ids = self.po_pool.search( |
3601 | + self.cr, self.user_2.id, [('sale_id', '=', so.id)]) |
3602 | + |
3603 | + self.assertEqual(len(po_ids), 1) |
3604 | + |
3605 | + so_ids = self.so_pool.search( |
3606 | + self.cr, self.user_1.id, [('purchase_id', '=', so.purchase_id.id)]) |
3607 | + |
3608 | + self.assertEqual(len(po_ids), 1) |
3609 | + |
3610 | + # with self.assertRaises(osv.except_osv): |
3611 | + # self.so_pool.unlink( |
3612 | + # self.cr, self.user_1.id, so.id) |
3613 | + |
3614 | + # so_ids = self.so_pool.search( |
3615 | + # self.cr, self.user_1.id, [('purchase_id', '=', so.purchase_id.id)]) |
3616 | + |
3617 | + # self.assertEqual(len(po_ids), 1) |
3618 | + |
3619 | + self.po_pool.unlink( |
3620 | + self.cr, self.user_2.id, so.purchase_id.id) |
3621 | + |
3622 | + so_ids = self.so_pool.search( |
3623 | + self.cr, self.user_1.id, [('purchase_id', '=', so.purchase_id.id)]) |
3624 | + |
3625 | + self.assertEqual(len(so_ids), 0) |
3626 | + |
3627 | + # def test_08_so_deletes_po_bidirectional_1(self): |
3628 | + |
3629 | + # self.icops_pool.create( |
3630 | + # self.cr, self.uid, |
3631 | + # {'company_from': self.company_1.id, |
3632 | + # 'company_to': self.company_2.id, |
3633 | + # 'obj2obj': 'so2po', |
3634 | + # 'status': 'draft', |
3635 | + # 'direction': 'regular'}) |
3636 | + |
3637 | + # self.icops_pool.create( |
3638 | + # self.cr, self.uid, |
3639 | + # {'company_from': self.company_1.id, |
3640 | + # 'company_to': self.company_2.id, |
3641 | + # 'obj2obj': 'so2po', |
3642 | + # 'status': 'unlink', |
3643 | + # 'direction': 'bidirectional'}) |
3644 | + |
3645 | + # sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3646 | + # 'partner_id': self.company_2.partner_id.id, |
3647 | + # 'partner_invoice_id': self.company_2.partner_id.id, |
3648 | + # 'partner_shipping_id': self.company_2.partner_id.id, |
3649 | + # 'shop_id': self.shop_1.id, |
3650 | + # 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3651 | + # 'pricelist_id': self.user_1.property_product_pricelist.id |
3652 | + # }) |
3653 | + # so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3654 | + |
3655 | + # po_ids = self.po_pool.search( |
3656 | + # self.cr, self.uid, [('sale_id', '=', so.id)]) |
3657 | + |
3658 | + # self.assertEqual(len(po_ids), 1) |
3659 | + |
3660 | + # self.so_pool.unlink( |
3661 | + # self.cr, self.user_1.id, so.id) |
3662 | + |
3663 | + # po_ids = self.po_pool.search( |
3664 | + # self.cr, self.user_2.id, [('sale_id', '=', so.id)]) |
3665 | + # self.assertEqual(len(po_ids), 0) |
3666 | + |
3667 | + # def test_09_so_deletes_po_bidirectional_2(self): |
3668 | + |
3669 | + # self.icops_pool.create( |
3670 | + # self.cr, self.uid, |
3671 | + # {'company_from': self.company_1.id, |
3672 | + # 'company_to': self.company_2.id, |
3673 | + # 'obj2obj': 'so2po', |
3674 | + # 'status': 'draft', |
3675 | + # 'direction': 'regular'}) |
3676 | + |
3677 | + # self.icops_pool.create( |
3678 | + # self.cr, self.uid, |
3679 | + # {'company_from': self.company_1.id, |
3680 | + # 'company_to': self.company_2.id, |
3681 | + # 'obj2obj': 'so2po', |
3682 | + # 'status': 'unlink', |
3683 | + # 'direction': 'bidirectional'}) |
3684 | + |
3685 | + # sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3686 | + # 'partner_id': self.company_2.partner_id.id, |
3687 | + # 'partner_invoice_id': self.company_2.partner_id.id, |
3688 | + # 'partner_shipping_id': self.company_2.partner_id.id, |
3689 | + # 'shop_id': self.shop_1.id, |
3690 | + # 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3691 | + # 'pricelist_id': self.user_1.property_product_pricelist.id |
3692 | + # }) |
3693 | + # so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3694 | + |
3695 | + # po_ids = self.po_pool.search( |
3696 | + # self.cr, self.uid, [('sale_id', '=', so.id)]) |
3697 | + |
3698 | + # self.assertEqual(len(po_ids), 1) |
3699 | + |
3700 | + # self.po_pool.unlink( |
3701 | + # self.cr, self.user_2.id, so.purchase_id.id) |
3702 | + |
3703 | + # so_ids = self.so_pool.search( |
3704 | + # self.cr, self.user_1.id, [('purchase_id', '=', so.purchase_id.id)]) |
3705 | + # self.assertEqual(len(so_ids), 0) |
3706 | + |
3707 | + # def test_100_so_creates_po_double_setup(self): |
3708 | + # product = self.m.get_object( |
3709 | + # self.cr, self.uid, 'product', 'product_product_1') |
3710 | + # self.icops_pool.create( |
3711 | + # self.cr, self.uid, |
3712 | + # {'company_from': self.company_1.id, |
3713 | + # 'company_to': self.company_2.id, |
3714 | + # 'obj2obj': 'so2po', |
3715 | + # 'status': 'draft', |
3716 | + # 'direction': 'bidirectional'}) |
3717 | + |
3718 | + # self.icops_pool.create( |
3719 | + # self.cr, self.uid, |
3720 | + # {'company_from': self.company_2.id, |
3721 | + # 'company_to': self.company_1.id, |
3722 | + # 'obj2obj': 'po2so', |
3723 | + # 'status': 'draft', |
3724 | + # 'direction': 'bidirectional'}) |
3725 | + |
3726 | + # sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3727 | + # 'partner_id': self.company_2.partner_id.id, |
3728 | + # 'partner_invoice_id': self.company_2.partner_id.id, |
3729 | + # 'partner_shipping_id': self.company_2.partner_id.id, |
3730 | + # 'shop_id': self.shop_1.id, |
3731 | + # 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3732 | + # 'pricelist_id': self.user_1.property_product_pricelist.id |
3733 | + # }) |
3734 | + # so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3735 | + |
3736 | + # po = so.purchase_id |
3737 | + # self.assertEqual(so.order_line, po.order_line) |
3738 | + # sol = [(0, False, { |
3739 | + # 'product_uos_qty': 1, 'product_id': product.id, |
3740 | + # 'product_uom': 1, 'price_unit': 885, |
3741 | + # 'product_uom_qty': 1, 'th_weight': 0, 'product_uos': False, |
3742 | + # 'tax_id': [[6, False, []]], |
3743 | + # 'name': product.name})] |
3744 | + # self.so_pool.write( |
3745 | + # self.cr, self.user_1.id, so.id, {'order_line': sol}) |
3746 | + # so = self.so_pool.browse( |
3747 | + # self.cr, self.user_1.id, so.id) |
3748 | + |
3749 | + # self.assertEqual(len(so.order_line), 1) |
3750 | + |
3751 | + # po = self.po_pool.browse( |
3752 | + # self.cr, self.user_2.id, po.id) |
3753 | + # self.assertEqual( |
3754 | + # so.order_line[0].product_id, po.order_line[0].product_id) |
3755 | + # self.assertEqual( |
3756 | + # so.order_line[0].product_uom_qty, po.order_line[0].product_qty) |
3757 | + |
3758 | + # def test_101_so_creates_po_double_setup_inverse(self): |
3759 | + # product = self.m.get_object( |
3760 | + # self.cr, self.uid, 'product', 'product_product_1') |
3761 | + # self.icops_pool.create( |
3762 | + # self.cr, self.uid, |
3763 | + # {'company_from': self.company_1.id, |
3764 | + # 'company_to': self.company_2.id, |
3765 | + # 'obj2obj': 'so2po', |
3766 | + # 'status': 'draft', |
3767 | + # 'direction': 'inverse'}) |
3768 | + |
3769 | + # self.icops_pool.create( |
3770 | + # self.cr, self.uid, |
3771 | + # {'company_from': self.company_2.id, |
3772 | + # 'company_to': self.company_1.id, |
3773 | + # 'obj2obj': 'po2so', |
3774 | + # 'status': 'draft', |
3775 | + # 'direction': 'inverse'}) |
3776 | + |
3777 | + # sale_id = self.so_pool.create(self.cr, self.user_1.id, { |
3778 | + # 'partner_id': self.company_2.partner_id.id, |
3779 | + # 'partner_invoice_id': self.company_2.partner_id.id, |
3780 | + # 'partner_shipping_id': self.company_2.partner_id.id, |
3781 | + # 'shop_id': self.shop_1.id, |
3782 | + # 'date_order': datetime.now().strftime('%Y-%m-%d'), |
3783 | + # 'pricelist_id': self.user_1.property_product_pricelist.id |
3784 | + # }) |
3785 | + # so = self.so_pool.browse(self.cr, self.user_1.id, sale_id) |
3786 | + |
3787 | + # po = so.purchase_id |
3788 | + # self.assertEqual(so.order_line, po.order_line) |
3789 | + # sol = [(0, False, { |
3790 | + # 'product_uos_qty': 1, 'product_id': product.id, |
3791 | + # 'product_uom': 1, 'price_unit': 885, |
3792 | + # 'product_uom_qty': 1, 'th_weight': 0, 'product_uos': False, |
3793 | + # 'tax_id': [[6, False, []]], |
3794 | + # 'name': product.name})] |
3795 | + # self.so_pool.write( |
3796 | + # self.cr, self.user_1.id, so.id, {'order_line': sol}) |
3797 | + # so = self.so_pool.browse( |
3798 | + # self.cr, self.user_1.id, so.id) |
3799 | + |
3800 | + # self.assertEqual(len(so.order_line), 1) |
3801 | + |
3802 | + # po = self.po_pool.browse( |
3803 | + # self.cr, self.user_2.id, po.id) |
3804 | + # self.assertEqual( |
3805 | + # so.order_line[0].product_id, po.order_line[0].product_id) |
3806 | + # self.assertEqual( |
3807 | + # so.order_line[0].product_uom_qty, po.order_line[0].product_qty) |
3808 | |
3809 | === added directory 'delivery_plan' |
3810 | === added file 'delivery_plan/__init__.py' |
3811 | --- delivery_plan/__init__.py 1970-01-01 00:00:00 +0000 |
3812 | +++ delivery_plan/__init__.py 2013-12-30 03:21:22 +0000 |
3813 | @@ -0,0 +1,27 @@ |
3814 | +# -*- coding: utf-8 -*- |
3815 | +############################################################################## |
3816 | +# |
3817 | +# OpenERP, Open Source Management Solution |
3818 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
3819 | +# Author: Yannick Gouin <yannick.gouin@elico-corp.com> |
3820 | +# |
3821 | +# This program is free software: you can redistribute it and/or modify |
3822 | +# it under the terms of the GNU Affero General Public License as |
3823 | +# published by the Free Software Foundation, either version 3 of the |
3824 | +# License, or (at your option) any later version. |
3825 | +# |
3826 | +# This program is distributed in the hope that it will be useful, |
3827 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3828 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3829 | +# GNU Affero General Public License for more details. |
3830 | +# |
3831 | +# You should have received a copy of the GNU Affero General Public License |
3832 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3833 | +# |
3834 | +############################################################################## |
3835 | + |
3836 | +import sale |
3837 | +import wizard |
3838 | +import partner |
3839 | + |
3840 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3841 | |
3842 | === added file 'delivery_plan/__openerp__.py' |
3843 | --- delivery_plan/__openerp__.py 1970-01-01 00:00:00 +0000 |
3844 | +++ delivery_plan/__openerp__.py 2013-12-30 03:21:22 +0000 |
3845 | @@ -0,0 +1,58 @@ |
3846 | +# -*- coding: utf-8 -*- |
3847 | +############################################################################## |
3848 | +# |
3849 | +# OpenERP, Open Source Management Solution |
3850 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
3851 | +# Author: Yannick Gouin <yannick.gouin@elico-corp.com> |
3852 | +# |
3853 | +# This program is free software: you can redistribute it and/or modify |
3854 | +# it under the terms of the GNU Affero General Public License as |
3855 | +# published by the Free Software Foundation, either version 3 of the |
3856 | +# License, or (at your option) any later version. |
3857 | +# |
3858 | +# This program is distributed in the hope that it will be useful, |
3859 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
3860 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3861 | +# GNU Affero General Public License for more details. |
3862 | +# |
3863 | +# You should have received a copy of the GNU Affero General Public License |
3864 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
3865 | +# |
3866 | +############################################################################## |
3867 | + |
3868 | +{ |
3869 | + 'name': 'Delivery Time Plan', |
3870 | + 'version': '1', |
3871 | + 'category': 'Delivery', |
3872 | + 'sequence': 19, |
3873 | + 'summary': 'Plan delivery time for sale order', |
3874 | + 'description': """ |
3875 | +Delivery Time Plan |
3876 | +================================= |
3877 | +* Plan delivery time for sale order |
3878 | +* Add delivery return reason, |
3879 | +* Calculate sale order dts, pts based on order start_date, enddate, |
3880 | +* Compute dts,pts of delivery order based on start_date and end date of sale order, delivery zone of partner. |
3881 | + """, |
3882 | + 'author': 'Elico Corp', |
3883 | + 'website': 'http://www.elico-corp.com', |
3884 | + 'images' : [], |
3885 | + 'depends': ['sale_stock', 'delivery_routes', |
3886 | + 'mrp', |
3887 | + "report_webkit", 'stock_extra'], |
3888 | + 'data': [ |
3889 | + #'security/security.xml', |
3890 | + 'security/ir.model.access.csv', |
3891 | + 'stock_view.xml', |
3892 | + "delivery_report.xml", |
3893 | + 'wizard/stock_view.xml', |
3894 | + 'sequence.xml', |
3895 | + ], |
3896 | + 'test': [], |
3897 | + 'demo': [], |
3898 | + 'installable': True, |
3899 | + 'auto_install': False, |
3900 | + 'application': False, |
3901 | +} |
3902 | + |
3903 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3904 | |
3905 | === added file 'delivery_plan/delivery_report.xml' |
3906 | --- delivery_plan/delivery_report.xml 1970-01-01 00:00:00 +0000 |
3907 | +++ delivery_plan/delivery_report.xml 2013-12-30 03:21:22 +0000 |
3908 | @@ -0,0 +1,73 @@ |
3909 | +<?xml version="1.0"?> |
3910 | +<openerp> |
3911 | + <data> |
3912 | + <record id="ir_header_webkit_delivery_routes" model="ir.header_webkit"> |
3913 | + <field eval=""""Portrait"""" name="orientation"/> |
3914 | + <field eval=""""A4"""" name="format"/> |
3915 | + <field eval=""""DeliveryRoutes"""" name="name"/> |
3916 | + <field eval="15.0" name="margin_top"/> |
3917 | + <field name="footer_html"><![CDATA[<html> |
3918 | + <head> |
3919 | + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> |
3920 | + <script> |
3921 | + function subst() { |
3922 | + var vars={}; |
3923 | + var x=document.location.search.substring(1).split('&'); |
3924 | + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} |
3925 | + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
3926 | + for(var i in x) { |
3927 | + var y = document.getElementsByClassName(x[i]); |
3928 | + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; |
3929 | + } |
3930 | + } |
3931 | + </script> |
3932 | + </head> |
3933 | + <body style="border:0; margin: 0;" onload="subst()"> |
3934 | + <table style="border-top: 1px solid black; font-size:8px; width: 100%; position:absolute;"> |
3935 | + <tr> |
3936 | + <td width="10%"><b>备注</b></td><td width="80%">1.拿货前请先确认是否有以下货物并勾选(干货蔬果,冰冻货物,熟食,饼房). 2.支付方式简写 现金 C,刷卡 P,不收钱 NC,券 Q(配送结束时填写)</td> |
3937 | + </tr> |
3938 | + <tr> |
3939 | + <td width="10%"></td><td width="80%">3.配送结果有以下几种:1:配送成功。2:没有收钱。3:部分退货.4:改时间送。(配送结束时填写)</td> |
3940 | + </tr> |
3941 | + </table> |
3942 | + </body> |
3943 | +</html>]]></field> |
3944 | + <field name="html"><![CDATA[<html> |
3945 | + <head> |
3946 | + <meta content="text/html; charset=UTF-8" http-equiv="content-type"/> |
3947 | + <script> |
3948 | + function subst() { |
3949 | + var vars={}; |
3950 | + var x=document.location.search.substring(1).split('&'); |
3951 | + for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);} |
3952 | + var x=['frompage','topage','page','webpage','section','subsection','subsubsection']; |
3953 | + for(var i in x) { |
3954 | + var y = document.getElementsByClassName(x[i]); |
3955 | + for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]]; |
3956 | + } |
3957 | + } |
3958 | + </script> |
3959 | + <style type="text/css"> |
3960 | + ${css} |
3961 | + </style> |
3962 | + </head> |
3963 | + <body style="border:0; margin: 0;" onload="subst()"> |
3964 | + ${_debug or ''|n} </body> |
3965 | +</html>]]> |
3966 | +</field> |
3967 | + |
3968 | + <field name="css" ><![CDATA[ |
3969 | +body { font-family:Helvetica; font-size:12px; } |
3970 | +.title { font-size:16px; font-weight: bold; text-align: center; } |
3971 | +.basic_table{ text-align:center; border-collapse: collapse; } |
3972 | +.basic_table td { border:1px solid lightGrey; font-size:12px; } |
3973 | +td { padding: 0 3px; text-align:left; font-size: 12px; } |
3974 | +table.noborder, table.noborder tr, table.noborder tr td, tr.noborder, tr.noborder td, td.noborder { border: none; } |
3975 | +.dontcutme { page-break-inside: avoid; }]]> </field> |
3976 | + </record> |
3977 | + |
3978 | + <report id="report_delivery_route_print" name="delivery.route.print" string="Delivery Route" model="delivery.route" |
3979 | + file="fc_delivery_plan/report/delivery_route_print.mako" report_type="webkit" auto="False" header = "True" menu="True" webkit_header="ir_header_webkit_delivery_routes"/> |
3980 | + </data> |
3981 | +</openerp> |
3982 | \ No newline at end of file |
3983 | |
3984 | === added directory 'delivery_plan/i18n' |
3985 | === added file 'delivery_plan/i18n/zh_CN.po' |
3986 | --- delivery_plan/i18n/zh_CN.po 1970-01-01 00:00:00 +0000 |
3987 | +++ delivery_plan/i18n/zh_CN.po 2013-12-30 03:21:22 +0000 |
3988 | @@ -0,0 +1,703 @@ |
3989 | +# Translation of OpenERP Server. |
3990 | +# This file contains the translation of the following modules: |
3991 | +# * fc_delivery_plan |
3992 | +# |
3993 | +msgid "" |
3994 | +msgstr "" |
3995 | +"Project-Id-Version: OpenERP Server 7.0\n" |
3996 | +"Report-Msgid-Bugs-To: \n" |
3997 | +"POT-Creation-Date: 2013-03-11 10:05+0000\n" |
3998 | +"PO-Revision-Date: 2013-03-11 10:05+0000\n" |
3999 | +"Last-Translator: <>\n" |
4000 | +"Language-Team: \n" |
4001 | +"MIME-Version: 1.0\n" |
4002 | +"Content-Type: text/plain; charset=UTF-8\n" |
4003 | +"Content-Transfer-Encoding: \n" |
4004 | +"Plural-Forms: \n" |
4005 | + |
4006 | +#. module: fc_delivery_plan |
4007 | +#: field:delivery.route.line,to_be_received:0 |
4008 | +msgid "To be Received" |
4009 | +msgstr "待收" |
4010 | + |
4011 | +#. module: fc_delivery_plan |
4012 | +#: field:delivery.route.line,account_checked:0 |
4013 | +msgid "Checked" |
4014 | +msgstr "已检查" |
4015 | + |
4016 | +#. module: fc_delivery_plan |
4017 | +#: code:addons/fc_delivery_plan/sale.py:648 |
4018 | +#: code:addons/fc_delivery_plan/sale.py:657 |
4019 | +#, python-format |
4020 | +msgid "Error" |
4021 | +msgstr "错误" |
4022 | + |
4023 | +#. module: fc_delivery_plan |
4024 | +#: view:stock.picking:0 |
4025 | +msgid "Orders planned for the Past" |
4026 | +msgstr "已安排订单" |
4027 | + |
4028 | +#. module: fc_delivery_plan |
4029 | +#: view:delivery.route:0 |
4030 | +#: view:delivery.route.line:0 |
4031 | +#: view:stock.picking:0 |
4032 | +msgid "Group By..." |
4033 | +msgstr "分组..." |
4034 | + |
4035 | +#. module: fc_delivery_plan |
4036 | +#: view:delivery.route:0 |
4037 | +#: view:delivery.route.line:0 |
4038 | +#: view:stock.picking:0 |
4039 | +msgid "Today" |
4040 | +msgstr "今天" |
4041 | + |
4042 | +#. module: fc_delivery_plan |
4043 | +#: code:addons/fc_delivery_plan/sale.py:799 |
4044 | +#: field:delivery.route.line,customer_date:0 |
4045 | +#, python-format |
4046 | +msgid "Customer Delivery Time" |
4047 | +msgstr "客户发货时间" |
4048 | + |
4049 | +#. module: fc_delivery_plan |
4050 | +#: view:delivery.route.line:0 |
4051 | +msgid "Delivery for Today" |
4052 | +msgstr "今日配送" |
4053 | + |
4054 | +#. module: fc_delivery_plan |
4055 | +#: view:delivery.change.dts:0 |
4056 | +msgid "Update" |
4057 | +msgstr "更新" |
4058 | + |
4059 | +#. module: fc_delivery_plan |
4060 | +#: field:delivery.route.line,cs_remark:0 |
4061 | +msgid "CS Remark" |
4062 | +msgstr "CS备注" |
4063 | + |
4064 | +#. module: fc_delivery_plan |
4065 | +#: view:stock.picking:0 |
4066 | +msgid "Picking without batch" |
4067 | +msgstr "未设分拣批次" |
4068 | + |
4069 | +#. module: fc_delivery_plan |
4070 | +#: view:stock.picking:0 |
4071 | +msgid "Picking list" |
4072 | +msgstr "发货单" |
4073 | + |
4074 | +#. module: fc_delivery_plan |
4075 | +#: code:addons/fc_delivery_plan/sale.py:546 |
4076 | +#, python-format |
4077 | +msgid "Latest error" |
4078 | +msgstr "上次错误" |
4079 | + |
4080 | +#. module: fc_delivery_plan |
4081 | +#: field:delivery.route.line,picking_note:0 |
4082 | +msgid "DO Notes" |
4083 | +msgstr "发货单备注" |
4084 | + |
4085 | +#. module: fc_delivery_plan |
4086 | +#: field:delivery.route.line,delivered_cpt:0 |
4087 | +msgid "Delivered x times" |
4088 | +msgstr "已发货 x 次" |
4089 | + |
4090 | +#. module: fc_delivery_plan |
4091 | +#: selection:delivery.change.dts,action:0 |
4092 | +msgid "Blank DTS/PTS" |
4093 | +msgstr "未设DTS/PTS" |
4094 | + |
4095 | +#. module: fc_delivery_plan |
4096 | +#: view:stock.picking:0 |
4097 | +msgid "Batch" |
4098 | +msgstr "批次" |
4099 | + |
4100 | +#. module: fc_delivery_plan |
4101 | +#: code:addons/fc_delivery_plan/sale.py:657 |
4102 | +#, python-format |
4103 | +msgid "The Route Line %s (origin: %s) is confirmed. You can not change it." |
4104 | +msgstr "路线 %s (来源: %s) 已经确认. 不可修改." |
4105 | + |
4106 | +#. module: fc_delivery_plan |
4107 | +#: field:stock.tracking,ul_id:0 |
4108 | +msgid "Picking Box" |
4109 | +msgstr "移库单Box" |
4110 | + |
4111 | +#. module: fc_delivery_plan |
4112 | +#: field:delivery.route.line,origin:0 |
4113 | +#: view:stock.picking:0 |
4114 | +msgid "Origin" |
4115 | +msgstr "来源" |
4116 | + |
4117 | +#. module: fc_delivery_plan |
4118 | +#: help:stock.picking.in,dts_id:0 |
4119 | +msgid "Delivery time or turn to receive" |
4120 | +msgstr "配送时间(收货)" |
4121 | + |
4122 | +#. module: fc_delivery_plan |
4123 | +#: field:delivery.route.line,exceptions:0 |
4124 | +msgid "Received with exceptions" |
4125 | +msgstr "收货例外" |
4126 | + |
4127 | +#. module: fc_delivery_plan |
4128 | +#: model:ir.model,name:fc_delivery_plan.model_stock_move |
4129 | +msgid "Stock Move" |
4130 | +msgstr "库存调拨" |
4131 | + |
4132 | +#. module: fc_delivery_plan |
4133 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_dts_to_vans |
4134 | +msgid "delivery.dts_to_vans" |
4135 | +msgstr "delivery.dts_to_vans" |
4136 | + |
4137 | +#. module: fc_delivery_plan |
4138 | +#: field:delivery.change.dts,dts_id:0 |
4139 | +#: field:delivery.driver_for_routes,dts_id:0 |
4140 | +#: field:delivery.dts_to_routes,dts_id:0 |
4141 | +#: field:delivery.dts_to_vans,dts_id:0 |
4142 | +#: view:delivery.route:0 |
4143 | +#: view:delivery.route.line:0 |
4144 | +#: field:delivery.route.line,dts_id:0 |
4145 | +#: view:sale.order:0 |
4146 | +#: field:sale.order,dts_id:0 |
4147 | +#: field:stock.move,dts_id:0 |
4148 | +#: view:stock.picking:0 |
4149 | +#: field:stock.picking.in,dts_id:0 |
4150 | +#: field:stock.picking.in,route_line_id:0 |
4151 | +#: field:stock.picking.out,route_line_id:0 |
4152 | +msgid "Delivery Time" |
4153 | +msgstr "发货时间" |
4154 | + |
4155 | +#. module: fc_delivery_plan |
4156 | +#: view:stock.picking:0 |
4157 | +msgid "Ready" |
4158 | +msgstr "就绪" |
4159 | + |
4160 | +#. module: fc_delivery_plan |
4161 | +#: view:delivery.driver:0 |
4162 | +#: view:delivery.route:0 |
4163 | +#: view:delivery.route.line:0 |
4164 | +msgid "Edit..." |
4165 | +msgstr "编辑..." |
4166 | + |
4167 | +#. module: fc_delivery_plan |
4168 | +#: field:delivery.route.line,adjustment:0 |
4169 | +msgid "Adjustment" |
4170 | +msgstr "调整" |
4171 | + |
4172 | +#. module: fc_delivery_plan |
4173 | +#: model:ir.model,name:fc_delivery_plan.model_stock_picking_out |
4174 | +msgid "Delivery Orders" |
4175 | +msgstr "送货单" |
4176 | + |
4177 | +#. module: fc_delivery_plan |
4178 | +#: field:delivery.change.dts,pts_id:0 |
4179 | +#: field:mrp.production,pts_id:0 |
4180 | +#: field:procurement.order,pts_id:0 |
4181 | +#: view:sale.order:0 |
4182 | +#: view:stock.picking:0 |
4183 | +#: field:stock.picking.in,pts_id:0 |
4184 | +msgid "Preparation Time" |
4185 | +msgstr "拣货时间" |
4186 | + |
4187 | +#. module: fc_delivery_plan |
4188 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_delivery_delivery_payment |
4189 | +msgid "Delivery Payments" |
4190 | +msgstr "发货支付" |
4191 | + |
4192 | +#. module: fc_delivery_plan |
4193 | +#: field:delivery.route.line,vip:0 |
4194 | +msgid "is VIP ?" |
4195 | +msgstr "是否 VIP ?" |
4196 | + |
4197 | +#. module: fc_delivery_plan |
4198 | +#: view:delivery.driver_for_routes:0 |
4199 | +#: view:delivery.dts_to_routes:0 |
4200 | +#: view:delivery.dts_to_vans:0 |
4201 | +msgid "Confirm" |
4202 | +msgstr "确认" |
4203 | + |
4204 | +#. module: fc_delivery_plan |
4205 | +#: view:stock.picking:0 |
4206 | +msgid "Internal Picking List" |
4207 | +msgstr "内部分拣单" |
4208 | + |
4209 | +#. module: fc_delivery_plan |
4210 | +#: view:delivery.route.line:0 |
4211 | +msgid "State" |
4212 | +msgstr "状态" |
4213 | + |
4214 | +#. module: fc_delivery_plan |
4215 | +#: model:ir.model,name:fc_delivery_plan.model_stock_picking |
4216 | +msgid "Picking List" |
4217 | +msgstr "发货单" |
4218 | + |
4219 | +#. module: fc_delivery_plan |
4220 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_dts_to_routes |
4221 | +msgid "delivery.dts_to_routes" |
4222 | +msgstr "delivery.dts_to_routes" |
4223 | + |
4224 | +#. module: fc_delivery_plan |
4225 | +#: field:delivery.return.reason,type:0 |
4226 | +#: field:delivery.time,type:0 |
4227 | +msgid "Type" |
4228 | +msgstr "类型" |
4229 | + |
4230 | +#. module: fc_delivery_plan |
4231 | +#: view:stock.picking:0 |
4232 | +msgid "Expected Date" |
4233 | +msgstr "预计日期" |
4234 | + |
4235 | +#. module: fc_delivery_plan |
4236 | +#: selection:stock.picking.in,delivery_state:0 |
4237 | +msgid "Delivered with exception" |
4238 | +msgstr "发货例外" |
4239 | + |
4240 | +#. module: fc_delivery_plan |
4241 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_route_line |
4242 | +msgid "delivery.route.line" |
4243 | +msgstr "delivery.route.line" |
4244 | + |
4245 | +#. module: fc_delivery_plan |
4246 | +#: selection:delivery.route.line,complete_state:0 |
4247 | +msgid "Not planned" |
4248 | +msgstr "未计划" |
4249 | + |
4250 | +#. module: fc_delivery_plan |
4251 | +#: field:delivery.route.line,partner_phone:0 |
4252 | +msgid "Partner Phone" |
4253 | +msgstr "客户电话" |
4254 | + |
4255 | +#. module: fc_delivery_plan |
4256 | +#: view:stock.picking:0 |
4257 | +msgid "Related Order" |
4258 | +msgstr "相关单据" |
4259 | + |
4260 | +#. module: fc_delivery_plan |
4261 | +#: view:stock.picking:0 |
4262 | +msgid "Confirmed Internal Moves" |
4263 | +msgstr "确认内部调拨" |
4264 | + |
4265 | +#. module: fc_delivery_plan |
4266 | +#: selection:delivery.route.line,complete_state:0 |
4267 | +msgid "No redelivery" |
4268 | +msgstr "未重新发货" |
4269 | + |
4270 | +#. module: fc_delivery_plan |
4271 | +#: view:stock.picking:0 |
4272 | +msgid "Order Date" |
4273 | +msgstr "订单日期" |
4274 | + |
4275 | +#. module: fc_delivery_plan |
4276 | +#: model:ir.model,name:fc_delivery_plan.model_procurement_order |
4277 | +msgid "Procurement" |
4278 | +msgstr "需求单" |
4279 | + |
4280 | +#. module: fc_delivery_plan |
4281 | +#: view:stock.picking:0 |
4282 | +msgid "Orders planned for the Future" |
4283 | +msgstr "已计划订单" |
4284 | + |
4285 | +#. module: fc_delivery_plan |
4286 | +#: selection:delivery.route.line,complete_state:0 |
4287 | +msgid "Planned" |
4288 | +msgstr "已计划" |
4289 | + |
4290 | +#. module: fc_delivery_plan |
4291 | +#: view:delivery.route:0 |
4292 | +msgid "Delivery Routes" |
4293 | +msgstr "配送车次" |
4294 | + |
4295 | +#. module: fc_delivery_plan |
4296 | +#: view:delivery.driver:0 |
4297 | +#: view:delivery.route:0 |
4298 | +#: view:delivery.route.line:0 |
4299 | +msgid "Delete" |
4300 | +msgstr "删除" |
4301 | + |
4302 | +#. module: fc_delivery_plan |
4303 | +#: field:delivery.route.line,return_reasons:0 |
4304 | +msgid "Return Reasons" |
4305 | +msgstr "退货原因" |
4306 | + |
4307 | +#. module: fc_delivery_plan |
4308 | +#: code:addons/fc_delivery_plan/sale.py:800 |
4309 | +#: field:delivery.route.line,neighborhood:0 |
4310 | +#, python-format |
4311 | +msgid "Neighborhood" |
4312 | +msgstr "邻居" |
4313 | + |
4314 | +#. module: fc_delivery_plan |
4315 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_route_form_cs |
4316 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_route_form_cs |
4317 | +msgid "Delivery Route CS" |
4318 | +msgstr "发送路线 CS" |
4319 | + |
4320 | +#. module: fc_delivery_plan |
4321 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_time |
4322 | +msgid "delivery.time" |
4323 | +msgstr "delivery.time" |
4324 | + |
4325 | +#. module: fc_delivery_plan |
4326 | +#: view:stock.picking:0 |
4327 | +msgid "Past" |
4328 | +msgstr "过去" |
4329 | + |
4330 | +#. module: fc_delivery_plan |
4331 | +#: view:stock.picking:0 |
4332 | +msgid "Future" |
4333 | +msgstr "未来" |
4334 | + |
4335 | +#. module: fc_delivery_plan |
4336 | +#: selection:stock.picking.in,delivery_state:0 |
4337 | +msgid "Returned, no delivery" |
4338 | +msgstr "退回, 未发货" |
4339 | + |
4340 | +#. module: fc_delivery_plan |
4341 | +#: field:delivery.route.line,amount_received:0 |
4342 | +msgid "Received" |
4343 | +msgstr "已收" |
4344 | + |
4345 | +#. module: fc_delivery_plan |
4346 | +#: view:delivery.route:0 |
4347 | +#: view:delivery.route.line:0 |
4348 | +#: model:ir.actions.report.xml,name:fc_delivery_plan.report_delivery_route_print |
4349 | +msgid "Delivery Route" |
4350 | +msgstr "配送车次" |
4351 | + |
4352 | +#. module: fc_delivery_plan |
4353 | +#: view:delivery.change.dts:0 |
4354 | +#: view:delivery.driver_for_routes:0 |
4355 | +#: view:delivery.dts_to_routes:0 |
4356 | +#: view:delivery.dts_to_vans:0 |
4357 | +msgid "or" |
4358 | +msgstr "或者" |
4359 | + |
4360 | +#. module: fc_delivery_plan |
4361 | +#: view:stock.picking:0 |
4362 | +msgid "Picking already processed" |
4363 | +msgstr "分拣已处理" |
4364 | + |
4365 | +#. module: fc_delivery_plan |
4366 | +#: field:res.users,dts_id:0 |
4367 | +msgid "Last Used Delivery Time" |
4368 | +msgstr "上次配送时间" |
4369 | + |
4370 | +#. module: fc_delivery_plan |
4371 | +#: code:addons/fc_delivery_plan/sale.py:648 |
4372 | +#, python-format |
4373 | +msgid "The Route %s is confirmed, you can not add lines to it." |
4374 | +msgstr "路线 %s 已经确认, 不可增加新的明细." |
4375 | + |
4376 | +#. module: fc_delivery_plan |
4377 | +#: model:ir.model,name:fc_delivery_plan.model_mrp_production |
4378 | +msgid "Manufacturing Order" |
4379 | +msgstr "生产订单" |
4380 | + |
4381 | +#. module: fc_delivery_plan |
4382 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_delivery_wizard |
4383 | +msgid "Prepare Delivery Routes" |
4384 | +msgstr "准备配送路线" |
4385 | + |
4386 | +#. module: fc_delivery_plan |
4387 | +#: view:stock.picking:0 |
4388 | +msgid "Status" |
4389 | +msgstr "状态" |
4390 | + |
4391 | +#. module: fc_delivery_plan |
4392 | +#: model:ir.model,name:fc_delivery_plan.model_sale_order |
4393 | +msgid "Sales Order" |
4394 | +msgstr "销售订单" |
4395 | + |
4396 | +#. module: fc_delivery_plan |
4397 | +#: view:delivery.driver:0 |
4398 | +#: view:delivery.route:0 |
4399 | +#: view:delivery.route.line:0 |
4400 | +msgid "í" |
4401 | +msgstr "í" |
4402 | + |
4403 | +#. module: fc_delivery_plan |
4404 | +#: model:ir.model,name:fc_delivery_plan.model_stock_tracking |
4405 | +msgid "Packs" |
4406 | +msgstr "包装" |
4407 | + |
4408 | +#. module: fc_delivery_plan |
4409 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_line_form_cs |
4410 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_line_form_cs |
4411 | +msgid "Delivery Route Line CS" |
4412 | +msgstr "路线明细 CS" |
4413 | + |
4414 | +#. module: fc_delivery_plan |
4415 | +#: code:addons/fc_delivery_plan/sale.py:824 |
4416 | +#: view:delivery.dts_to_vans:0 |
4417 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_dts_to_vans |
4418 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_dts_to_vans |
4419 | +#, python-format |
4420 | +msgid "Prepare Vans for DTS" |
4421 | +msgstr "根据配送时间 Vans拣货" |
4422 | + |
4423 | +#. module: fc_delivery_plan |
4424 | +#: selection:delivery.route.line,complete_state:0 |
4425 | +#: view:stock.picking:0 |
4426 | +#: selection:stock.picking.in,delivery_state:0 |
4427 | +msgid "In delivery" |
4428 | +msgstr "配送中" |
4429 | + |
4430 | +#. module: fc_delivery_plan |
4431 | +#: field:picking.batch,active:0 |
4432 | +msgid "Active" |
4433 | +msgstr "可用" |
4434 | + |
4435 | +#. module: fc_delivery_plan |
4436 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_picking_batch |
4437 | +#: view:picking.batch:0 |
4438 | +#: field:stock.picking,batch_id:0 |
4439 | +#: field:stock.picking.in,batch_id:0 |
4440 | +#: field:stock.picking.out,batch_id:0 |
4441 | +msgid "Picking Batch" |
4442 | +msgstr "拣货批次" |
4443 | + |
4444 | +#. module: fc_delivery_plan |
4445 | +#: selection:stock.picking.in,delivery_state:0 |
4446 | +msgid "Not yet planned for delivery" |
4447 | +msgstr "还未计划配送" |
4448 | + |
4449 | +#. module: fc_delivery_plan |
4450 | +#: selection:delivery.route.line,complete_state:0 |
4451 | +msgid "Exception" |
4452 | +msgstr "例外" |
4453 | + |
4454 | +#. module: fc_delivery_plan |
4455 | +#: view:delivery.route.line:0 |
4456 | +msgid "Delivery Route Lines" |
4457 | +msgstr "配送车次清单" |
4458 | + |
4459 | +#. module: fc_delivery_plan |
4460 | +#: selection:delivery.time,type:0 |
4461 | +msgid "Preparation" |
4462 | +msgstr "拣货" |
4463 | + |
4464 | +#. module: fc_delivery_plan |
4465 | +#: field:delivery.route.line,amount_unpaid:0 |
4466 | +msgid "Unpaid" |
4467 | +msgstr "未付" |
4468 | + |
4469 | +#. module: fc_delivery_plan |
4470 | +#: field:stock.tracking,picking_id:0 |
4471 | +msgid "Picking Related" |
4472 | +msgstr "相关分拣" |
4473 | + |
4474 | +#. module: fc_delivery_plan |
4475 | +#: field:delivery.change.dts,action:0 |
4476 | +msgid "Action" |
4477 | +msgstr "动作" |
4478 | + |
4479 | +#. module: fc_delivery_plan |
4480 | +#: field:delivery.route.line,box_type:0 |
4481 | +msgid "Box Type" |
4482 | +msgstr "Box 类型" |
4483 | + |
4484 | +#. module: fc_delivery_plan |
4485 | +#: view:delivery.route:0 |
4486 | +#: view:delivery.route.line:0 |
4487 | +msgid "Delivery Route for Today" |
4488 | +msgstr "今日配送路线" |
4489 | + |
4490 | +#. module: fc_delivery_plan |
4491 | +#: code:addons/fc_delivery_plan/sale.py:840 |
4492 | +#: view:delivery.dts_to_routes:0 |
4493 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_dts_to_routes |
4494 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_dts_to_routes |
4495 | +#, python-format |
4496 | +msgid "Prepare Routes for DTS" |
4497 | +msgstr "根据配送时间 预备路线" |
4498 | + |
4499 | +#. module: fc_delivery_plan |
4500 | +#: field:delivery.route.line,driver_phone:0 |
4501 | +msgid "Driver Phone" |
4502 | +msgstr "司机电话" |
4503 | + |
4504 | +#. module: fc_delivery_plan |
4505 | +#: view:stock.picking:0 |
4506 | +msgid "Orders planned for Today" |
4507 | +msgstr "今日安排订单" |
4508 | + |
4509 | +#. module: fc_delivery_plan |
4510 | +#: view:delivery.route:0 |
4511 | +#: view:stock.picking:0 |
4512 | +msgid "Done" |
4513 | +msgstr "完成" |
4514 | + |
4515 | +#. module: fc_delivery_plan |
4516 | +#: view:delivery.change.dts:0 |
4517 | +#: view:delivery.driver_for_routes:0 |
4518 | +#: view:delivery.dts_to_routes:0 |
4519 | +#: view:delivery.dts_to_vans:0 |
4520 | +#: selection:delivery.route.line,complete_state:0 |
4521 | +msgid "Cancel" |
4522 | +msgstr "取消" |
4523 | + |
4524 | +#. module: fc_delivery_plan |
4525 | +#: selection:stock.picking.in,delivery_state:0 |
4526 | +msgid "Planned for delivery" |
4527 | +msgstr "配送计划" |
4528 | + |
4529 | +#. module: fc_delivery_plan |
4530 | +#: selection:delivery.route.line,complete_state:0 |
4531 | +#: view:stock.picking:0 |
4532 | +#: selection:stock.picking.in,delivery_state:0 |
4533 | +msgid "Delivered" |
4534 | +msgstr "已配送" |
4535 | + |
4536 | +#. module: fc_delivery_plan |
4537 | +#: code:addons/fc_delivery_plan/sale.py:856 |
4538 | +#: view:delivery.driver_for_routes:0 |
4539 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_driver_for_routes |
4540 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_driver_for_routes |
4541 | +#, python-format |
4542 | +msgid "Choose Driver / Deliver for DTS" |
4543 | +msgstr "根据配送时间 选择司机 / 送货" |
4544 | + |
4545 | +#. module: fc_delivery_plan |
4546 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_return_type |
4547 | +#: model:ir.ui.menu,name:fc_delivery_plan.menu_action_delivery_return_type |
4548 | +msgid "Return Reason Type" |
4549 | +msgstr "退货原因类型" |
4550 | + |
4551 | +#. module: fc_delivery_plan |
4552 | +#: model:ir.model,name:fc_delivery_plan.model_stock_picking_in |
4553 | +msgid "Incoming Shipments" |
4554 | +msgstr "入库" |
4555 | + |
4556 | +#. module: fc_delivery_plan |
4557 | +#: field:picking.batch,picking_ids:0 |
4558 | +msgid "Contains" |
4559 | +msgstr "包含" |
4560 | + |
4561 | +#. module: fc_delivery_plan |
4562 | +#: field:delivery.route.line,complete_state:0 |
4563 | +#: view:stock.picking:0 |
4564 | +#: field:stock.picking.in,delivery_state:0 |
4565 | +msgid "Delivery State" |
4566 | +msgstr "配送状态" |
4567 | + |
4568 | +#. module: fc_delivery_plan |
4569 | +#: model:ir.model,name:fc_delivery_plan.model_picking_batch |
4570 | +msgid "picking.batch" |
4571 | +msgstr "拣货批次" |
4572 | + |
4573 | +#. module: fc_delivery_plan |
4574 | +#: field:delivery.route.line,so_payment_method:0 |
4575 | +msgid "Payment Method" |
4576 | +msgstr "付款方式" |
4577 | + |
4578 | +#. module: fc_delivery_plan |
4579 | +#: selection:delivery.route.line,complete_state:0 |
4580 | +msgid "Returned" |
4581 | +msgstr "已退货" |
4582 | + |
4583 | +#. module: fc_delivery_plan |
4584 | +#: view:stock.picking:0 |
4585 | +msgid "Assigned Internal Moves" |
4586 | +msgstr "指定的内部调拨" |
4587 | + |
4588 | +#. module: fc_delivery_plan |
4589 | +#: view:stock.picking:0 |
4590 | +msgid "Journal" |
4591 | +msgstr "账簿" |
4592 | + |
4593 | +#. module: fc_delivery_plan |
4594 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_delivery_route_driver_kanban |
4595 | +msgid "Delivery Route Driver Kanban" |
4596 | +msgstr "配送路线司机看板" |
4597 | + |
4598 | +#. module: fc_delivery_plan |
4599 | +#: selection:delivery.time,type:0 |
4600 | +msgid "Delivery" |
4601 | +msgstr "配送" |
4602 | + |
4603 | +#. module: fc_delivery_plan |
4604 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_driver_for_routes |
4605 | +msgid "delivery.driver_for_routes" |
4606 | +msgstr "delivery.driver_for_routes" |
4607 | + |
4608 | +#. module: fc_delivery_plan |
4609 | +#: view:stock.picking:0 |
4610 | +msgid "Waiting" |
4611 | +msgstr "正在等待" |
4612 | + |
4613 | +#. module: fc_delivery_plan |
4614 | +#: selection:delivery.change.dts,action:0 |
4615 | +msgid "Change DTS/PTS" |
4616 | +msgstr "变更 DTS/PTS" |
4617 | + |
4618 | +#. module: fc_delivery_plan |
4619 | +#: field:delivery.return.reason,reason:0 |
4620 | +#: field:delivery.return.type,name:0 |
4621 | +#: field:picking.batch,name:0 |
4622 | +msgid "Name" |
4623 | +msgstr "名称" |
4624 | + |
4625 | +#. module: fc_delivery_plan |
4626 | +#: view:stock.picking:0 |
4627 | +msgid "Not Planned" |
4628 | +msgstr "未计划" |
4629 | + |
4630 | +#. module: fc_delivery_plan |
4631 | +#: view:delivery.route.line:0 |
4632 | +msgid "Route" |
4633 | +msgstr "路线" |
4634 | + |
4635 | +#. module: fc_delivery_plan |
4636 | +#: selection:stock.picking.in,delivery_state:0 |
4637 | +msgid "Delivered and returned" |
4638 | +msgstr "已配送和已退回" |
4639 | + |
4640 | +#. module: fc_delivery_plan |
4641 | +#: field:stock.picking.in,carrier_id:0 |
4642 | +msgid "Carrier" |
4643 | +msgstr "运输工具" |
4644 | + |
4645 | +#. module: fc_delivery_plan |
4646 | +#: view:delivery.change.dts:0 |
4647 | +#: model:ir.actions.act_window,name:fc_delivery_plan.action_stock_change_dts_wizard |
4648 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_change_dts |
4649 | +msgid "Change DTS / PTS" |
4650 | +msgstr "变更 DTS / PTS" |
4651 | + |
4652 | +#. module: fc_delivery_plan |
4653 | +#: field:delivery.return.reason,route_line_id:0 |
4654 | +msgid "Delivery Route Line" |
4655 | +msgstr "配送路线明细" |
4656 | + |
4657 | +#. module: fc_delivery_plan |
4658 | +#: model:ir.model,name:fc_delivery_plan.model_res_users |
4659 | +msgid "Users" |
4660 | +msgstr "用户" |
4661 | + |
4662 | +#. module: fc_delivery_plan |
4663 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_return_reason |
4664 | +msgid "delivery.return.reason" |
4665 | +msgstr "delivery.return.reason" |
4666 | + |
4667 | +#. module: fc_delivery_plan |
4668 | +#: field:delivery.return.type,sequence:0 |
4669 | +msgid "Sequence" |
4670 | +msgstr "序号" |
4671 | + |
4672 | +#. module: fc_delivery_plan |
4673 | +#: model:ir.model,name:fc_delivery_plan.model_delivery_return_type |
4674 | +msgid "delivery.return.type" |
4675 | +msgstr "delivery.return.type" |
4676 | + |
4677 | +#. module: fc_delivery_plan |
4678 | +#: view:stock.picking:0 |
4679 | +msgid "No batch" |
4680 | +msgstr "未设批次" |
4681 | + |
4682 | +#. module: fc_delivery_plan |
4683 | +#: field:delivery.route.line,amount_total:0 |
4684 | +msgid "Total" |
4685 | +msgstr "合计" |
4686 | + |
4687 | +#. module: fc_delivery_plan |
4688 | +#: field:delivery.route.line,account_remark:0 |
4689 | +msgid "Remark Accounting" |
4690 | +msgstr "财务备注" |
4691 | + |
4692 | |
4693 | === added file 'delivery_plan/partner.py' |
4694 | --- delivery_plan/partner.py 1970-01-01 00:00:00 +0000 |
4695 | +++ delivery_plan/partner.py 2013-12-30 03:21:22 +0000 |
4696 | @@ -0,0 +1,33 @@ |
4697 | +# -*- coding: utf-8 -*- |
4698 | +############################################################################## |
4699 | +# |
4700 | +# OpenERP, Open Source Management Solution |
4701 | +# Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. |
4702 | +# Author: Yannick Gouin <yannick.gouin@elico-corp.com> |
4703 | +# |
4704 | +# This program is free software: you can redistribute it and/or modify |
4705 | +# it under the terms of the GNU Affero General Public License as |
4706 | +# published by the Free Software Foundation, either version 3 of the |
4707 | +# License, or (at your option) any later version. |
4708 | +# |
4709 | +# This program is distributed in the hope that it will be useful, |
4710 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4711 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4712 | +# GNU Affero General Public License for more details. |
4713 | +# |
4714 | +# You should have received a copy of the GNU Affero General Public License |
4715 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4716 | +# |
4717 | +############################################################################## |
4718 | + |
4719 | +from openerp.osv import osv, fields |
4720 | + |
4721 | + |
4722 | +class res_partner(osv.osv): |
4723 | + _inherit = "res.partner" |
4724 | + |
4725 | + _columns = { |
4726 | + 'deliver_zone': fields.char('Delivery Zone', size= 64), |
4727 | + } |
4728 | + |
4729 | +res_partner() |
4730 | \ No newline at end of file |
4731 | |
4732 | === added directory 'delivery_plan/report' |
4733 | === added file 'delivery_plan/report/__init__.py' |
4734 | --- delivery_plan/report/__init__.py 1970-01-01 00:00:00 +0000 |
4735 | +++ delivery_plan/report/__init__.py 2013-12-30 03:21:22 +0000 |
4736 | @@ -0,0 +1,32 @@ |
4737 | +# -*- encoding: utf-8 -*- |
4738 | +############################################################################## |
4739 | +# |
4740 | +# OpenERP, Open Source Management Solution |
4741 | +# Copyright (c) 2011 Cubic ERP - Teradata SAC. (http://cubicerp.com). |
4742 | +# |
4743 | +# WARNING: This program as such is intended to be used by professional |
4744 | +# programmers who take the whole responsability of assessing all potential |
4745 | +# consequences resulting from its eventual inadequacies and bugs |
4746 | +# End users who are looking for a ready-to-use solution with commercial |
4747 | +# garantees and support are strongly adviced to contract a Free Software |
4748 | +# Service Company |
4749 | +# |
4750 | +# This program is Free Software; you can redistribute it and/or |
4751 | +# modify it under the terms of the GNU General Public License |
4752 | +# as published by the Free Software Foundation; either version 2 |
4753 | +# of the License, or (at your option) any later version. |
4754 | +# |
4755 | +# This program is distributed in the hope that it will be useful, |
4756 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4757 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4758 | +# GNU General Public License for more details. |
4759 | +# |
4760 | +# You should have received a copy of the GNU General Public License |
4761 | +# along with this program; if not, write to the Free Software |
4762 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
4763 | +# |
4764 | +############################################################################## |
4765 | + |
4766 | +import delivery_route_print |
4767 | + |
4768 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4769 | \ No newline at end of file |
4770 | |
4771 | === added file 'delivery_plan/report/delivery_route_print.mako' |
4772 | --- delivery_plan/report/delivery_route_print.mako 1970-01-01 00:00:00 +0000 |
4773 | +++ delivery_plan/report/delivery_route_print.mako 2013-12-30 03:21:22 +0000 |
4774 | @@ -0,0 +1,110 @@ |
4775 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
4776 | +<html> |
4777 | + <head> |
4778 | + <meta content="text/html; charset=UTF-8" http-equiv="content-type"> |
4779 | + <style type="text/css"> |
4780 | + ${css} |
4781 | + </style> |
4782 | + </head> |
4783 | + <body> |
4784 | + <% cpt = 0 %> |
4785 | + %for delivery_route in objects : |
4786 | +%if cpt > 0: |
4787 | +<div style="page-break-after: always;"><span style="display: none;"> </span></div> |
4788 | +%endif |
4789 | + <div class="title">Delivery Distribution Control Sheet (配送交接控制表)</div> |
4790 | + <div style="font-size:12px;font-style:italic;text-align:center;">Ref / 编号 : ${delivery_route.name}</div> |
4791 | + <td><b></b></td><td></td> |
4792 | + <br /> |
4793 | + <table class="basic_table" width="100%"> |
4794 | + <tr> |
4795 | + <td width="17%"><b>Date<br />日期</b></td><td width="33%">${delivery_route.date}</td> |
4796 | + <td width="17%"><b>Time Slot<br />时间段</b></td><td>${delivery_route.dts_id.name or ' '}</td> |
4797 | + </tr> |
4798 | + <tr> |
4799 | + <td><b>Driver<br />驾驶员</b></td><td>${delivery_route.driver_id.name or ' '}</td> |
4800 | + <td><b>Deliver<br />送货员</b></td><td>${delivery_route.picker_id.name or ' '}</td> |
4801 | + </tr> |
4802 | + <tr> |
4803 | + <td><b>Departure Time<br />出发时间</b></td><td>${delivery_route.departure_date or ' '}</td> |
4804 | + <td><b>Operation Rep<br />运营人员</b></td><td></td> |
4805 | + </tr> |
4806 | + </table> |
4807 | + <br /> |
4808 | + <div class="main"> |
4809 | + <table width="100%" class="basic_table"> |
4810 | + <tbody> |
4811 | + <tr style="font-weight:bold;"> |
4812 | + <td style="height:26px;" colspan="4">Reason for delayed/Early departure 延迟的原因</td> |
4813 | + <td colspan="2">出库公里数: </td> |
4814 | + <td colspan="2">回库公里数: </td> |
4815 | + </tr> |
4816 | + <tr style="font-weight:bold;"> |
4817 | + <td style="vertical-align:top; height:30px;" colspan="8"> </td> |
4818 | + </tr> |
4819 | + <tr style="font-weight:bold;"> |
4820 | + <td style="text-align:center; height:16px;" colspan="8">List of deliveries / 交货清单</td> |
4821 | + </tr> |
4822 | + <tr style="font-weight:bold;"> |
4823 | + <td style="vertical-align:top; width:15px;">No</td> |
4824 | + <td style="vertical-align:top; width:70px;">Order <br /> 单号</td> |
4825 | + <td style="vertical-align:top; width:48px;">T<br />装箱</td> |
4826 | + <td style="vertical-align:top; width:175px;">Address<br />地址</td> |
4827 | + <td style="vertical-align:top;">Time<br />时间要求</td> |
4828 | + <td style="vertical-align:top;">Payment<br />支付方式</td> |
4829 | + <td style="vertical-align:top; width:75px;">Arrive Time<br />到达时间</td> |
4830 | + <td style="vertical-align:top; width:75px;">Observation<br />结果</td> |
4831 | + </tr> |
4832 | + <% cpt=0 %> |
4833 | + %for line in delivery_route.line_ids: |
4834 | + <% cpt+=1 %> |
4835 | + <% iced = False %> |
4836 | + <% warm = False %> |
4837 | + <% other = False %> |
4838 | + %if line.vip: |
4839 | + <tr style="font-style:italic;"> |
4840 | + %else: |
4841 | + <tr> |
4842 | + %endif |
4843 | + <td style="vertical-align: top;"><div class="dontcutme">${cpt}</div></td> |
4844 | + <td style="vertical-align: top;"><div class="dontcutme">${line.origin and line.origin or ''}<!--${line.picking_id.name and '('+ line.picking_id.name + ')' or ''}--></div></td> |
4845 | + <td style="vertical-align: top;"><div class="dontcutme"><% |
4846 | + pack_set = set([ move.product_id.joomla_deliver_in for move in line.picking_id.move_lines ]) |
4847 | + %> |
4848 | + % for pack in pack_set: |
4849 | + %if pack in ['warm', 'iced', 'iced_n_warm','cold']: |
4850 | + %if pack in ['iced', 'iced_n_warm'] and not iced: |
4851 | + <input type="checkbox" /> 冻F<br /> |
4852 | + <% iced = True %> |
4853 | + %endif |
4854 | + %if pack in ['warm', 'iced_n_warm'] and not warm: |
4855 | + <input type="checkbox" /> 热W<br /> |
4856 | + <% warm = True %> |
4857 | + %endif |
4858 | + %if pack in ['cold']: |
4859 | + <input type="checkbox" /> 冷C<br /> |
4860 | + <% warm = True %> |
4861 | + %endif |
4862 | + %else: |
4863 | + %if not other: |
4864 | + <input type="checkbox" /> 常温<br /> |
4865 | + <% other = True %> |
4866 | + %endif |
4867 | + %endif |
4868 | + %endfor |
4869 | + </div></td> |
4870 | + <td style="vertical-align: top;"><div class="dontcutme">${line.address_id.name or ''}<br />${line.street or line.address_id.street or ''}</div></td> |
4871 | + <td style="vertical-align: top;"><div class="dontcutme">${line.customer_date or ''}</div></td> |
4872 | + <td style="vertical-align: top;"><div class="dontcutme">${line.so_payment_method or ''}</div></td> |
4873 | + <td style="vertical-align: top;"> </td> |
4874 | + <td style="vertical-align: top;"> </td> |
4875 | + </tr> |
4876 | + %endfor |
4877 | + </tbody> |
4878 | + </table> |
4879 | + </div> |
4880 | + <div style="page-break-after: auto;"><span style="display: none;"> </span></div> |
4881 | + <% cpt+=1 %> |
4882 | + %endfor |
4883 | + </body> |
4884 | +</html> |
4885 | \ No newline at end of file |
4886 | |
4887 | === added file 'delivery_plan/report/delivery_route_print.mako.1' |
4888 | --- delivery_plan/report/delivery_route_print.mako.1 1970-01-01 00:00:00 +0000 |
4889 | +++ delivery_plan/report/delivery_route_print.mako.1 2013-12-30 03:21:22 +0000 |
4890 | @@ -0,0 +1,111 @@ |
4891 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
4892 | +<html> |
4893 | + <head> |
4894 | + <meta content="text/html; charset=UTF-8" http-equiv="content-type"> |
4895 | + <style type="text/css"> |
4896 | + ${css} |
4897 | + </style> |
4898 | + </head> |
4899 | + <body> |
4900 | + <% cpt = 0 %> |
4901 | + %for delivery_route in objects : |
4902 | +%if cpt > 0: |
4903 | +<div style="page-break-after: always;"><span style="display: none;"> </span></div> |
4904 | +%endif |
4905 | + <div class="title">Delivery Distribution Control Sheet (配送交接控制表)</div> |
4906 | + <div style="font-size:12px;font-style:italic;text-align:center;">Ref / 编号 : ${delivery_route.name}</div> |
4907 | + <td><b></b></td><td></td> |
4908 | + <br /> |
4909 | + <table class="basic_table" width="100%"> |
4910 | + <tr> |
4911 | + <td width="17%"><b>Date<br />日期</b></td><td width="33%">${delivery_route.date}</td> |
4912 | + <td width="17%"><b>Time Slot<br />时间段</b></td><td>${delivery_route.dts_id.name or ' '}</td> |
4913 | + </tr> |
4914 | + <tr> |
4915 | + <td><b>Driver<br />驾驶员</b></td><td>${delivery_route.driver_id.name or ' '}</td> |
4916 | + <td><b>Deliver<br />送货员</b></td><td>${delivery_route.picker_id.name or ' '}</td> |
4917 | + </tr> |
4918 | + <tr> |
4919 | + <td><b>Departure Time<br />出发时间</b></td><td>${delivery_route.departure_date or ' '}</td> |
4920 | + <td><b>Operation Rep<br />运营人员</b></td><td></td> |
4921 | + </tr> |
4922 | + </table> |
4923 | + <br /> |
4924 | + <div class="main"> |
4925 | + <table width="100%" class="basic_table"> |
4926 | + <tbody> |
4927 | + <tr style="font-weight:bold;"> |
4928 | + <td style="border:0; padding-left:15px;vertical-align:top; height:16px;" colspan="8">Reason for delayed/Early departure 延迟的原因 |
4929 | + / |
4930 | + 出库公里数 <u> </u> |
4931 | + / 回库公里数 <u> </u></td> |
4932 | + </tr> |
4933 | + <tr style="font-weight:bold;"> |
4934 | + <td style="vertical-align:top; height:30px;" colspan="8"> </td> |
4935 | + </tr> |
4936 | + <tr style="font-weight:bold;"> |
4937 | + <td style="text-align:center; height:16px;" colspan="8">List of deliveries / 交货清单</td> |
4938 | + </tr> |
4939 | + <tr style="font-weight:bold;"> |
4940 | + <td style="vertical-align:top; width:15px;">No</td> |
4941 | + <td style="vertical-align:top; width:70px;">Order <br /> 单号</td> |
4942 | + <td style="vertical-align:top; width:48px;">T<br />装箱</td> |
4943 | + <td style="vertical-align:top; width:175px;">Address<br />地址</td> |
4944 | + <td style="vertical-align:top;">Time<br />时间要求</td> |
4945 | + <td style="vertical-align:top;">Payment<br />支付方式</td> |
4946 | + <td style="vertical-align:top; width:75px;">Arrive Time<br />到达时间</td> |
4947 | + <td style="vertical-align:top; width:75px;">Observation<br />结果</td> |
4948 | + </tr> |
4949 | + <% cpt=0 %> |
4950 | + %for line in delivery_route.line_ids: |
4951 | + <% cpt+=1 %> |
4952 | + <% iced = False %> |
4953 | + <% warm = False %> |
4954 | + <% other = False %> |
4955 | + %if line.vip: |
4956 | + <tr style="font-style:italic;"> |
4957 | + %else: |
4958 | + <tr> |
4959 | + %endif |
4960 | + <td style="vertical-align: top;"><div class="dontcutme">${cpt}</div></td> |
4961 | + <td style="vertical-align: top;"><div class="dontcutme">${line.origin and line.origin or ''}<!--${line.picking_id.name and '('+ line.picking_id.name + ')' or ''}--></div></td> |
4962 | + <td style="vertical-align: top;"><div class="dontcutme"><% |
4963 | + pack_set = set([ move.product_id.joomla_deliver_in for move in line.picking_id.move_lines ]) |
4964 | + %> |
4965 | + % for pack in pack_set: |
4966 | + %if pack in ['warm', 'iced', 'iced_n_warm']: |
4967 | + %if pack in ['iced', 'iced_n_warm'] and not iced: |
4968 | + <input type="checkbox" /> 冻F<br /> |
4969 | + <% iced = True %> |
4970 | + %endif |
4971 | + %if pack in ['warm', 'iced_n_warm'] and not warm: |
4972 | + <input type="checkbox" /> 热W<br /> |
4973 | + <% warm = True %> |
4974 | + %endif |
4975 | + %if pack in ['cold']: |
4976 | + <input type="checkbox" /> 冷C<br /> |
4977 | + <% warm = True %> |
4978 | + %endif |
4979 | + %else: |
4980 | + %if not other: |
4981 | + <input type="checkbox" /> 常温<br /> |
4982 | + <% other = True %> |
4983 | + %endif |
4984 | + %endif |
4985 | + %endfor |
4986 | + </div></td> |
4987 | + <td style="vertical-align: top;"><div class="dontcutme">${line.address_id.name or ''}<br />${line.street or line.address_id.street or ''}</div></td> |
4988 | + <td style="vertical-align: top;"><div class="dontcutme">${line.customer_date or ''}</div></td> |
4989 | + <td style="vertical-align: top;"><div class="dontcutme">${line.so_payment_method or ''}</div></td> |
4990 | + <td style="vertical-align: top;"> </td> |
4991 | + <td style="vertical-align: top;"> </td> |
4992 | + </tr> |
4993 | + %endfor |
4994 | + </tbody> |
4995 | + </table> |
4996 | + </div> |
4997 | + <div style="page-break-after: auto;"><span style="display: none;"> </span></div> |
4998 | + <% cpt+=1 %> |
4999 | + %endfor |
5000 | + </body> |
The diff has been truncated for viewing.